diff options
author | Gabe Black <gabeblack@google.com> | 2018-11-07 00:00:29 -0800 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-11-09 01:26:17 +0000 |
commit | 6dd72cf55cf1c0b8d0772585ca25ed75a81e3d47 (patch) | |
tree | 2e221f9dd0e744ef82632575985a3c9997e50ca3 /src/systemc/core/scheduler.cc | |
parent | 296402abdfac1bcab998cb8613d14e65e671ddda (diff) | |
download | gem5-6dd72cf55cf1c0b8d0772585ca25ed75a81e3d47.tar.xz |
systemc: Seperate out the sc_main fiber and its bookkeeping.
By pulling out the sc_main fiber (scMainFiber), we can make it
available to different entities in the simulator and avoid having to
have parallel bookkeeping.
Also this will make it possible to hook into sc_main without putting
the code in sc_main.cc.
Change-Id: I7689441424238e9b2e4d2b48e945dea35fd8cc5d
Reviewed-on: https://gem5-review.googlesource.com/c/13977
Reviewed-by: Jason Lowe-Power <jason@lowepower.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, 7 insertions, 11 deletions
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc index 5e96a47d5..a2e52f0ca 100644 --- a/src/systemc/core/scheduler.cc +++ b/src/systemc/core/scheduler.cc @@ -33,6 +33,7 @@ #include "base/logging.hh" #include "sim/eventq.hh" #include "systemc/core/kernel.hh" +#include "systemc/core/sc_main_fiber.hh" #include "systemc/ext/core/messages.hh" #include "systemc/ext/core/sc_main.hh" #include "systemc/ext/utils/sc_report.hh" @@ -46,8 +47,7 @@ namespace sc_gem5 Scheduler::Scheduler() : eq(nullptr), readyEvent(this, false, ReadyPriority), pauseEvent(this, false, PausePriority), - stopEvent(this, false, StopPriority), - scMain(nullptr), _throwToScMain(nullptr), + stopEvent(this, false, StopPriority), _throwToScMain(nullptr), starvationEvent(this, false, StarvationPriority), _elaborationDone(false), _started(false), _stopNow(false), _status(StatusOther), maxTickEvent(this, false, MaxTickPriority), @@ -349,8 +349,8 @@ Scheduler::pause() status(StatusPaused); kernel->status(::sc_core::SC_PAUSED); runOnce = false; - if (scMain && !scMain->finished()) - scMain->run(); + if (scMainFiber.called() && !scMainFiber.finished()) + scMainFiber.run(); } void @@ -362,17 +362,13 @@ Scheduler::stop() clear(); runOnce = false; - if (scMain && !scMain->finished()) - scMain->run(); + if (scMainFiber.called() && !scMainFiber.finished()) + scMainFiber.run(); } void Scheduler::start(Tick max_tick, bool run_to_time) { - // We should be running from sc_main. Keep track of that Fiber to return - // to later. - scMain = Fiber::currentFiber(); - _started = true; status(StatusOther); runToTime = run_to_time; @@ -431,7 +427,7 @@ Scheduler::throwToScMain() ::sc_core::sc_report report = reportifyException(); _throwToScMain = &report; status(StatusOther); - scMain->run(); + scMainFiber.run(); } void |