return parent;
}
+void
+Event::notify(StaticSensitivities &senses)
+{
+ for (auto s: senses)
+ s->notify(this);
+}
+
+void
+Event::notify(DynamicSensitivities &senses)
+{
+ int size = senses.size();
+ int pos = 0;
+ while (pos < size) {
+ if (senses[pos]->notify(this))
+ senses[pos] = senses[--size];
+ else
+ pos++;
+ }
+ senses.resize(size);
+}
+
void
Event::notify()
{
if (delayedNotify.scheduled())
scheduler.deschedule(&delayedNotify);
- for (auto s: staticSensitivities)
- s->notify(this);
- DynamicSensitivities &ds = dynamicSensitivities;
- int size = ds.size();
- int pos = 0;
- while (pos < size) {
- if (ds[pos]->notify(this))
- ds[pos] = ds[--size];
- else
- pos++;
- }
- ds.resize(size);
+ notify(staticSenseMethod);
+ notify(dynamicSenseMethod);
+ notify(staticSenseThread);
+ notify(dynamicSenseThread);
}
void
bool inHierarchy() const;
sc_core::sc_object *getParentObject() const;
+ void notify(StaticSensitivities &senses);
+ void notify(DynamicSensitivities &senses);
+
void notify();
void notify(const sc_core::sc_time &t);
void
{
// Insert static sensitivities in reverse order to match Accellera's
// implementation.
- staticSensitivities.insert(staticSensitivities.begin(), s);
+ auto &senses = s->ofMethod() ? staticSenseMethod : staticSenseThread;
+ senses.insert(senses.begin(), s);
}
void
delSensitivity(StaticSensitivity *s) const
{
- for (auto &t: staticSensitivities) {
+ auto &senses = s->ofMethod() ? staticSenseMethod : staticSenseThread;
+ for (auto &t: senses) {
if (t == s) {
- t = staticSensitivities.back();
- staticSensitivities.pop_back();
+ t = senses.back();
+ senses.pop_back();
break;
}
}
void
addSensitivity(DynamicSensitivity *s) const
{
- dynamicSensitivities.push_back(s);
+ auto &senses = s->ofMethod() ? dynamicSenseMethod : dynamicSenseThread;
+ senses.push_back(s);
}
void
delSensitivity(DynamicSensitivity *s) const
{
- for (auto &t: dynamicSensitivities) {
+ auto &senses = s->ofMethod() ? dynamicSenseMethod : dynamicSenseThread;
+ for (auto &t: senses) {
if (t == s) {
- t = dynamicSensitivities.back();
- dynamicSensitivities.pop_back();
+ t = senses.back();
+ senses.pop_back();
break;
}
}
ScEvent delayedNotify;
- mutable StaticSensitivities staticSensitivities;
- mutable DynamicSensitivities dynamicSensitivities;
+ mutable StaticSensitivities staticSenseMethod;
+ mutable StaticSensitivities staticSenseThread;
+ mutable DynamicSensitivities dynamicSenseMethod;
+ mutable DynamicSensitivities dynamicSenseThread;
};
extern Events topLevelEvents;
#include "systemc/core/event.hh"
#include "systemc/core/port.hh"
+#include "systemc/core/process.hh"
#include "systemc/core/scheduler.hh"
#include "systemc/ext/core/sc_export.hh"
#include "systemc/ext/core/sc_interface.hh"
return notifyWork(e);
}
+bool
+Sensitivity::ofMethod()
+{
+ return process->procKind() == sc_core::SC_METHOD_PROC_;
+}
+
/*
* Dynamic vs. static sensitivity.