systemc: Check for time overflow in sc_start.
authorGabe Black <gabeblack@google.com>
Thu, 23 Aug 2018 04:37:11 +0000 (21:37 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 25 Sep 2018 23:59:14 +0000 (23:59 +0000)
A regression tests checks this situation.

Change-Id: I7716bf7c8cf219c372ab9722fc0ad52e7e674b17
Reviewed-on: https://gem5-review.googlesource.com/12256
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/systemc/core/sc_main.cc

index 39f6e174b9001572d7d783c3f7d6b3991591bde9..ea243bf61d40b4d1ac5f8b55825fdbd6ea7f8f20 100644 (file)
@@ -194,6 +194,10 @@ sc_start(const sc_time &time, sc_starvation_policy p)
         ::sc_gem5::scheduler.oneCycle();
     } else {
         Tick now = ::sc_gem5::scheduler.getCurTick();
+        if (MaxTick - now < time.value()) {
+            SC_REPORT_ERROR("(E544) simulation time value overflow, "
+                    "simulation aborted", "");
+        }
         ::sc_gem5::scheduler.start(now + time.value(), p == SC_RUN_TO_TIME);
     }
 }