SystemC provides the following function to query the current phase of elaboration or simulation.
sc_status sc_get_status();
It returns either SC_ELABORATION
, SC_BEFORE_END_OF_ELABORATION
, SC_END_OF_ELABORATION
, SC_START_OF_SIMULATION
, SC_RUNNING
, SC_PAUSED
, SC_STOPPED
, or SC_END_OF_SIMULATION
.
See section 4.5.8 in the SystemC Language Reference Manual for more details. Note that this function was only added in the most recent version of the standard, IEEE Standard 1666-2011.
In VLAB, the SystemC API is available from the sysc
Python package, so the following script can be used to test if the current phase is at elaboration:
import sysc
print "Is elaboration phase:", sysc.sc_get_status() == sysc.SC_ELABORATION