systemc: Make sure no delta cycles are scheduled when stopping.
authorGabe Black <gabeblack@google.com>
Wed, 22 Aug 2018 02:10:47 +0000 (19:10 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 25 Sep 2018 23:54:38 +0000 (23:54 +0000)
If the readyEvent is still scheduled when sc_main completes, gem5 will
return to it's main fiber and keep executing events, including that
one. That means a delta cycle will run even after sc_main is complete.
This change ensures that the readyEvent has been descheduled as part
of stopping.

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

src/systemc/core/scheduler.cc

index 6762086a0f94f19b4bdbf5ac3ec972bb57411b73..f930bb5157f2ff5f433eed41768903279ad4e682 100644 (file)
@@ -272,6 +272,10 @@ Scheduler::stop()
 {
     _stopped = true;
     kernel->stop();
+
+    if (readyEvent.scheduled())
+        eq->deschedule(&readyEvent);
+
     runOnce = false;
     scMain->run();
 }