Jump to content

find parent port?


Recommended Posts


I am looking to extract hierarchy and connections within my SystemC module. Currently for an sc_port I can retrieve the bound interfaces and their counts via get_interface() and bind_count() respectively, but I'd also like to know if the sc_port has a parent port and if yes, how to find that parent. I looked at the reference manual but there seems to be no way to do this? 

I am very new to SystemC, so I'd really appreciate your help. Thanks! 

Link to comment
Share on other sites

I had the same problem when working on connection visualization tool for SystemC, had to hack SystemC kernel to preserve port-to-port connections after elaboration.

What I've found that in many real models some ports are connected through hierarchical boundaries like:

input_port.bind ( mod.submod.other_submod.channel )

So I also had to create "virtual" ports, that do not exist in code, just for visualization. 

Link to comment
Share on other sites

I see this question a lot. Perhaps an enhancement idea for a future SystemC. register_port could be augmented by adding a bit of data to channels to record the connecting parent. This would add a small structure (?vector<sc_object*>?), and add a tiny bit prior to start of simulation. Providing a "netlist" helps to confirm everything is connected correctly. Of course it won't for all the connectivity (e.g. a global clock object), but it would go a long way.

Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...