if (_started) {
if (starved() && !runToTime)
scheduleStarvationEvent();
- eq->schedule(&maxTickEvent, maxTick);
+ kernel->status(::sc_core::SC_RUNNING);
}
initDone = true;
Scheduler::requestUpdate(Channel *c)
{
updateList.pushLast(c);
- if (eq)
- scheduleReadyEvent();
+ scheduleReadyEvent();
}
void
{
// Schedule the evaluate and update phases.
if (!readyEvent.scheduled()) {
- panic_if(!eq, "Need to schedule ready, but no event manager.\n");
- eq->schedule(&readyEvent, eq->getCurTick());
+ schedule(&readyEvent);
if (starvationEvent.scheduled())
- eq->deschedule(&starvationEvent);
+ deschedule(&starvationEvent);
}
}
Scheduler::scheduleStarvationEvent()
{
if (!starvationEvent.scheduled()) {
- Tick now = getCurTick();
- if (initDone)
- eq->schedule(&starvationEvent, now);
- else
- eventsToSchedule[&starvationEvent] = now;
+ schedule(&starvationEvent);
if (readyEvent.scheduled())
- eq->deschedule(&readyEvent);
+ deschedule(&readyEvent);
}
}
if (starved() && !runToTime)
scheduleStarvationEvent();
kernel->status(::sc_core::SC_RUNNING);
- eq->schedule(&maxTickEvent, maxTick);
}
+ schedule(&maxTickEvent, maxTick);
+
// Return to gem5 to let it run events, etc.
Fiber::primaryFiber()->run();
TimeSlot *&ts = timeSlots[tick];
if (!ts) {
ts = new TimeSlot;
- if (initDone)
- eq->schedule(ts, tick);
- else
- eventsToSchedule[ts] = tick;
+ schedule(ts, tick);
}
ts->events.insert(event);
}
// If no more events are happening at this time slot, get rid of it.
if (events.empty()) {
- if (initDone)
- eq->deschedule(ts);
- else
- eventsToSchedule.erase(ts);
+ deschedule(ts);
timeSlots.erase(tsit);
}
}
EventQueue *eq;
+ // For gem5 style events.
+ void
+ schedule(::Event *event, Tick tick)
+ {
+ if (initDone)
+ eq->schedule(event, tick);
+ else
+ eventsToSchedule[event] = tick;
+ }
+
+ void schedule(::Event *event) { schedule(event, getCurTick()); }
+
+ void
+ deschedule(::Event *event)
+ {
+ if (initDone)
+ eq->deschedule(event);
+ else
+ eventsToSchedule.erase(event);
+ }
+
ScEvents deltas;
TimeSlots timeSlots;