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?
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)
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With