summaryrefslogtreecommitdiff
path: root/src/systemc/core/scheduler.hh
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-05 17:21:11 -0700
committerGabe Black <gabeblack@google.com>2018-10-09 21:36:50 +0000
commitcdda84fb5df278d083e02b3a7ab616b651e82f58 (patch)
tree2eb6c833f1695f607c26a9c6ed17cd771fa493c3 /src/systemc/core/scheduler.hh
parent930386c114eda9e0f57d407d2ef61740fd75fc88 (diff)
downloadgem5-cdda84fb5df278d083e02b3a7ab616b651e82f58.tar.xz
systemc: Match how Accellera schedules processes even more closely.
The Accellera implementation runs processes in a cycle where it first runs all the methods it has, then all the threads, and then starts again in case any new methods have been scheduled. This keeps methods and processes in the order they were marked ready (what a prior change made this scheduler do), but also keeps the methods together and the threads together (something it used to do, but that change made it stop doing). This change should make the gem5 scheduler match in both respects. Note that its correct to run the processes in whatever order we want, it's just that if we're going to compare against the "golden" output from the Accellera tests, we need to match the order to get sensible results. Change-Id: I0b1e4ed24c56f97921148b74e90c2dca5fd3fbc4 Reviewed-on: https://gem5-review.googlesource.com/c/12595 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/scheduler.hh')
-rw-r--r--src/systemc/core/scheduler.hh20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh
index f0cbac43c..29501bc24 100644
--- a/src/systemc/core/scheduler.hh
+++ b/src/systemc/core/scheduler.hh
@@ -197,11 +197,16 @@ class Scheduler
void
runNow(Process *p)
{
+ // This function may put a process on the wrong list, ie a method on
+ // the process list or vice versa. That's fine since that's just a
+ // performance optimization, and the important thing here is how the
+ // processes are ordered.
+
// If a process is running, schedule it/us to run again.
if (_current)
- readyList.pushFirst(_current);
+ readyList->pushFirst(_current);
// Schedule p to run first.
- readyList.pushFirst(p);
+ readyList->pushFirst(p);
yield();
}
@@ -290,7 +295,8 @@ class Scheduler
bool
pendingCurr()
{
- return !readyList.empty() || !updateList.empty() || !deltas.empty();
+ return !readyListMethods.empty() || !readyListThreads.empty() ||
+ !updateList.empty() || !deltas.empty();
}
// Return whether there are pending timed notifications or timeouts.
@@ -376,7 +382,8 @@ class Scheduler
bool
starved()
{
- return (readyList.empty() && updateList.empty() && deltas.empty() &&
+ return (readyListMethods.empty() && readyListThreads.empty() &&
+ updateList.empty() && deltas.empty() &&
(timeSlots.empty() || timeSlots.begin()->first > maxTick) &&
initList.empty());
}
@@ -410,7 +417,10 @@ class Scheduler
ProcessList initList;
ProcessList toFinalize;
- ProcessList readyList;
+
+ ProcessList *readyList;
+ ProcessList readyListMethods;
+ ProcessList readyListThreads;
ChannelList updateList;