e->delSensitivity(this);
count++;
if (count == list->events.size())
- process->satisfySensitivity(this);
+ satisfy();
}
SensitivityEventOrList::SensitivityEventOrList(
SensitivityEventAndList::notifyWork(e);
} else {
// There's no inciting event, so this must be a timeout.
- SensitivityTimeout::notifyWork(e);
+ satisfy(true);
}
}
Process::Process(const char *name, ProcessFuncWrapper *func, bool internal) :
::sc_core::sc_process_b(name), excWrapper(nullptr), func(func),
- _internal(internal), _needsStart(true), _isUnwinding(false),
- _terminated(false), _suspended(false), _disabled(false), _syncReset(false),
- refCount(0), stackSize(::Fiber::DefaultStackSize),
- dynamicSensitivity(nullptr)
+ _internal(internal), _timedOut(false), _needsStart(true),
+ _isUnwinding(false), _terminated(false), _suspended(false),
+ _disabled(false), _syncReset(false), refCount(0),
+ stackSize(::Fiber::DefaultStackSize), dynamicSensitivity(nullptr)
{
_dynamic =
(::sc_core::sc_get_status() >
Sensitivity(Process *p) : process(p) {}
virtual ~Sensitivity() {}
- virtual void notifyWork(Event *e);
+ void satisfy(bool timedOut=false);
+
+ virtual void notifyWork(Event *e) { satisfy(); }
void notify(Event *e);
void notify() { notify(nullptr); }
Process *p, ::sc_core::sc_time t, const ::sc_core::sc_event *e) :
Sensitivity(p), SensitivityTimeout(p, t), SensitivityEvent(p, e)
{}
+
+ void notifyWork(Event *e) override { satisfy(e == nullptr); }
};
class SensitivityTimeoutAndEventAndList :
Sensitivity(p), SensitivityTimeout(p, t),
SensitivityEventOrList(p, eol)
{}
+
+ void notifyWork(Event *e) override { satisfy(e == nullptr); }
};
typedef std::vector<Sensitivity *> Sensitivities;
bool hasStaticSensitivities() { return !staticSensitivities.empty(); }
bool internal() { return _internal; }
+ bool timedOut() { return _timedOut; }
+ void timedOut(bool to) { _timedOut = to; }
protected:
Process(const char *name, ProcessFuncWrapper *func, bool internal=false);
bool _internal;
+ // Needed to support the deprecated "timed_out" function.
+ bool _timedOut;
+
bool _needsStart;
bool _dynamic;
bool _isUnwinding;
};
inline void
-Sensitivity::notifyWork(Event *e)
+Sensitivity::satisfy(bool timedOut)
{
+ process->timedOut(timedOut);
process->satisfySensitivity(this);
}
bool
sc_module::timed_out()
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
- return false;
+ return ::sc_core::timed_out();
}
bool
timed_out()
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
- return false;
+ ::sc_gem5::Process *p = sc_gem5::scheduler.current();
+ if (!p)
+ return false;
+ else
+ return p->timedOut();
}
bool
sc_prim_channel::timed_out()
{
- warn("%s not implemented.\n", __PRETTY_FUNCTION__);
- return false;
+ return ::sc_core::timed_out();
}
void