void
sc_start(const sc_time &time, sc_starvation_policy p)
{
- Tick now = ::sc_gem5::scheduler.getCurTick();
- ::sc_gem5::scheduler.start(now + time.value(), p == SC_RUN_TO_TIME);
+ if (time.value() == 0) {
+ ::sc_gem5::scheduler.oneCycle();
+ } else {
+ Tick now = ::sc_gem5::scheduler.getCurTick();
+ ::sc_gem5::scheduler.start(now + time.value(), p == SC_RUN_TO_TIME);
+ }
}
void
starvationEvent(this, false, StarvationPriority),
_started(false), _paused(false), _stopped(false),
maxTickEvent(this, false, MaxTickPriority),
- _numCycles(0), _current(nullptr), initReady(false)
+ _numCycles(0), _current(nullptr), initReady(false),
+ runOnce(false)
{}
void
scheduleStarvationEvent();
// The delta phase will happen naturally through the event queue.
+
+ if (runOnce) {
+ eq->reschedule(&maxTickEvent, eq->getCurTick());
+ runOnce = false;
+ }
}
void
{
_paused = true;
kernel->status(::sc_core::SC_PAUSED);
+ runOnce = false;
scMain->run();
// If the ready event is supposed to run now, run it inline so that it
{
_stopped = true;
kernel->stop();
+ runOnce = false;
scMain->run();
}
eq->deschedule(&starvationEvent);
}
+void
+Scheduler::oneCycle()
+{
+ runOnce = true;
+ start(::MaxTick, false);
+}
+
void
Scheduler::schedulePause()
{
void setScMainFiber(Fiber *sc_main) { scMain = sc_main; }
void start(Tick max_tick, bool run_to_time);
+ void oneCycle();
void schedulePause();
void scheduleStop(bool finish_delta);
bool initReady;
bool runToTime;
+ bool runOnce;
ProcessList initList;
ProcessList toFinalize;