Jump to content

C++ class object bringing into systemC Hierarchy


Recommended Posts


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?




Link to comment
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.



Link to comment
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,

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