From 9b6119a6a31f8597eebdc8bb469fd9f407ffa5e4 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sun, 26 Aug 2018 15:34:31 -0700 Subject: 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 Maintainer: Gabe Black --- src/systemc/core/scheduler.cc | 10 +++++----- src/systemc/core/scheduler.hh | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'src') 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 -- cgit v1.2.3