Open dtesch opened 5 years ago
Hi, I delayed any modification of the code until now, because the default 1ns scenario worked fine. you were correct for the first two suggestions, which have been applied in the latest version to support different clock_period_ps.
The last two are not correct, since the subtraction is done between clock cycles, and reset_time and simulation_time, despite their names, are expressed in clock cycles.
If you are still reading here, thank you very much and sorry for the late reply.
Dear Davide,
When the clock period is different from 1ns, the simulation time is computed incorrectly.
I made the following changes in the Main.cpp to to work around the issue:
- sc_start(GlobalParams::reset_time, SC_NS);
+ sc_start(GlobalParams::reset_time * GlobalParams::clock_period_ps, SC_PS);
- sc_start(GlobalParams::simulation_time, SC_NS);
+ sc_start(GlobalParams::simulation_time * GlobalParams::clock_period_ps, SC_PS);
- (sc_time_stamp().to_double() / GlobalParams::clock_period_ps - GlobalParams::reset_time >= GlobalParams::simulation_time)) {
+ (sc_time_stamp().to_double() / GlobalParams::clock_period_ps - GlobalParams::reset_time * GlobalParams::clock_period_ps >= GlobalParams::simulation_time * GlobalParams::clock_period_ps)) {
Is this correct?
Thank you!