diff options
author | Gabe Black <gabeblack@google.com> | 2018-07-16 16:14:33 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-05 06:06:00 +0000 |
commit | f2ab5e7a9e11783da3b9d7338775cf4b5fe2c29c (patch) | |
tree | c8b08f18270cb3131f37b6e0bfe1e8f2e94da63d /src/systemc/core/scheduler.cc | |
parent | d7755ec828868582e2b409ba14f1c8c920c7f184 (diff) | |
download | gem5-f2ab5e7a9e11783da3b9d7338775cf4b5fe2c29c.tar.xz |
systemc: Implement the sensitivity mechanism.
This change lets processes be sensitive to events, timeouts, etc.
Change-Id: If30a256dfa8a2e92192c1f9c96b48e2aa28ec27e
Reviewed-on: https://gem5-review.googlesource.com/11713
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 | 46 |
1 files changed, 42 insertions, 4 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 17e7dc43e..8ea090f57 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -38,14 +38,52 @@ namespace sc_gem5 Scheduler::Scheduler() : eq(nullptr), readyEvent(this, false, EventBase::Default_Pri + 1), - _numCycles(0), _current(nullptr) + _numCycles(0), _current(nullptr), initReady(false) {} void -Scheduler::initToReady() +Scheduler::prepareForInit() { - while (!initList.empty()) - ready(initList.getNext()); + for (Process *p = toFinalize.getNext(); p; p = toFinalize.getNext()) { + p->finalize(); + p->popListNode(); + } + + for (Process *p = initList.getNext(); p; p = initList.getNext()) { + p->finalize(); + ready(p); + } + + initReady = true; +} + +void +Scheduler::reg(Process *p) +{ + if (initReady) { + // If we're past initialization, finalize static sensitivity. + p->finalize(); + // Mark the process as ready. + ready(p); + } else { + // Otherwise, record that this process should be initialized once we + // get there. + initList.pushLast(p); + } +} + +void +Scheduler::dontInitialize(Process *p) +{ + if (initReady) { + // Pop this process off of the ready list. + p->popListNode(); + } else { + // Push this process onto the list of processes which still need + // their static sensitivity to be finalized. That implicitly pops it + // off the list of processes to be initialized/marked ready. + toFinalize.pushLast(p); + } } void |