summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sim/simulate.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/sim/simulate.cc b/src/sim/simulate.cc
index 5e69f0ff4..238e68787 100644
--- a/src/sim/simulate.cc
+++ b/src/sim/simulate.cc
@@ -49,12 +49,10 @@ simulate(Tick num_cycles)
{
inform("Entering event queue @ %d. Starting simulation...\n", curTick());
- 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
+ if (num_cycles < MaxTick - curTick())
num_cycles = curTick() + num_cycles;
+ else // counter would roll over or be set to MaxTick anyhow
+ num_cycles = MaxTick;
Event *limit_event =
new SimLoopExitEvent("simulate() limit reached", 0);