Question

I would like to report what the time is at the end of a simulation. I thought that I would use the end_of_simulation routine, and just do a sc_timestamp in the routine to do this.

The problem is that the kernel has terminated before end_of_simulation, and I get a bogus timestamp.

I can't really use a thread to determine this because what pulls me out of the simulation is that all of the threads are waiting on events. There is no "master thread" that I could just store the timestamp.

any thoughts?

Was it helpful?

Solution

This seems a little hackish but you could update a global time variable with sc_time_stamp() at key points in your code that might be the end of a sim, like before waits or before you return from a time consuming function? Then after returning from sc_start() you would have the last time value from the code you care about.

OTHER TIPS

You could use something like:

cout << "Start of simulation is " << sc_time_stamp() << endl;
sc_start (); // sc_start (-1);
cout << "End of simulation is " << sc_time_stamp() << endl;

Hope it helps.

I'm not sure if I understand your question.

For the simulation to run is necessary to stipulate the time that it must take in total. sc_start(total_time, SC_NS).

total_time is the final time of simulation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top