From 4c639e171abae185a6e0aa0bb908c0e1e37547b7 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Sat, 1 Sep 2018 16:37:55 -0700 Subject: [PATCH] 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 Maintainer: Gabe Black --- src/systemc/core/sc_module.cc | 4 ++++ 1 file changed, 4 insertions(+) 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(); } -- 2.30.2