Jump to content
Aarthi

C++ class object bringing into systemC Hierarchy

Recommended Posts

Hello,

I need a help,  Its a huge implementation like having A, B, C systemC Modules and instantiated in the Top and sc_main have the Top hierarchy sc_module_name. In the systemC Module A, i have lot of pure C++ classes and instantiated so many times like some algorithm to do some computation. While debugging difficult to get the hierarchy which one is printing or tracing. 

I am looking for a solution, without changing the pure C++ classes to derive from sc_module, how do i make it a hierarchy to Top. Changing every where to have a constructor with sc_module_name will be little difficult as the code is huge. Is there any suggestion?

Regards

Aarthi

 

Share this post


Link to post
Share on other sites

Hi Aarthi,

if you just need to get the currently active module when hitting a breakpoint in you C++ code you might use the following command (assuming you use gdb):

x sc_core::sc_get_current_process_b()->get_parent()->name()

(see also here: https://stackoverflow.com/questions/18078226/how-to-get-sc-module-name-of-the-current-running-module#18123785)

What it does is it calles the SystemC kernel function sc_get_current_process_b() which returns a pointer to sc_process_b (the base class of of sc_method_process and sc_thread_process). Inheriting from sc_obejt it also has a name() method so you could also do

x sc_core::sc_get_current_process_b()->name()

which just returns the full hierarchical name of the process.

HTH

-Eyck

Share this post


Link to post
Share on other sites

Hi all,

16 hours ago, Eyck said:

x sc_core::sc_get_current_process_b()->get_parent()->name()

Both sc_get_current_process_b() and get_parent() are non-standard functions that may or may not be supported by (future) versions of your SystemC implementation.
I recommend to only use standard IEEE 1666-2011 APIs instead:

x sc_core::sc_get_current_process_handle().get_parent_object()->name()
x sc_core::sc_get_current_process_handle().name()

Greetings from Duisburg,
  Philipp

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

×