systemc: Implement the nonstandard halt function.
authorGabe Black <gabeblack@google.com>
Wed, 5 Sep 2018 23:08:24 +0000 (16:08 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 9 Oct 2018 21:36:27 +0000 (21:36 +0000)
Change-Id: Ie9bd9db92a63169980230bc9a15e153d5609dd0b
Reviewed-on: https://gem5-review.googlesource.com/c/12594
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>

src/systemc/core/process.cc
src/systemc/core/process.hh
src/systemc/core/sc_module.cc

index 1fd16e0d90176cd2d4c182e4aa4afe3134eac2f3..b8eab3cde399b394d04ed72a1617adf13196461e 100644 (file)
@@ -338,6 +338,8 @@ Process::run()
         reset = false;
         try {
             func->call();
+        } catch(ScHalt) {
+            std::cout << "Terminating process " << name() << std::endl;
         } catch(const ::sc_core::sc_unwind_exception &exc) {
             reset = exc.is_reset();
             _isUnwinding = false;
index 2ec75dc06c60d1083e9bf66b9ab7b194d5416e55..d28d46396e303f78bf39df36a43ee4ee43af9fa6 100644 (file)
@@ -52,6 +52,9 @@
 namespace sc_gem5
 {
 
+class ScHalt
+{};
+
 class Sensitivity
 {
   protected:
index 8418a3136ca4e79ac0e014281a5057b234888e03..2ba0fa221dafad5286fe9afe584e58ae4e04f73d 100644 (file)
@@ -670,7 +670,8 @@ wait(double d, sc_time_unit u, const sc_event_and_list &eal)
 void
 halt()
 {
-    warn("%s not implemented.\n", __PRETTY_FUNCTION__);
+    ::sc_core::wait();
+    throw ::sc_gem5::ScHalt();
 }
 
 void