summaryrefslogtreecommitdiff
path: root/src/systemc/core/kernel.cc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-11-07 00:00:29 -0800
committerGabe Black <gabeblack@google.com>2018-11-09 01:26:17 +0000
commit6dd72cf55cf1c0b8d0772585ca25ed75a81e3d47 (patch)
tree2e221f9dd0e744ef82632575985a3c9997e50ca3 /src/systemc/core/kernel.cc
parent296402abdfac1bcab998cb8613d14e65e671ddda (diff)
downloadgem5-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/kernel.cc')
-rw-r--r--src/systemc/core/kernel.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/systemc/core/kernel.cc b/src/systemc/core/kernel.cc
index 11292c4a5..2fd3027da 100644
--- a/src/systemc/core/kernel.cc
+++ b/src/systemc/core/kernel.cc
@@ -33,6 +33,7 @@
#include "systemc/core/channel.hh"
#include "systemc/core/module.hh"
#include "systemc/core/port.hh"
+#include "systemc/core/sc_main_fiber.hh"
#include "systemc/core/scheduler.hh"
namespace sc_gem5
@@ -41,7 +42,6 @@ namespace sc_gem5
namespace
{
-bool scMainDone = false;
bool stopAfterCallbacks = false;
bool startComplete = false;
bool endComplete = false;
@@ -53,9 +53,6 @@ sc_core::sc_status _status = sc_core::SC_ELABORATION;
bool Kernel::startOfSimulationComplete() { return startComplete; }
bool Kernel::endOfSimulationComplete() { return endComplete; }
-bool Kernel::scMainFinished() { return scMainDone; }
-void Kernel::scMainFinished(bool finished) { scMainDone = finished; }
-
sc_core::sc_status Kernel::status() { return _status; }
void Kernel::status(sc_core::sc_status s) { _status = s; }
@@ -69,7 +66,7 @@ Kernel::Kernel(Params *params) :
void
Kernel::init()
{
- if (scMainDone)
+ if (scMainFiber.finished())
return;
if (stopAfterCallbacks)
@@ -89,7 +86,7 @@ Kernel::init()
void
Kernel::regStats()
{
- if (scMainDone || stopAfterCallbacks)
+ if (scMainFiber.finished() || stopAfterCallbacks)
return;
try {
@@ -113,7 +110,7 @@ Kernel::regStats()
void
Kernel::startup()
{
- if (scMainDone)
+ if (scMainFiber.finished())
return;
schedule(t0Event, curTick());