katang

How to implement parent-child relationship?

4 posts in this topic

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)?

 

Share this post


Link to post
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 3.3.3.4 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?

Regards,

Ameya Vikram Singh

Share this post


Link to post
Share on other sites

Hello @Ameya,

thanks for the hint. I found

https://github.com/systemc/systemc-2.3/blob/master/docs/LRM.pdf

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?

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now