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

Change subject: systemc: Don't schedule the ready event unnecessarily.
......................................................................

systemc: Don't schedule the ready event unnecessarily.

If we're already going to process the thing we'd be scheduling it to
process, just let the existing invocation get to it.

Change-Id: Ifeebc80903065567fc0eed02beefec6156b22ff7
---
M src/systemc/core/scheduler.cc
M src/systemc/core/scheduler.hh
2 files changed, 13 insertions(+), 6 deletions(-)



diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index 9deb077..ae1aa89 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -193,7 +193,8 @@
     else
         readyListThreads.pushLast(p);

-    scheduleReadyEvent();
+    if (!inEvaluate())
+        scheduleReadyEvent();
 }

 void
@@ -234,7 +235,8 @@
 Scheduler::requestUpdate(Channel *c)
 {
     updateList.pushLast(c);
-    scheduleReadyEvent();
+    if (!inEvaluate())
+        scheduleReadyEvent();
 }

 void
@@ -274,8 +276,10 @@
         _changeStamp++;
     }

-    if (_stopNow)
+    if (_stopNow) {
+        status(StatusOther);
         return;
+    }

     runUpdate();
     runDelta();
diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh
index ad1467e..8015260 100644
--- a/src/systemc/core/scheduler.hh
+++ b/src/systemc/core/scheduler.hh
@@ -231,7 +231,8 @@
         // Delta notification/timeout.
         if (delay.value() == 0) {
             event->schedule(deltas, tick);
-            scheduleReadyEvent();
+            if (!inEvaluate() && !inUpdate())
+                scheduleReadyEvent();
             return;
         }

@@ -331,8 +332,9 @@
     enum Status
     {
         StatusOther = 0,
-        StatusDelta,
+        StatusEvaluate,
         StatusUpdate,
+        StatusDelta,
         StatusTiming,
         StatusPaused,
         StatusStopped
@@ -343,8 +345,9 @@

     bool paused() { return status() == StatusPaused; }
     bool stopped() { return status() == StatusStopped; }
-    bool inDelta() { return status() == StatusDelta; }
+    bool inEvaluate() { return status() == StatusEvaluate; }
     bool inUpdate() { return status() == StatusUpdate; }
+    bool inDelta() { return status() == StatusDelta; }
     bool inTiming() { return status() == StatusTiming; }

     uint64_t changeStamp() { return _changeStamp; }

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12964
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: Ifeebc80903065567fc0eed02beefec6156b22ff7
Gerrit-Change-Number: 12964
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