Quantcast
Channel: SystemC Language Forum RSS Feed
Viewing all articles
Browse latest Browse all 595

Extract structural information from SystemC

$
0
0
Hi guys,

I'm a student, but experienced in c++, however not that much in SystemC. I'm trying to use SystemC to extract information about digital systems.

I mean, given a model in systemC, I'd like to know how the components are connected, through which signals. If possible I'd like to know information about signals as well (only the size of data is enough I think).

I have already found something in the internet that allows me to travel among the component's tree. Using the code below I can list every signal, entit, ports and other things for a given component, however I have no information about connectivity.

void get_child_port_ifs(std::vector<sc_object*> &children, std::vector<sc_interface*> &IfRefs) {
  for (std::vector<sc_object*>::iterator i = children.begin(); i !=
	  children.end(); i++) {
    if ( std::string((*i)->kind())=="sc_module" ) {
	  std::cout<<"found module "<<(*i)->name()<<std::endl;
	  sc_module* mptr = dynamic_cast<sc_module*>(*i);
	  std::vector<sc_object*> children = mptr->get_child_objects();
	  get_child_port_ifs(children,IfRefs);
    }
    else if (std::string((*i)->kind())=="sc_in" || std::string((*i)->kind()) =="sc_out") {
	  std::cout<<"found port "<<(*i)->name()<<std::endl;
	  sc_port_base * optr = dynamic_cast<sc_port_base*>(*i);
	  IfRefs.push_back(optr->get_interface());
    }
    else{
	  if (std::string((*i)->kind()) == "sc_signal")
	    std::cout<<"found signal  "<<(*i)->name()<<std::endl;
	  else
	    std::cout<<"found other child type "<<(*i)->kind()<<" name "<<(*i)->name()<<std::endl;
    }
  }
}

Thanks every one.

Viewing all articles
Browse latest Browse all 595

Latest Images

Trending Articles



Latest Images