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>
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user