sim: Update limit_event reuse to final version
Matching final version on reviewboard.
This commit is contained in:
parent
a196dbe3bf
commit
a1164154de
3 changed files with 6 additions and 14 deletions
|
@ -71,11 +71,6 @@ class GlobalSimLoopExitEvent : public GlobalEvent
|
||||||
void process(); // process event
|
void process(); // process event
|
||||||
|
|
||||||
virtual const char *description() const;
|
virtual const char *description() const;
|
||||||
|
|
||||||
virtual ~GlobalSimLoopExitEvent() {
|
|
||||||
// simulate()'s singleton GlobalSimLoopExitEvent is always scheduled
|
|
||||||
deschedule();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LocalSimLoopExitEvent : public Event
|
class LocalSimLoopExitEvent : public Event
|
||||||
|
|
|
@ -71,13 +71,7 @@ thread_loop(EventQueue *queue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GlobalEvent*
|
GlobalSimLoopExitEvent *simulate_limit_event = nullptr;
|
||||||
getLimitEvent(void) {
|
|
||||||
static GlobalSimLoopExitEvent
|
|
||||||
simulate_limit_event(mainEventQueue[0]->getCurTick(),
|
|
||||||
"simulate() limit reached", 0);
|
|
||||||
return &simulate_limit_event;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Simulate for num_cycles additional cycles. If num_cycles is -1
|
/** Simulate for num_cycles additional cycles. If num_cycles is -1
|
||||||
* (the default), do not limit simulation; some other event must
|
* (the default), do not limit simulation; some other event must
|
||||||
|
@ -104,6 +98,9 @@ simulate(Tick num_cycles)
|
||||||
}
|
}
|
||||||
|
|
||||||
threads_initialized = true;
|
threads_initialized = true;
|
||||||
|
simulate_limit_event =
|
||||||
|
new GlobalSimLoopExitEvent(mainEventQueue[0]->getCurTick(),
|
||||||
|
"simulate() limit reached", 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
inform("Entering event queue @ %d. Starting simulation...\n", curTick());
|
inform("Entering event queue @ %d. Starting simulation...\n", curTick());
|
||||||
|
@ -113,7 +110,7 @@ simulate(Tick num_cycles)
|
||||||
else // counter would roll over or be set to MaxTick anyhow
|
else // counter would roll over or be set to MaxTick anyhow
|
||||||
num_cycles = MaxTick;
|
num_cycles = MaxTick;
|
||||||
|
|
||||||
getLimitEvent()->reschedule(num_cycles);
|
simulate_limit_event->reschedule(num_cycles);
|
||||||
|
|
||||||
GlobalSyncEvent *quantum_event = NULL;
|
GlobalSyncEvent *quantum_event = NULL;
|
||||||
if (numMainEventQueues > 1) {
|
if (numMainEventQueues > 1) {
|
||||||
|
|
|
@ -33,4 +33,4 @@
|
||||||
#include "sim/sim_events.hh"
|
#include "sim/sim_events.hh"
|
||||||
|
|
||||||
GlobalSimLoopExitEvent *simulate(Tick num_cycles = MaxTick);
|
GlobalSimLoopExitEvent *simulate(Tick num_cycles = MaxTick);
|
||||||
GlobalEvent* getLimitEvent();
|
extern GlobalSimLoopExitEvent *simulate_limit_event;
|
||||||
|
|
Loading…
Reference in a new issue