summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-08-26 15:34:31 -0700
committerGabe Black <gabeblack@google.com>2018-09-26 00:02:52 +0000
commit9b6119a6a31f8597eebdc8bb469fd9f407ffa5e4 (patch)
treec23a05e787a4195f832577eefb8f968b1efdfe3c /src
parent1712dd596bb70ab12a0f07737b496107f91a06c5 (diff)
downloadgem5-9b6119a6a31f8597eebdc8bb469fd9f407ffa5e4.tar.xz
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>
Diffstat (limited to 'src')
-rw-r--r--src/systemc/core/scheduler.cc10
-rw-r--r--src/systemc/core/scheduler.hh2
2 files changed, 7 insertions, 5 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index c84aa9a46..46053b40f 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -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);
}
diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh
index 3068a0aaa..ff8434bef 100644
--- a/src/systemc/core/scheduler.hh
+++ b/src/systemc/core/scheduler.hh
@@ -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