diff options
author | Gabe Black <gabeblack@google.com> | 2018-08-17 17:48:56 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-25 23:52:00 +0000 |
commit | e752df70150b1af370944eedfc514fea816c0b1e (patch) | |
tree | 4708ce70a91a15f0d4f0f9efd49ab3a1c713a408 /src/systemc/core/scheduler.cc | |
parent | a56dbe9338272273ac576514685e1c01ded173a2 (diff) | |
download | gem5-e752df70150b1af370944eedfc514fea816c0b1e.tar.xz |
systemc: Generalize gem5 style event scheduling.
These events are either scheduled directly, or if no event queue is
yet available they're recorded in a map to schedule later. Since this
was used in a few places (and should have been used for the ready
event), this change moves it into some common functions which remove
some duplication and abstract away this detail.
Change-Id: I4320d7296f4f72344539b2b4b2564a6a27576dd8
Reviewed-on: https://gem5-review.googlesource.com/12219
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 | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index e18855c4d..cdebd9986 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -77,7 +77,7 @@ Scheduler::initPhase() if (_started) { if (starved() && !runToTime) scheduleStarvationEvent(); - eq->schedule(&maxTickEvent, maxTick); + kernel->status(::sc_core::SC_RUNNING); } initDone = true; @@ -153,8 +153,7 @@ void Scheduler::requestUpdate(Channel *c) { updateList.pushLast(c); - if (eq) - scheduleReadyEvent(); + scheduleReadyEvent(); } void @@ -162,10 +161,9 @@ Scheduler::scheduleReadyEvent() { // Schedule the evaluate and update phases. if (!readyEvent.scheduled()) { - panic_if(!eq, "Need to schedule ready, but no event manager.\n"); - eq->schedule(&readyEvent, eq->getCurTick()); + schedule(&readyEvent); if (starvationEvent.scheduled()) - eq->deschedule(&starvationEvent); + deschedule(&starvationEvent); } } @@ -173,13 +171,9 @@ void Scheduler::scheduleStarvationEvent() { if (!starvationEvent.scheduled()) { - Tick now = getCurTick(); - if (initDone) - eq->schedule(&starvationEvent, now); - else - eventsToSchedule[&starvationEvent] = now; + schedule(&starvationEvent); if (readyEvent.scheduled()) - eq->deschedule(&readyEvent); + deschedule(&readyEvent); } } @@ -258,9 +252,10 @@ Scheduler::start(Tick max_tick, bool run_to_time) if (starved() && !runToTime) scheduleStarvationEvent(); kernel->status(::sc_core::SC_RUNNING); - eq->schedule(&maxTickEvent, maxTick); } + schedule(&maxTickEvent, maxTick); + // Return to gem5 to let it run events, etc. Fiber::primaryFiber()->run(); |