Question

When I hit a breakpoint in a VLAB script, how can I find out if I have caused elaboration to finish or not, yet?

My script reaches a statement that raises an error:

Error: (E529) insert module failed: elaboration done

(The command that causes this is vlab.instantiate("stim", "stim"))

So obviously elaboration was unexpectedly (for me) already completed. I need to somehow go back in the process and find out where that happened - so I need some way of asking "is elaboration complete?" at the point where I set breakpoints earlier in the script.

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top