summaryrefslogtreecommitdiff
path: root/src/sim/main.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim/main.cc')
-rw-r--r--src/sim/main.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/sim/main.cc b/src/sim/main.cc
index 133141e57..5b44102a8 100644
--- a/src/sim/main.cc
+++ b/src/sim/main.cc
@@ -309,18 +309,14 @@ finalInit()
* @return The SimLoopExitEvent that caused the loop to exit.
*/
SimLoopExitEvent *
-simulate(Tick num_cycles = -1)
+simulate(Tick num_cycles = MaxTick)
{
warn("Entering event queue @ %d. Starting simulation...\n", curTick);
- // Fix up num_cycles. Special default value -1 means simulate
- // "forever"... schedule event at MaxTick just to be safe.
- // Otherwise it's a delta for additional cycles to simulate past
- // curTick, and thus must be non-negative.
- if (num_cycles == -1)
- num_cycles = MaxTick;
- else if (num_cycles < 0)
+ if (num_cycles < 0)
fatal("simulate: num_cycles must be >= 0 (was %d)\n", num_cycles);
+ else if (curTick + num_cycles < 0) //Overflow
+ num_cycles = MaxTick;
else
num_cycles = curTick + num_cycles;