Gabe Black has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/12274

Change subject: systemc: Report errors when proc ctrl funcs are called during elab.
......................................................................

systemc: Report errors when proc ctrl funcs are called during elab.

Change-Id: I19475b86d04af5b3e4e907d9e24cb15666fb7bb1
---
M src/systemc/core/process.cc
1 file changed, 19 insertions(+), 0 deletions(-)



diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc
index 94e49a8..0784ab4 100644
--- a/src/systemc/core/process.cc
+++ b/src/systemc/core/process.cc
@@ -32,6 +32,7 @@
 #include "base/logging.hh"
 #include "systemc/core/event.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_process_handle.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"

@@ -212,6 +213,12 @@
 void
 Process::kill(bool inc_kids)
 {
+    if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
+        SC_REPORT_ERROR(
+ "(E572) a process may not be killed before it is initialized",
+                name());
+    }
+
     // Propogate the kill to our children no matter what happens to us.
     if (inc_kids)
         forEachKid([](Process *p) { p->kill(true); });
@@ -235,6 +242,12 @@
 void
 Process::reset(bool inc_kids)
 {
+    if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
+        SC_REPORT_ERROR(
+                "(E573) a process may not be asynchronously reset while"
+                "the simulation is not running", name());
+    }
+
     // Propogate the reset to our children no matter what happens to us.
     if (inc_kids)
         forEachKid([](Process *p) { p->reset(true); });
@@ -257,6 +270,12 @@
 void
 Process::throw_it(ExceptionWrapperBase &exc, bool inc_kids)
 {
+    if (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING) {
+        SC_REPORT_ERROR(
+ "(E574) throw_it not allowed unless simulation is running ",
+                name());
+    }
+
     if (inc_kids)
         forEachKid([&exc](Process *p) { p->throw_it(exc, true); });


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/12274
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I19475b86d04af5b3e4e907d9e24cb15666fb7bb1
Gerrit-Change-Number: 12274
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to