summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-09-01 16:37:55 -0700
committerGabe Black <gabeblack@google.com>2018-10-03 00:32:17 +0000
commit4c639e171abae185a6e0aa0bb908c0e1e37547b7 (patch)
treef33d85fe330818fc17dfeb593c1c022d0b4f5cec
parent643918fe491421823ecfba72500b19cc2b435ffc (diff)
downloadgem5-4c639e171abae185a6e0aa0bb908c0e1e37547b7.tar.xz
systemc: Report an error if n <= 0 in wait(int n).
This is in the spec, and tested by one of the regression tests. Change-Id: I035cfad279be3859242919a95598f191d5d06165 Reviewed-on: https://gem5-review.googlesource.com/c/12458 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com>
-rw-r--r--src/systemc/core/sc_module.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc
index 44e442d00..6be3818da 100644
--- a/src/systemc/core/sc_module.cc
+++ b/src/systemc/core/sc_module.cc
@@ -575,6 +575,10 @@ wait()
void
wait(int n)
{
+ if (n <= 0) {
+ std::string msg = csprintf("n = %d", n);
+ SC_REPORT_ERROR("(E525) wait(n) is only valid for n > 0", msg.c_str());
+ }
for (int i = 0; i < n; i++)
wait();
}