diff options
author | Gabe Black <gabeblack@google.com> | 2018-07-03 16:41:30 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-05 06:03:24 +0000 |
commit | 0aec777bf2fff0ac61cd36b7c0358dbe9350c784 (patch) | |
tree | 2af532c4eaa5c79ce2aadfa40da8f14c4dbf3f29 /src/systemc/core/process.hh | |
parent | 4bd389c9d0370d67464c2a508381abe326de3bdf (diff) | |
download | gem5-0aec777bf2fff0ac61cd36b7c0358dbe9350c784.tar.xz |
systemc: Partially implement the scheduler.
This change implements the "evaluate" part of the delta cycles, and
sketches out a function to run delta cycles and the initialization
phase. The kernel object now schedules an event at time zero which
runs the initialization phase.
Also, some small places which were stubbed out pending a way to check
the currently running process have been filled in now that that's
being tracked.
Change-Id: I6899569eb0195ff1c059fa4e68e90ef162b2f2df
Reviewed-on: https://gem5-review.googlesource.com/11709
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/process.hh')
-rw-r--r-- | src/systemc/core/process.hh | 74 |
1 files changed, 19 insertions, 55 deletions
diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh index 07ef97c5e..bb9a9c60c 100644 --- a/src/systemc/core/process.hh +++ b/src/systemc/core/process.hh @@ -33,6 +33,7 @@ #include <functional> #include "base/fiber.hh" +#include "systemc/core/list.hh" #include "systemc/core/object.hh" #include "systemc/ext/core/sc_event.hh" #include "systemc/ext/core/sc_module.hh" @@ -41,10 +42,11 @@ namespace sc_gem5 { -class Process : public ::sc_core::sc_object +class Process : public ::sc_core::sc_object, public ListNode { public: virtual ::sc_core::sc_curr_proc_kind procKind() const = 0; + bool running() const { return _running; } bool dynamic() const { return _dynamic; } bool isUnwinding() const { return _isUnwinding; } bool terminated() const { return _terminated; } @@ -75,12 +77,21 @@ class Process : public ::sc_core::sc_object const ::sc_core::sc_event &resetEvent() { return _resetEvent; } const ::sc_core::sc_event &terminatedEvent() { return _terminatedEvent; } + // This should only be called before initialization. + void dontInitialize() { popListNode(); } + + void setStackSize(size_t size) { stackSize = size; } + + void run(); + + virtual Fiber *fiber() { return Fiber::primaryFiber(); } + + static Process *newest() { return _newest; } + protected: - Process(const char *name, ProcessFuncWrapper *func, bool _dynamic) : - ::sc_core::sc_object(name), func(func), _dynamic(_dynamic), - _isUnwinding(false), _terminated(false), _suspended(false), - _disabled(false), _syncReset(false), refCount(0) - {} + Process(const char *name, ProcessFuncWrapper *func, bool _dynamic); + + static Process *_newest; virtual ~Process() { delete func; } @@ -89,6 +100,7 @@ class Process : public ::sc_core::sc_object ProcessFuncWrapper *func; sc_core::sc_curr_proc_kind _procKind; + bool _running; bool _dynamic; bool _isUnwinding; bool _terminated; @@ -99,56 +111,8 @@ class Process : public ::sc_core::sc_object bool _syncReset; int refCount; -}; - -class Method : public Process -{ - public: - Method(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) : - Process(name, func, _dynamic) - {} - - const char *kind() const override { return "sc_method_process"; } - - sc_core::sc_curr_proc_kind - procKind() const override - { - return sc_core::SC_METHOD_PROC_; - } -}; - -class Thread : public Process -{ - public: - Thread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) : - Process(name, func, _dynamic) - {} - - const char *kind() const override { return "sc_thread_process"; } - - void throw_it(ExceptionWrapperBase &exc, bool inc_kids) override; - - sc_core::sc_curr_proc_kind - procKind() const override - { - return sc_core::SC_THREAD_PROC_; - } -}; - -class CThread : public Thread -{ - public: - CThread(const char *name, ProcessFuncWrapper *func, bool _dynamic=false) : - Thread(name, func, _dynamic) - {} - - const char *kind() const override { return "sc_cthread_process"; } - sc_core::sc_curr_proc_kind - procKind() const override - { - return sc_core::SC_CTHREAD_PROC_; - } + size_t stackSize; }; } // namespace sc_gem5 |