juliomelo Posted March 1, 2013 Report Share Posted March 1, 2013 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. Quote Link to comment Share on other sites More sharing options...
Philipp A Hartmann Posted March 1, 2013 Report Share Posted March 1, 2013 …, however I have no information about connectivity. ... 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()); } ... There is information about the connectivity in the above snippet. You just need to store the relation between the ports you find (optr) and the connected channels (optr->get_interface()) in an appropriate data structure that fits your requirements. HTH and Greetings from Oldenburg, Philipp Quote Link to comment Share on other sites More sharing options...
juliomelo Posted March 4, 2013 Author Report Share Posted March 4, 2013 Thanks for the reply Philip. I was missing that method. []s Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.