diff options
author | Gabe Black <gabeblack@google.com> | 2018-08-16 14:42:24 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-20 01:51:29 +0000 |
commit | 7bfb7f3a43f382eb49853f47b140bfd6caad0fb8 (patch) | |
tree | 9f6dc20f5cafc65c6b4a0088c7d1b2a1f0051749 /src/systemc/core/scheduler.cc | |
parent | e1128dc8eb4afefcf4dad5eb5f863e0da921960a (diff) | |
download | gem5-7bfb7f3a43f382eb49853f47b140bfd6caad0fb8.tar.xz |
systemc: When sc_start is told to run zero time, do one delta cycle.
This is a special case which is mentioned in the spec but hadn't yet
been given any special handling in this implementation.
Change-Id: I500d046f09d916a08e22821f8d3e2f490f8ba5bb
Reviewed-on: https://gem5-review.googlesource.com/12212
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/scheduler.cc')
-rw-r--r-- | src/systemc/core/scheduler.cc | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index d2e87f25d..7e5272d0e 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -46,7 +46,8 @@ Scheduler::Scheduler() : starvationEvent(this, false, StarvationPriority), _started(false), _paused(false), _stopped(false), maxTickEvent(this, false, MaxTickPriority), - _numCycles(0), _current(nullptr), initReady(false) + _numCycles(0), _current(nullptr), initReady(false), + runOnce(false) {} void @@ -191,6 +192,11 @@ Scheduler::runReady() scheduleStarvationEvent(); // The delta phase will happen naturally through the event queue. + + if (runOnce) { + eq->reschedule(&maxTickEvent, eq->getCurTick()); + runOnce = false; + } } void @@ -209,6 +215,7 @@ Scheduler::pause() { _paused = true; kernel->status(::sc_core::SC_PAUSED); + runOnce = false; scMain->run(); // If the ready event is supposed to run now, run it inline so that it @@ -225,6 +232,7 @@ Scheduler::stop() { _stopped = true; kernel->stop(); + runOnce = false; scMain->run(); } @@ -264,6 +272,13 @@ Scheduler::start(Tick max_tick, bool run_to_time) } void +Scheduler::oneCycle() +{ + runOnce = true; + start(::MaxTick, false); +} + +void Scheduler::schedulePause() { if (pauseEvent.scheduled()) |