Reputation: 483
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?
Upvotes: 2
Views: 6318
Reputation: 11
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.
Upvotes: 1
Reputation: 2660
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.
Upvotes: 0
Reputation: 126
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.
Upvotes: 0