namespace sc_gem5
{
-void
-Sensitivity::satisfy()
-{
- warn_once("Ignoring suspended status for now.\n");
- process->setDynamic(nullptr);
- scheduler.ready(process);
-}
-
SensitivityTimeout::SensitivityTimeout(Process *p, ::sc_core::sc_time t) :
Sensitivity(p), timeoutEvent(this), timeout(t)
{
e->delSensitivity(this);
count++;
if (count == list->events.size())
- satisfy();
+ process->satisfySensitivity(this);
}
SensitivityEventOrList::SensitivityEventOrList(
if (!_suspended) {
_suspended = true;
- //TODO Suspend this process.
+ _suspendedReady = false;
}
if (procKind() != ::sc_core::SC_METHOD_PROC_ &&
if (_suspended) {
_suspended = false;
- //TODO Resume this process.
+ if (_suspendedReady)
+ ready();
+ _suspendedReady = false;
}
}
dynamicSensitivity = s;
}
+void
+Process::satisfySensitivity(Sensitivity *s)
+{
+ // If there's a dynamic sensitivity and this wasn't it, ignore.
+ if (dynamicSensitivity && dynamicSensitivity != s)
+ return;
+
+ setDynamic(nullptr);
+ ready();
+}
+
+void
+Process::ready()
+{
+ if (suspended())
+ _suspendedReady = true;
+ else
+ scheduler.ready(this);
+}
+
Process::Process(const char *name, ProcessFuncWrapper *func, bool _dynamic) :
::sc_core::sc_object(name), excWrapper(nullptr), func(func),
_running(false), _dynamic(_dynamic), _isUnwinding(false),
{
protected:
Process *process;
- void satisfy();
public:
Sensitivity(Process *p) : process(p) {}
virtual ~Sensitivity() {}
- virtual void notifyWork(Event *e) { satisfy(); }
+ virtual void notifyWork(Event *e);
void notify(Event *e);
void notify() { notify(nullptr); }
void addStatic(PendingSensitivity *);
void setDynamic(Sensitivity *);
+ void satisfySensitivity(Sensitivity *);
+
+ void ready();
+
virtual Fiber *fiber() { return Fiber::primaryFiber(); }
static Process *newest() { return _newest; }
bool _terminated;
bool _suspended;
+ bool _suspendedReady;
bool _disabled;
bool _syncReset;
Sensitivity *dynamicSensitivity;
};
+inline void
+Sensitivity::notifyWork(Event *e)
+{
+ process->satisfySensitivity(this);
+}
+
inline void
Sensitivity::notify(Event *e)
{
for (Process *p = initList.getNext(); p; p = initList.getNext()) {
p->finalize();
- ready(p);
+ p->ready();
}
initReady = true;
// If we're past initialization, finalize static sensitivity.
p->finalize();
// Mark the process as ready.
- ready(p);
+ p->ready();
} else {
// Otherwise, record that this process should be initialized once we
// get there.