diff options
author | Gabe Black <gabeblack@google.com> | 2018-08-16 20:59:29 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-25 23:51:06 +0000 |
commit | dd30c7ef763e01e52db5d6a9f9b0c9309fab9d4f (patch) | |
tree | 85304f719e05c83eae91fc2c6e4699349da71bd1 /src/systemc/core/scheduler.cc | |
parent | 0150b6fc88abd38bc8f485b0bb47a6a4ef7d3373 (diff) | |
download | gem5-dd30c7ef763e01e52db5d6a9f9b0c9309fab9d4f.tar.xz |
systemc: Rework the init phase for the new way delta notes are handled.
The initialization phase had been done in a somewhat adhoc way,
partially because delta notifications were being handled as top level
gem5 events which were ordered based on their priorities. This change
makes the initialization phase happen more explicitly, and more in the
order in the spec.
Change-Id: I91d56b63fefcb81c845c52c97826a976a7559fad
Reviewed-on: https://gem5-review.googlesource.com/12217
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 | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index ceaa5f474..77015dd46 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -46,12 +46,12 @@ 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), initDone(false), runOnce(false) {} void -Scheduler::prepareForInit() +Scheduler::initPhase() { for (Process *p = toFinalize.getNext(); p; p = toFinalize.getNext()) { p->finalize(); @@ -64,6 +64,12 @@ Scheduler::prepareForInit() p->ready(); } + update(); + + for (auto &e: deltas) + e->run(); + deltas.clear(); + for (auto ets: eventsToSchedule) eq->schedule(ets.first, ets.second); eventsToSchedule.clear(); @@ -71,13 +77,13 @@ Scheduler::prepareForInit() if (_started) eq->schedule(&maxTickEvent, maxTick); - initReady = true; + initDone = true; } void Scheduler::reg(Process *p) { - if (initReady) { + if (initDone) { // If we're past initialization, finalize static sensitivity. p->finalize(); // Mark the process as ready. @@ -92,7 +98,7 @@ Scheduler::reg(Process *p) void Scheduler::dontInitialize(Process *p) { - if (initReady) { + if (initDone) { // Pop this process off of the ready list. p->popListNode(); } else { @@ -246,7 +252,7 @@ Scheduler::start(Tick max_tick, bool run_to_time) if (starved() && !runToTime) return; - if (initReady) { + if (initDone) { kernel->status(::sc_core::SC_RUNNING); eq->schedule(&maxTickEvent, maxTick); } |