Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12268

Change subject: systemc: Fix some issues with starvation checks.
......................................................................

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
---
M src/systemc/core/scheduler.cc
M src/systemc/core/scheduler.hh
2 files changed, 7 insertions(+), 5 deletions(-)



diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index c84aa9a..46053b4 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -124,7 +124,7 @@
     eventsToSchedule.clear();

     if (_started) {
-        if (starved() && !runToTime)
+        if (!runToTime && starved())
             scheduleStarvationEvent();
         kernel->status(::sc_core::SC_RUNNING);
     }
@@ -244,14 +244,14 @@
     // 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 @@
     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 3068a0a..ff8434b 100644
--- a/src/systemc/core/scheduler.hh
+++ b/src/systemc/core/scheduler.hh
@@ -266,6 +266,8 @@
     {
         assert(ts == timeSlots.begin()->second);
         timeSlots.erase(timeSlots.begin());
+        if (!runToTime && starved())
+            scheduleStarvationEvent();
     }

     // Pending activity ignores gem5 activity, much like how a systemc

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12268
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I514ff219909823f1f424fde69856d6b510655188
Gerrit-Change-Number: 12268
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to