summaryrefslogtreecommitdiff
path: root/src/systemc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-01 18:27:02 -0700
committerGabe Black <gabeblack@google.com>2018-10-03 00:50:23 +0000
commit026b3f909e6eb180f1fffb1a1c05317224f1ca29 (patch)
tree7253a36da197b6f6851f6844dd8e1015c9903982 /src/systemc
parent62a63151e58d6d51651af82fd7e7b9ba2de570e9 (diff)
downloadgem5-026b3f909e6eb180f1fffb1a1c05317224f1ca29.tar.xz
systemc: When stopping immediately, block new processes/updates.
When stopping immediately, we're supposed to finish the current process but not run any other processes or go to the update phase. The rest of the process could introduce new processes or request new updates, so we need to make sure we block those if we're in the process of stopping. Change-Id: I9cc867d294cf171dfedb4b9d43fbc167c2057de8 Reviewed-on: https://gem5-review.googlesource.com/c/12466 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc')
-rw-r--r--src/systemc/core/scheduler.cc9
-rw-r--r--src/systemc/core/scheduler.hh1
2 files changed, 9 insertions, 1 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index eda4ed7e4..cf34fe8b7 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -44,7 +44,7 @@ Scheduler::Scheduler() :
stopEvent(this, false, StopPriority),
scMain(nullptr),
starvationEvent(this, false, StarvationPriority),
- _started(false), _paused(false), _stopped(false),
+ _started(false), _paused(false), _stopped(false), _stopNow(false),
maxTickEvent(this, false, MaxTickPriority),
_numCycles(0), _changeStamp(0), _current(nullptr), initDone(false),
runOnce(false)
@@ -189,6 +189,9 @@ Scheduler::yield()
void
Scheduler::ready(Process *p)
{
+ if (_stopNow)
+ return;
+
// Clump methods together to minimize context switching.
static bool cluster_methods = false;
@@ -277,6 +280,9 @@ Scheduler::runReady()
_changeStamp++;
}
+ if (_stopNow)
+ return;
+
// The update phase.
update();
@@ -383,6 +389,7 @@ Scheduler::scheduleStop(bool finish_delta)
return;
if (!finish_delta) {
+ _stopNow = true;
// If we're not supposed to finish the delta cycle, flush all
// pending activity.
clear();
diff --git a/src/systemc/core/scheduler.hh b/src/systemc/core/scheduler.hh
index 924cfb29e..f0cbac43c 100644
--- a/src/systemc/core/scheduler.hh
+++ b/src/systemc/core/scheduler.hh
@@ -386,6 +386,7 @@ class Scheduler
bool _started;
bool _paused;
bool _stopped;
+ bool _stopNow;
Tick maxTick;
Tick lastReadyTick;