summaryrefslogtreecommitdiff
path: root/src/systemc
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-20 02:51:54 -0700
committerGabe Black <gabeblack@google.com>2018-10-16 00:25:15 +0000
commit1e17aca38ea0c9cdcc4445404bf8b789a360ce13 (patch)
treec83695e6569819bcfaa5ebeba2ebb7890c2ce9a9 /src/systemc
parent638293cd62fca2d3f133169083977fbbfcc989cc (diff)
downloadgem5-1e17aca38ea0c9cdcc4445404bf8b789a360ce13.tar.xz
systemc: Fix the implementation of sc_event::triggered.
This function just returned false. The new implementation uses the scheduler's changeStamp function to keep track of how recently the event was triggered so it can return return the right value. Change-Id: Idf61cd459e53e224a33d3e53c16210f5e0a99a3a Reviewed-on: https://gem5-review.googlesource.com/c/12825 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc')
-rw-r--r--src/systemc/core/event.cc6
-rw-r--r--src/systemc/core/event.hh2
2 files changed, 6 insertions, 2 deletions
diff --git a/src/systemc/core/event.cc b/src/systemc/core/event.cc
index e7132e083..4fb99e6d9 100644
--- a/src/systemc/core/event.cc
+++ b/src/systemc/core/event.cc
@@ -47,7 +47,7 @@ Event::Event(sc_core::sc_event *_sc_event) : Event(_sc_event, nullptr) {}
Event::Event(sc_core::sc_event *_sc_event, const char *_basename_cstr) :
_sc_event(_sc_event), _basename(_basename_cstr ? _basename_cstr : ""),
- delayedNotify([this]() { this->notify(); })
+ delayedNotify([this]() { this->notify(); }), _triggeredStamp(~0ULL)
{
Module *p = currentModule();
@@ -166,6 +166,8 @@ Event::notify()
if (delayedNotify.scheduled())
scheduler.deschedule(&delayedNotify);
+ _triggeredStamp = scheduler.changeStamp();
+
notify(staticSenseMethod);
notify(dynamicSenseMethod);
notify(staticSenseThread);
@@ -194,7 +196,7 @@ Event::cancel()
bool
Event::triggered() const
{
- return false;
+ return _triggeredStamp == scheduler.changeStamp();
}
Events topLevelEvents;
diff --git a/src/systemc/core/event.hh b/src/systemc/core/event.hh
index 3d34fa6a0..2d620c91b 100644
--- a/src/systemc/core/event.hh
+++ b/src/systemc/core/event.hh
@@ -85,6 +85,7 @@ class Event
void cancel();
bool triggered() const;
+ uint64_t triggeredStamp() const { return _triggeredStamp; }
static Event *
getFromScEvent(sc_core::sc_event *e)
@@ -147,6 +148,7 @@ class Event
sc_core::sc_object *parent;
ScEvent delayedNotify;
+ mutable uint64_t _triggeredStamp;
mutable StaticSensitivities staticSenseMethod;
mutable StaticSensitivities staticSenseThread;