From e02b2a3d3b0d2d56e7a968269da022cbe68f7ca2 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 16 Jul 2018 16:44:07 -0700 Subject: systemc: Handle suspended processes and handle sensitivity overload. This change keeps track of whether a process would have become ready but was suspended so that it can become ready when the process is resumed. Also, this makes a process ignore its static sensitivity while a dynamic sensitivity is in place. Change-Id: If3f6c62f370051e574f81bf227746db8c43527e2 Reviewed-on: https://gem5-review.googlesource.com/11715 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/systemc/core/process.cc | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'src/systemc/core/process.cc') diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc index a949c9dee..63d2ff94b 100644 --- a/src/systemc/core/process.cc +++ b/src/systemc/core/process.cc @@ -36,14 +36,6 @@ 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) { @@ -88,7 +80,7 @@ SensitivityEventAndList::notifyWork(Event *e) e->delSensitivity(this); count++; if (count == list->events.size()) - satisfy(); + process->satisfySensitivity(this); } SensitivityEventOrList::SensitivityEventOrList( @@ -150,7 +142,7 @@ Process::suspend(bool inc_kids) if (!_suspended) { _suspended = true; - //TODO Suspend this process. + _suspendedReady = false; } if (procKind() != ::sc_core::SC_METHOD_PROC_ && @@ -167,7 +159,9 @@ Process::resume(bool inc_kids) if (_suspended) { _suspended = false; - //TODO Resume this process. + if (_suspendedReady) + ready(); + _suspendedReady = false; } } @@ -309,6 +303,26 @@ Process::setDynamic(Sensitivity *s) 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), -- cgit v1.2.3