Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get sc_module_name of the current running module

Tags:

c++

systemc

When I create an instance if sc_module I give it a string as a module name (sc_module_name).

How can I get the name of the module that is currently running?

like image 222
yonigo Avatar asked Aug 06 '13 10:08

yonigo


2 Answers

To get the name of the module that is currently running in systemc:

Use sc_get_current_process_b to get the currently executing process (SC thread or method). Then use get_parent to get its parent, which is going to be the module. Then use basename or name to get its name:

const char* name = sc_core::sc_get_current_process_b()->get_parent()->basename();

(omitted error handling for brevity)

like image 136
anatolyg Avatar answered Oct 03 '22 06:10

anatolyg


You can simply use name()

I used to use this to figure out which instance is doing what.

If that doesn't work it is because you need SC_HAS_PROCESS constructor instead of SC_CTOR

like image 30
Yash Jain Avatar answered Oct 03 '22 06:10

Yash Jain