From 1cc084fc7a214e6b3ed30910e9cd9a0c81f25b2f Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 30 Aug 2018 01:39:21 -0700 Subject: systemc: Raise an error when SC_METHOD, etc. is used after starting. Those mechanisms for creating processes are only allowed before the end of elaboration, or in other words before sc_start is called. Technically the check in Accellera's implementation won't trigger if the simulation is stopped, and we immitate that behavior. Change-Id: I9b8b5bd32f876781b6e0d5c0ee0e09de19bdabc1 Reviewed-on: https://gem5-review.googlesource.com/c/12447 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/systemc/ext/core/sc_module.hh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/systemc/ext') diff --git a/src/systemc/ext/core/sc_module.hh b/src/systemc/ext/core/sc_module.hh index 539d275ec..0e5e679c9 100644 --- a/src/systemc/ext/core/sc_module.hh +++ b/src/systemc/ext/core/sc_module.hh @@ -289,7 +289,8 @@ bool timed_out(); #name, new ::sc_gem5::ProcessMemberFuncWrapper< \ SC_CURRENT_USER_MODULE>(this, \ &SC_CURRENT_USER_MODULE::name)); \ - this->sensitive << p; \ + if (p) \ + this->sensitive << p; \ } #define SC_THREAD(name) \ { \ @@ -298,7 +299,8 @@ bool timed_out(); #name, new ::sc_gem5::ProcessMemberFuncWrapper< \ SC_CURRENT_USER_MODULE>(this, \ &SC_CURRENT_USER_MODULE::name)); \ - this->sensitive << p; \ + if (p) \ + this->sensitive << p; \ } #define SC_CTHREAD(name, clk) \ { \ @@ -307,8 +309,10 @@ bool timed_out(); #name, new ::sc_gem5::ProcessMemberFuncWrapper< \ SC_CURRENT_USER_MODULE>(this, \ &SC_CURRENT_USER_MODULE::name)); \ - this->sensitive << p; \ - this->sensitive << clk; \ + if (p) { \ + this->sensitive << p; \ + this->sensitive << clk; \ + } \ } // Nonstandard -- cgit v1.2.3