systemc: Fix some issues with starvation checks.

Make sure we check for starvation after timed notifications and at the
very end of delta cycles (after delta notifications, not before). Also
reverse the order of starvation checks (whether they apply at all, then
if they're satisfied) to make those checks faster. Checking a bool
is a lot easier than checking if a bunch of other structures are
empty.

Change-Id: I514ff219909823f1f424fde69856d6b510655188
Reviewed-on: https://gem5-review.googlesource.com/12268
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
This commit is contained in:
Gabe Black
2018-08-26 15:34:31 -07:00
parent 1712dd596b
commit 9b6119a6a3
2 changed files with 7 additions and 5 deletions

View File

@@ -124,7 +124,7 @@ Scheduler::initPhase()
eventsToSchedule.clear();
if (_started) {
if (starved() && !runToTime)
if (!runToTime && starved())
scheduleStarvationEvent();
kernel->status(::sc_core::SC_RUNNING);
}
@@ -244,14 +244,14 @@ Scheduler::runReady()
// The update phase.
update();
if (starved() && !runToTime)
scheduleStarvationEvent();
// The delta phase.
for (auto &e: deltas)
e->run();
deltas.clear();
if (!runToTime && starved())
scheduleStarvationEvent();
if (runOnce)
schedulePause();
}
@@ -303,7 +303,7 @@ Scheduler::start(Tick max_tick, bool run_to_time)
maxTick = max_tick;
if (initDone) {
if (starved() && !runToTime)
if (!runToTime && starved())
scheduleStarvationEvent();
kernel->status(::sc_core::SC_RUNNING);
}

View File

@@ -266,6 +266,8 @@ class Scheduler
{
assert(ts == timeSlots.begin()->second);
timeSlots.erase(timeSlots.begin());
if (!runToTime && starved())
scheduleStarvationEvent();
}
// Pending activity ignores gem5 activity, much like how a systemc