summaryrefslogtreecommitdiff
path: root/src/systemc/core/process.hh
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-26 03:20:09 -0700
committerGabe Black <gabeblack@google.com>2018-10-16 00:35:50 +0000
commit0cfce458003c377878aad3b15cf5fa2860a5f8e7 (patch)
treef99966a70759fde8d40b8a2e95939a4f7c3b2412 /src/systemc/core/process.hh
parentf4ab64a588771391c2eebd9b1c8b089aa33cda67 (diff)
downloadgem5-0cfce458003c377878aad3b15cf5fa2860a5f8e7.tar.xz
systemc: Implement signal based resets.
The implementation is based on sc_event sensitivities. Also of note is that the way reset works in the Accellera implementation isn't consistent with the spec. That says that wait(int n) is supposed to be equivalent to calling wait() n times, assuming n is greater than 0. Instead, Accellera stores that count and then doesn't wake up the process until the count is 0, decrementing it otherwise. That means that when the process is in reset, it won't actually reset for those intermediate wait()s which it would if wait() was called repeatedly. Also, oddly, when a reset becomes asserted, it will clear the count to 0 explicitly. That may have been an attempt to make the behavior of wait(int n) match the spec, but it doesn't handle cases where the reset is already set when wait(int n) is called. Change-Id: I92f8e9a128e6618af94dc048ce570a4436e17e4b Reviewed-on: https://gem5-review.googlesource.com/c/13186 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.hh13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/systemc/core/process.hh b/src/systemc/core/process.hh
index 9e85fc7cc..85a7a27a8 100644
--- a/src/systemc/core/process.hh
+++ b/src/systemc/core/process.hh
@@ -87,6 +87,8 @@ class Process : public ::sc_core::sc_process_b, public ListNode
void syncResetOn(bool inc_kids);
void syncResetOff(bool inc_kids);
+ void signalReset(bool set, bool sync);
+
void incref() { refCount++; }
void decref() { refCount--; }
@@ -100,6 +102,7 @@ class Process : public ::sc_core::sc_process_b, public ListNode
void addStatic(StaticSensitivity *);
void setDynamic(DynamicSensitivity *);
void clearDynamic() { setDynamic(nullptr); }
+ void addReset(ResetSensitivity *);
ScEvent timeoutEvent;
void setTimeout(::sc_core::sc_time t);
@@ -119,13 +122,15 @@ class Process : public ::sc_core::sc_process_b, public ListNode
bool hasStaticSensitivities() { return !staticSensitivities.empty(); }
bool internal() { return _internal; }
bool timedOut() { return _timedOut; }
- bool syncReset() { return _syncReset; }
+ bool inReset() { return _syncReset || syncResetCount || asyncResetCount; }
bool dontInitialize() { return _dontInitialize; }
void dontInitialize(bool di) { _dontInitialize = di; }
void joinWait(::sc_core::sc_join *join) { joinWaiters.push_back(join); }
+ void waitCount(int count) { _waitCount = count; }
+
protected:
void timeout();
@@ -170,12 +175,18 @@ class Process : public ::sc_core::sc_process_b, public ListNode
bool _syncReset;
+ int syncResetCount;
+ int asyncResetCount;
+
+ int _waitCount;
+
int refCount;
size_t stackSize;
StaticSensitivities staticSensitivities;
DynamicSensitivity *dynamicSensitivity;
+ ResetSensitivities resetSensitivities;
std::unique_ptr<::sc_core::sc_report> _lastReport;