Jump to content

How to implement parent-child relationship?


Recommended Posts

In my C++ programs, I used to pass pointers between parents and children, in form that in parent I create

Child* MyChild(this);

that the child constructor saves the received pointer, so they can mutually refer to each other. I understand that I can do the same if I add the name of the object. In C++, there is some difference if I create an object on the stack (or global) and on the heap. What is the difference in SystemC between them (also in using resources, wiring and speed of execution). What is the "best" way of connecting submodules (wiring, data transfer, and speed)?


Link to comment
Share on other sites

Hello @katang,

In SystemC the parent and child relationship is intrinsically handled by the Kernel.

Kindly refer the SystemC LRM Section for more details.

Their should be no differences in stack and heap allocated objects.

As for the last part it is not very clear what you are asking. Can you elaborate more on the last part?


Ameya Vikram Singh

Link to comment
Share on other sites

Hello @Ameya,

thanks for the hint. I found


which is 12 years old, from outside V2.3, from inside V2.1. Is it the up-to-date version?

Concerning my question. Using modules, has its price both in SW and HW. In SW, parameters are passed, stack space used and the execution is slowed down when compared to the "inline" implementation. In HW, instead of using hierarchical design, I can also include the body of the sub-modules, which may result in hard-to understand, inflexible but more effective designs, say using direct wiring rather than using ports, I guess. BTW, during synthesis, "inline" has any effect?



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...