systemc: Switch to using predefined messages for core.
authorGabe Black <gabeblack@google.com>
Sun, 7 Oct 2018 07:42:04 +0000 (00:42 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 16 Oct 2018 01:09:20 +0000 (01:09 +0000)
Create and use predefined messages for core which match the ones
Accellera uses.

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

22 files changed:
src/systemc/core/SConscript
src/systemc/core/event.cc
src/systemc/core/messages.cc [new file with mode: 0644]
src/systemc/core/module.cc
src/systemc/core/object.cc
src/systemc/core/process.cc
src/systemc/core/sc_join.cc
src/systemc/core/sc_main.cc
src/systemc/core/sc_module.cc
src/systemc/core/sc_module_name.cc
src/systemc/core/sc_process_handle.cc
src/systemc/core/sc_sensitive.cc
src/systemc/core/sc_spawn.cc
src/systemc/core/sc_time.cc
src/systemc/core/scheduler.cc
src/systemc/core/sensitivity.cc
src/systemc/ext/core/_core.hh
src/systemc/ext/core/_using.hh
src/systemc/ext/core/messages.hh [new file with mode: 0644]
src/systemc/ext/core/sc_process_handle.hh
src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp
src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp

index 0ce10290d284588d8c7ed737a1cd1cb1153122ca..1f5498b9355a054fd6e4b3ad6718e49a9bd41ffe 100644 (file)
@@ -33,6 +33,7 @@ if env['USE_SYSTEMC']:
     Source('channel.cc')
     Source('event.cc')
     Source('kernel.cc')
+    Source('messages.cc')
     Source('module.cc')
     Source('object.cc')
     Source('port.cc')
index de5bc8c32a8b307bccdd36cc4f2aadc372e7d737..1c966d8156a7211a7d6820dbde672a565618d0c2 100644 (file)
@@ -37,6 +37,7 @@
 #include "sim/core.hh"
 #include "systemc/core/module.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_module.hh"
 
@@ -78,7 +79,8 @@ Event::Event(sc_core::sc_event *_sc_event, const char *_basename_cstr,
             std::string message = path + original_name +
                 ". Latter declaration will be renamed to " +
                 path + _basename;
-            SC_REPORT_WARNING("(W505) object already exists", message.c_str());
+            SC_REPORT_WARNING(sc_core::SC_ID_INSTANCE_EXISTS_,
+                    message.c_str());
         }
 
         _name = path + _basename;
@@ -159,10 +161,8 @@ Event::notify(DynamicSensitivities &senses)
 void
 Event::notify()
 {
-    if (scheduler.inUpdate()) {
-        SC_REPORT_ERROR("(E521) immediate notification is not allowed "
-                "during update phase or elaboration", "");
-    }
+    if (scheduler.inUpdate())
+        SC_REPORT_ERROR(sc_core::SC_ID_IMMEDIATE_NOTIFICATION_, "");
 
     // An immediate notification overrides any pending delayed notification.
     if (delayedNotify.scheduled())
@@ -190,10 +190,8 @@ Event::notify(const sc_core::sc_time &t)
 void
 Event::notifyDelayed(const sc_core::sc_time &t)
 {
-    if (delayedNotify.scheduled()) {
-        SC_REPORT_ERROR("(E531) notify_delayed() cannot be called on events "
-                "that have pending notifications", "");
-    }
+    if (delayedNotify.scheduled())
+        SC_REPORT_ERROR(sc_core::SC_ID_NOTIFY_DELAYED_, "");
     notify(t);
 }
 
diff --git a/src/systemc/core/messages.cc b/src/systemc/core/messages.cc
new file mode 100644 (file)
index 0000000..7d067cf
--- /dev/null
@@ -0,0 +1,246 @@
+/*
+ * Copyright 2018 Google, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#include "systemc/ext/core/messages.hh"
+#include "systemc/utils/report.hh"
+
+namespace sc_core
+{
+
+const char SC_ID_NO_BOOL_RETURNED_[] = "operator does not return boolean";
+const char SC_ID_NO_INT_RETURNED_[] = "operator does not return int";
+const char SC_ID_NO_SC_LOGIC_RETURNED_[] = "operator does not return sc_logic";
+const char SC_ID_OPERAND_NOT_SC_LOGIC_[] = "operand is not sc_logic";
+const char SC_ID_OPERAND_NOT_BOOL_[] = "operand is not bool";
+const char SC_ID_INSTANCE_EXISTS_[] = "object already exists";
+const char SC_ID_ILLEGAL_CHARACTERS_[] = "illegal characters";
+const char SC_ID_VC6_PROCESS_HELPER_[] =
+    "internal error: sc_vc6_process_helper";
+const char SC_ID_VC6_MAX_PROCESSES_EXCEEDED_[] =
+    "maximum number of processes per module exceeded (VC6)";
+const char SC_ID_END_MODULE_NOT_CALLED_[] =
+    "module construction not properly completed: did "
+    "you forget to add a sc_module_name parameter to "
+    "your module constructor?";
+const char SC_ID_HIER_NAME_INCORRECT_[] =
+    "hierarchical name as shown may be incorrect due to previous errors";
+const char SC_ID_SET_STACK_SIZE_[] =
+    "set_stack_size() is only allowed for SC_THREADs and SC_CTHREADs";
+const char SC_ID_SC_MODULE_NAME_USE_[] = "incorrect use of sc_module_name";
+const char SC_ID_SC_MODULE_NAME_REQUIRED_[] =
+    "an sc_module_name parameter for your constructor is required";
+const char SC_ID_SET_TIME_RESOLUTION_[] = "set time resolution failed";
+const char SC_ID_SET_DEFAULT_TIME_UNIT_[] = "set default time unit failed";
+const char SC_ID_DEFAULT_TIME_UNIT_CHANGED_[] =
+    "default time unit changed to time resolution";
+const char SC_ID_INCONSISTENT_API_CONFIG_[] =
+    "inconsistent library configuration detected";
+const char SC_ID_WAIT_NOT_ALLOWED_[] =
+    "wait() is only allowed in SC_THREADs and SC_CTHREADs";
+const char SC_ID_NEXT_TRIGGER_NOT_ALLOWED_[] =
+    "next_trigger() is only allowed in SC_METHODs";
+const char SC_ID_IMMEDIATE_NOTIFICATION_[] =
+    "immediate notification is not allowed during update phase or elaboration";
+const char SC_ID_HALT_NOT_ALLOWED_[] = "halt() is only allowed in SC_CTHREADs";
+const char SC_ID_WATCHING_NOT_ALLOWED_[] =
+    "watching() has been deprecated, use reset_signal_is()";
+const char SC_ID_DONT_INITIALIZE_[] =
+    "dont_initialize() has no effect for SC_CTHREADs";
+const char SC_ID_WAIT_N_INVALID_[] = "wait(n) is only valid for n > 0";
+const char SC_ID_MAKE_SENSITIVE_[] = "make sensitive failed";
+const char SC_ID_MAKE_SENSITIVE_POS_[] = "make sensitive pos failed";
+const char SC_ID_MAKE_SENSITIVE_NEG_[] = "make sensitive neg failed";
+const char SC_ID_INSERT_MODULE_[] = "insert module failed";
+const char SC_ID_REMOVE_MODULE_[] = "remove module failed";
+const char SC_ID_NOTIFY_DELAYED_[] =
+    "notify_delayed() cannot be called on events "
+    "that have pending notifications";
+const char SC_ID_GEN_UNIQUE_NAME_[] =
+    "cannot generate unique name from null string";
+const char SC_ID_MODULE_NAME_STACK_EMPTY_[] =
+    "module name stack is empty: did you forget to "
+    "add a sc_module_name parameter to your module "
+    "constructor?";
+const char SC_ID_NAME_EXISTS_[] = "name already exists";
+const char SC_ID_IMMEDIATE_SELF_NOTIFICATION_[] =
+    "immediate self-notification ignored as of IEEE 1666-2011";
+const char SC_ID_WAIT_DURING_UNWINDING_[] =
+    "wait() not allowed during unwinding";
+const char SC_ID_CYCLE_MISSES_EVENTS_[] =
+    "the simulation contains timed-events but they are "
+    "ignored by sc_cycle() ==> the simulation will be "
+    "incorrect";
+const char SC_ID_RETHROW_UNWINDING_[] =
+    "sc_unwind_exception not re-thrown during kill/reset";
+const char SC_ID_PROCESS_ALREADY_UNWINDING_[] =
+    "kill/reset ignored during unwinding";
+const char SC_ID_MODULE_METHOD_AFTER_START_[] =
+    "call to SC_METHOD in sc_module while simulation running";
+const char SC_ID_MODULE_THREAD_AFTER_START_[] =
+    "call to SC_THREAD in sc_module while simulation running";
+const char SC_ID_MODULE_CTHREAD_AFTER_START_[] =
+    "call to SC_CTHREAD in sc_module while simulation running";
+const char SC_ID_SIMULATION_TIME_OVERFLOW_[] =
+    "simulation time value overflow, simulation aborted";
+const char SC_ID_SIMULATION_STOP_CALLED_TWICE_[] =
+    "sc_stop has already been called";
+const char SC_ID_SIMULATION_START_AFTER_STOP_[] =
+    "sc_start called after sc_stop has been called";
+const char SC_ID_STOP_MODE_AFTER_START_[] =
+    "attempt to set sc_stop mode  after start will be ignored";
+const char SC_ID_SIMULATION_START_AFTER_ERROR_[] =
+    "attempt to restart simulation after error";
+const char SC_ID_SIMULATION_UNCAUGHT_EXCEPTION_[] = "uncaught exception";
+const char SC_ID_PHASE_CALLBACKS_UNSUPPORTED_[] =
+    "simulation phase callbacks not enabled";
+const char SC_ID_PHASE_CALLBACK_NOT_IMPLEMENTED_[] =
+    "empty simulation phase callback called";
+const char SC_ID_PHASE_CALLBACK_REGISTER_[] =
+    "register simulation phase callback";
+const char SC_ID_PHASE_CALLBACK_FORBIDDEN_[] =
+    "forbidden action in simulation phase callback";
+const char SC_ID_SIMULATION_START_UNEXPECTED_[] =
+    "sc_start called unexpectedly";
+const char SC_ID_THROW_IT_IGNORED_[] =
+    "throw_it on method/non-running process is being ignored ";
+const char SC_ID_NOT_EXPECTING_DYNAMIC_EVENT_NOTIFY_[] =
+    "dynamic event notification encountered when sensitivity is static";
+const char SC_ID_DISABLE_WILL_ORPHAN_PROCESS_[] =
+    "disable() or dont_initialize() called on process with no static "
+    "sensitivity, it will be orphaned";
+const char SC_ID_PROCESS_CONTROL_CORNER_CASE_[] =
+    "Undefined process control interaction";
+const char SC_ID_METHOD_TERMINATION_EVENT_[] =
+    "Attempt to get terminated event for a method process";
+const char SC_ID_JOIN_ON_METHOD_HANDLE_[] =
+    "Attempt to register method process with sc_join object";
+const char SC_ID_NO_PROCESS_SEMANTICS_[] =
+    "Attempt to invoke process with no semantics() method";
+const char SC_ID_EVENT_ON_NULL_PROCESS_[] =
+    "Attempt to get an event for non-existent process";
+const char SC_ID_EVENT_LIST_FAILED_[] =
+    "invalid use of sc_(and|or)_event list";
+const char SC_ID_UNKNOWN_PROCESS_TYPE_[] = "Unknown process type";
+const char SC_ID_TIME_CONVERSION_FAILED_[] = "sc_time conversion failed";
+const char SC_ID_NEGATIVE_SIMULATION_TIME_[] =
+    "negative simulation interval specified in sc_start call";
+const char SC_ID_BAD_SC_MODULE_CONSTRUCTOR_[] =
+    "sc_module(const char*), sc_module(const std::string&) "
+    "have been deprecated, use sc_module(const sc_module_name&)";
+const char SC_ID_EMPTY_PROCESS_HANDLE_[] =
+    "attempt to use an empty process handle ignored";
+const char SC_ID_NO_SC_START_ACTIVITY_[] =
+    "no activity or clock movement for sc_start() invocation";
+const char SC_ID_KILL_PROCESS_WHILE_UNITIALIZED_[] =
+    "a process may not be killed before it is initialized";
+const char SC_ID_RESET_PROCESS_WHILE_NOT_RUNNING_[] =
+    "a process may not be asynchronously reset while the "
+    "simulation is not running";
+const char SC_ID_THROW_IT_WHILE_NOT_RUNNING_[] =
+    "throw_it not allowed unless simulation is running ";
+
+namespace {
+
+sc_gem5::DefaultReportMessages predfinedMessages{
+    {500, SC_ID_NO_BOOL_RETURNED_},
+    {501, SC_ID_NO_INT_RETURNED_},
+    {502, SC_ID_NO_SC_LOGIC_RETURNED_},
+    {503, SC_ID_OPERAND_NOT_SC_LOGIC_},
+    {504, SC_ID_OPERAND_NOT_BOOL_},
+    {505, SC_ID_INSTANCE_EXISTS_},
+    {506, SC_ID_ILLEGAL_CHARACTERS_},
+    {507, SC_ID_VC6_PROCESS_HELPER_},
+    {508, SC_ID_VC6_MAX_PROCESSES_EXCEEDED_},
+    {509, SC_ID_END_MODULE_NOT_CALLED_},
+    {510, SC_ID_HIER_NAME_INCORRECT_},
+    {511, SC_ID_SET_STACK_SIZE_},
+    {512, SC_ID_SC_MODULE_NAME_USE_},
+    {513, SC_ID_SC_MODULE_NAME_REQUIRED_},
+    {514, SC_ID_SET_TIME_RESOLUTION_},
+    {515, SC_ID_SET_DEFAULT_TIME_UNIT_},
+    {516, SC_ID_DEFAULT_TIME_UNIT_CHANGED_},
+    {517, SC_ID_INCONSISTENT_API_CONFIG_},
+    {519, SC_ID_WAIT_NOT_ALLOWED_},
+    {520, SC_ID_NEXT_TRIGGER_NOT_ALLOWED_},
+    {521, SC_ID_IMMEDIATE_NOTIFICATION_},
+    {522, SC_ID_HALT_NOT_ALLOWED_},
+    {523, SC_ID_WATCHING_NOT_ALLOWED_},
+    {524, SC_ID_DONT_INITIALIZE_},
+    {525, SC_ID_WAIT_N_INVALID_},
+    {526, SC_ID_MAKE_SENSITIVE_},
+    {527, SC_ID_MAKE_SENSITIVE_POS_},
+    {528, SC_ID_MAKE_SENSITIVE_NEG_},
+    {529, SC_ID_INSERT_MODULE_},
+    {530, SC_ID_REMOVE_MODULE_},
+    {531, SC_ID_NOTIFY_DELAYED_},
+    {532, SC_ID_GEN_UNIQUE_NAME_},
+    {533, SC_ID_MODULE_NAME_STACK_EMPTY_},
+    {534, SC_ID_NAME_EXISTS_},
+    {536, SC_ID_IMMEDIATE_SELF_NOTIFICATION_},
+    {537, SC_ID_WAIT_DURING_UNWINDING_},
+    {538, SC_ID_CYCLE_MISSES_EVENTS_},
+    {539, SC_ID_RETHROW_UNWINDING_},
+    {540, SC_ID_PROCESS_ALREADY_UNWINDING_},
+    {541, SC_ID_MODULE_METHOD_AFTER_START_},
+    {542, SC_ID_MODULE_THREAD_AFTER_START_},
+    {543, SC_ID_MODULE_CTHREAD_AFTER_START_},
+    {544, SC_ID_SIMULATION_TIME_OVERFLOW_},
+    {545, SC_ID_SIMULATION_STOP_CALLED_TWICE_},
+    {546, SC_ID_SIMULATION_START_AFTER_STOP_},
+    {547, SC_ID_STOP_MODE_AFTER_START_},
+    {548, SC_ID_SIMULATION_START_AFTER_ERROR_},
+    {549, SC_ID_SIMULATION_UNCAUGHT_EXCEPTION_},
+    {550, SC_ID_PHASE_CALLBACKS_UNSUPPORTED_},
+    {551, SC_ID_PHASE_CALLBACK_NOT_IMPLEMENTED_},
+    {552, SC_ID_PHASE_CALLBACK_REGISTER_},
+    {553, SC_ID_PHASE_CALLBACK_FORBIDDEN_},
+    {554, SC_ID_SIMULATION_START_UNEXPECTED_},
+    {556, SC_ID_THROW_IT_IGNORED_},
+    {557, SC_ID_NOT_EXPECTING_DYNAMIC_EVENT_NOTIFY_},
+    {558, SC_ID_DISABLE_WILL_ORPHAN_PROCESS_},
+    {559, SC_ID_PROCESS_CONTROL_CORNER_CASE_},
+    {560, SC_ID_METHOD_TERMINATION_EVENT_},
+    {561, SC_ID_JOIN_ON_METHOD_HANDLE_},
+    {563, SC_ID_NO_PROCESS_SEMANTICS_},
+    {564, SC_ID_EVENT_ON_NULL_PROCESS_},
+    {565, SC_ID_EVENT_LIST_FAILED_},
+    {566, SC_ID_UNKNOWN_PROCESS_TYPE_},
+    {567, SC_ID_TIME_CONVERSION_FAILED_},
+    {568, SC_ID_NEGATIVE_SIMULATION_TIME_},
+    {569, SC_ID_BAD_SC_MODULE_CONSTRUCTOR_},
+    {570, SC_ID_EMPTY_PROCESS_HANDLE_},
+    {571, SC_ID_NO_SC_START_ACTIVITY_},
+    {572, SC_ID_KILL_PROCESS_WHILE_UNITIALIZED_},
+    {573, SC_ID_RESET_PROCESS_WHILE_NOT_RUNNING_},
+    {574, SC_ID_THROW_IT_WHILE_NOT_RUNNING_}
+};
+
+} // anonymous namespace
+
+} // namespace sc_core
index ec6c7761a02c258914839e6af0c7cf498444d870..4addb386cd3120e49f243b8696dc7e6233e3156b 100644 (file)
@@ -32,6 +32,7 @@
 #include <cassert>
 
 #include "base/logging.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_export.hh"
 #include "systemc/ext/core/sc_port.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -143,9 +144,7 @@ Module::endOfElaboration()
 {
     if (_deprecatedConstructor && !_ended) {
         std::string msg = csprintf("module '%s'", name());
-        SC_REPORT_WARNING("(W509) module construction not properly completed: "
-                "did you forget to add a sc_module_name parameter to "
-                "your module constructor?", msg.c_str());
+        SC_REPORT_WARNING(sc_core::SC_ID_END_MODULE_NOT_CALLED_, msg.c_str());
     }
     pushParentModule(this);
     try {
@@ -200,11 +199,8 @@ currentModule()
 Module *
 newModuleChecked()
 {
-    if (!_new_module) {
-        SC_REPORT_ERROR("(E533) module name stack is empty: "
-                "did you forget to add a sc_module_name parameter to "
-                "your module constructor?", nullptr);
-    }
+    if (!_new_module)
+        SC_REPORT_ERROR(sc_core::SC_ID_MODULE_NAME_STACK_EMPTY_, "");
     return _new_module;
 }
 
index 781e6d6d11125b0f4769c1cbdd7dbf323782bf09..55ea7e6d7010ad715b86bd300afa95d281500f3d 100644 (file)
@@ -36,6 +36,7 @@
 #include "systemc/core/event.hh"
 #include "systemc/core/module.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_module.hh"
 
 namespace sc_gem5
@@ -121,7 +122,7 @@ Object::Object(sc_core::sc_object *_sc_obj, const char *obj_name) :
         std::string message = path + original_name +
             ". Latter declaration will be renamed to " +
             path + _basename;
-        SC_REPORT_WARNING("(W505) object already exists", message.c_str());
+        SC_REPORT_WARNING(sc_core::SC_ID_INSTANCE_EXISTS_, message.c_str());
     }
     _name = path + _basename;
 }
index 9f47bf94bfa91b318b68683188fd9ada1904e043..a0759d9ccbc764c7f418cf1f2042b301fcd3d187 100644 (file)
@@ -33,6 +33,7 @@
 #include "systemc/core/event.hh"
 #include "systemc/core/port.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_join.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_process_handle.hh"
@@ -120,7 +121,7 @@ Process::disable(bool inc_kids)
             timeoutEvent.scheduled()) {
         std::string message("attempt to disable a thread with timeout wait: ");
         message += name();
-        SC_REPORT_ERROR("Undefined process control interaction",
+        SC_REPORT_ERROR(sc_core::SC_ID_PROCESS_CONTROL_CORNER_CASE_,
                 message.c_str());
     }
 
@@ -141,8 +142,7 @@ 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",
+        SC_REPORT_ERROR(sc_core::SC_ID_KILL_PROCESS_WHILE_UNITIALIZED_,
                 name());
     }
 
@@ -170,9 +170,8 @@ 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());
+        SC_REPORT_ERROR(sc_core::SC_ID_RESET_PROCESS_WHILE_NOT_RUNNING_,
+                name());
     }
 
     // Propogate the reset to our children no matter what happens to us.
@@ -199,19 +198,15 @@ Process::reset(bool inc_kids)
 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 (::sc_core::sc_get_status() != ::sc_core::SC_RUNNING)
+        SC_REPORT_ERROR(sc_core::SC_ID_THROW_IT_WHILE_NOT_RUNNING_, name());
 
     if (inc_kids)
         forEachKid([&exc](Process *p) { p->throw_it(exc, true); });
 
     if (_needsStart || _terminated ||
             procKind() == ::sc_core::SC_METHOD_PROC_) {
-        SC_REPORT_WARNING("(W556) throw_it on method/non-running process "
-                "is being ignored ", name());
+        SC_REPORT_WARNING(sc_core::SC_ID_THROW_IT_IGNORED_, name());
         return;
     }
 
index 3c27eaa42d553eb3b0b74d27a84ac5818cc5e914..bc7441d6efa56e17dd1d427a5c462ca5312712ea 100644 (file)
@@ -29,6 +29,7 @@
 
 #include "base/logging.hh"
 #include "systemc/core/process.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_event.hh"
 #include "systemc/ext/core/sc_join.hh"
 #include "systemc/ext/core/sc_module.hh"
@@ -46,8 +47,7 @@ sc_join::add_process(sc_process_handle h)
     assert(p);
 
     if (p->procKind() == SC_METHOD_PROC_) {
-        SC_REPORT_ERROR("(E561) Attempt to register method process "
-                "with sc_join object", "");
+        SC_REPORT_ERROR(SC_ID_JOIN_ON_METHOD_HANDLE_, "");
         return;
     }
 
index 95e955002876b1ce01894c1cddc96fa52c78699f..a5e0366b91c466f53af8aa8e81efa4203c99ae44 100644 (file)
@@ -39,6 +39,7 @@
 #include "systemc/core/kernel.hh"
 #include "systemc/core/python.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
 #include "systemc/utils/report.hh"
@@ -203,10 +204,8 @@ 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", "");
-        }
+        if (MaxTick - now < time.value())
+            SC_REPORT_ERROR(SC_ID_SIMULATION_TIME_OVERFLOW_, "");
         ::sc_gem5::scheduler.start(now + time.value(), p == SC_RUN_TO_TIME);
     }
 }
@@ -215,8 +214,7 @@ void
 sc_set_stop_mode(sc_stop_mode mode)
 {
     if (sc_is_running()) {
-        SC_REPORT_ERROR("attempt to set sc_stop mode "
-                        "after start will be ignored", "");
+        SC_REPORT_ERROR(SC_ID_STOP_MODE_AFTER_START_, "");
         return;
     }
     _stop_mode = mode;
@@ -235,7 +233,7 @@ sc_stop()
     if (stop_called) {
         static bool stop_warned = false;
         if (!stop_warned)
-            SC_REPORT_WARNING("(W545) sc_stop has already been called", "");
+            SC_REPORT_WARNING(SC_ID_SIMULATION_STOP_CALLED_TWICE_, "");
         stop_warned = true;
         return;
     }
index df23de4e1b8577a97c7b89297d5936d0b0bd9147..ae2580639433c45a91da1c2b40db4654dea6ae93 100644 (file)
@@ -43,6 +43,7 @@
 #include "systemc/ext/channel/sc_inout.hh"
 #include "systemc/ext/channel/sc_out.hh"
 #include "systemc/ext/channel/sc_signal_in_if.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_module.hh"
 #include "systemc/ext/core/sc_module_name.hh"
 #include "systemc/ext/dt/bit/sc_logic.hh"
@@ -58,8 +59,8 @@ newMethodProcess(const char *name, ProcessFuncWrapper *func)
     if (::sc_core::sc_is_running()) {
         std::string name = p->name();
         delete p;
-        SC_REPORT_ERROR("(E541) call to SC_METHOD in sc_module while "
-                "simulation running", name.c_str());
+        SC_REPORT_ERROR(sc_core::SC_ID_MODULE_METHOD_AFTER_START_,
+                name.c_str());
         return nullptr;
     }
     scheduler.reg(p);
@@ -73,8 +74,8 @@ newThreadProcess(const char *name, ProcessFuncWrapper *func)
     if (::sc_core::sc_is_running()) {
         std::string name = p->name();
         delete p;
-        SC_REPORT_ERROR("(E542) call to SC_THREAD in sc_module while "
-                "simulation running", name.c_str());
+        SC_REPORT_ERROR(sc_core::SC_ID_MODULE_THREAD_AFTER_START_,
+                name.c_str());
         return nullptr;
     }
     scheduler.reg(p);
@@ -88,8 +89,8 @@ newCThreadProcess(const char *name, ProcessFuncWrapper *func)
     if (::sc_core::sc_is_running()) {
         std::string name = p->name();
         delete p;
-        SC_REPORT_ERROR("(E543) call to SC_CTHREAD in sc_module while "
-                "simulation running", name.c_str());
+        SC_REPORT_ERROR(sc_core::SC_ID_MODULE_CTHREAD_AFTER_START_,
+                name.c_str());
         return nullptr;
     }
     scheduler.reg(p);
@@ -252,31 +253,23 @@ sc_module::sc_module() :
     sc_object(sc_gem5::newModuleChecked()->name()),
     _gem5_module(sc_gem5::currentModule())
 {
-    if (sc_is_running()) {
-        SC_REPORT_ERROR("(E529) insert module failed", "simulation running");
-        std::cout << "Running!\n";
-    }
-    if (::sc_gem5::scheduler.elaborationDone()) {
-        SC_REPORT_ERROR("(E529) insert module failed", "elaboration done");
-        std::cout << "Elaboration done!\n";
-    }
+    if (sc_is_running())
+        SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "simulation running");
+    if (::sc_gem5::scheduler.elaborationDone())
+        SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "elaboration done");
 }
 
 sc_module::sc_module(const sc_module_name &) : sc_module() {}
 sc_module::sc_module(const char *_name) : sc_module(sc_module_name(_name))
 {
     _gem5_module->deprecatedConstructor();
-    SC_REPORT_WARNING("(W569) sc_module(const char*), "
-            "sc_module(const std::string&) have been deprecated, use "
-            "sc_module(const sc_module_name&)", _name);
+    SC_REPORT_WARNING(SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, _name);
 }
 sc_module::sc_module(const std::string &_name) :
     sc_module(sc_module_name(_name.c_str()))
 {
     _gem5_module->deprecatedConstructor();
-    SC_REPORT_WARNING("(W569) sc_module(const char*), "
-            "sc_module(const std::string&) have been deprecated, use "
-            "sc_module(const sc_module_name&)", _name.c_str());
+    SC_REPORT_WARNING(SC_ID_BAD_SC_MODULE_CONSTRUCTOR_, _name.c_str());
 }
 
 void
@@ -339,10 +332,8 @@ void
 sc_module::dont_initialize()
 {
     ::sc_gem5::Process *p = ::sc_gem5::Process::newest();
-    if (p->procKind() == SC_CTHREAD_PROC_) {
-        SC_REPORT_WARNING("(W524) dont_initialize() has no effect for "
-                "SC_CTHREADs", "");
-    }
+    if (p->procKind() == SC_CTHREAD_PROC_)
+        SC_REPORT_WARNING(SC_ID_DONT_INITIALIZE_, "");
     p->dontInitialize(true);
 }
 
@@ -645,8 +636,7 @@ bool
 waitErrorCheck(sc_gem5::Process *p)
 {
     if (p->procKind() == SC_METHOD_PROC_) {
-        SC_REPORT_ERROR(
-                "(E519) wait() is only allowed in SC_THREADs and SC_CTHREADs",
+        SC_REPORT_ERROR(SC_ID_WAIT_NOT_ALLOWED_,
                 "\n        in SC_METHODs use next_trigger() instead");
         return true;
     }
@@ -671,7 +661,7 @@ 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());
+        SC_REPORT_ERROR(SC_ID_WAIT_N_INVALID_, msg.c_str());
     }
     sc_gem5::Process *p = sc_gem5::scheduler.current();
     p->waitCount(n - 1);
@@ -826,8 +816,7 @@ const char *
 sc_gen_unique_name(const char *seed)
 {
     if (!seed || seed[0] == '\0') {
-        SC_REPORT_ERROR(
-                "(E532) cannot generate unique name from null string", "");
+        SC_REPORT_ERROR(SC_ID_GEN_UNIQUE_NAME_, "");
         seed = "unnamed";
     }
 
index c18c0f9b8509835b81e5844b9a0db9f23c102752..27d115c956608a7e675a7af12b7f30396d8fbd35 100644 (file)
@@ -31,6 +31,7 @@
 #include "base/logging.hh"
 #include "systemc/core/module.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_module_name.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -42,9 +43,9 @@ sc_module_name::sc_module_name(const char *name) :
     _name(name), _gem5_module(nullptr), _on_the_stack(true)
 {
     if (sc_is_running())
-        SC_REPORT_ERROR("(E529) insert module failed", "simulation running");
+        SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "simulation running");
     else if (::sc_gem5::scheduler.elaborationDone())
-        SC_REPORT_ERROR("(E529) insert module failed", "elaboration done");
+        SC_REPORT_ERROR(SC_ID_INSERT_MODULE_, "elaboration done");
     else
         _gem5_module = new sc_gem5::Module(name);
 }
index fff406161aef4419adc4bbad9b8ecd4de7cc920e..9fd8efc40a89a2f515d46b6d15707637612a4e37 100644 (file)
@@ -30,6 +30,7 @@
 #include "base/logging.hh"
 #include "systemc/core/process.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_process_handle.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -197,8 +198,7 @@ const sc_event &
 sc_process_handle::terminated_event() const
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "terminated_event()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "terminated_event()");
         static sc_gem5::InternalScEvent non_event;
         return non_event;
     }
@@ -210,8 +210,7 @@ void
 sc_process_handle::suspend(sc_descendent_inclusion_info include_descendants)
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "suspend()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "suspend()");
         return;
     }
     _gem5_process->suspend(include_descendants == SC_INCLUDE_DESCENDANTS);
@@ -221,8 +220,7 @@ void
 sc_process_handle::resume(sc_descendent_inclusion_info include_descendants)
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "resume()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "resume()");
         return;
     }
     _gem5_process->resume(include_descendants == SC_INCLUDE_DESCENDANTS);
@@ -232,8 +230,7 @@ void
 sc_process_handle::disable(sc_descendent_inclusion_info include_descendants)
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "disable()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "disable()");
         return;
     }
     _gem5_process->disable(include_descendants == SC_INCLUDE_DESCENDANTS);
@@ -243,8 +240,7 @@ void
 sc_process_handle::enable(sc_descendent_inclusion_info include_descendants)
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "enable()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "enable()");
         return;
     }
     _gem5_process->enable(include_descendants == SC_INCLUDE_DESCENDANTS);
@@ -254,8 +250,7 @@ void
 sc_process_handle::kill(sc_descendent_inclusion_info include_descendants)
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "kill()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "kill()");
         return;
     }
     _gem5_process->kill(include_descendants == SC_INCLUDE_DESCENDANTS);
@@ -265,8 +260,7 @@ void
 sc_process_handle::reset(sc_descendent_inclusion_info include_descendants)
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "reset()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "reset()");
         return;
     }
     _gem5_process->reset(include_descendants == SC_INCLUDE_DESCENDANTS);
@@ -276,8 +270,7 @@ bool
 sc_process_handle::is_unwinding()
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "is_unwinding()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "is_unwinding()");
         return false;
     }
     return _gem5_process->isUnwinding();
@@ -287,8 +280,7 @@ const sc_event &
 sc_process_handle::reset_event() const
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "reset()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "reset()");
         static sc_gem5::InternalScEvent non_event;
         return non_event;
     }
@@ -301,8 +293,7 @@ sc_process_handle::sync_reset_on(
         sc_descendent_inclusion_info include_descendants)
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "sync_reset_on()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "sync_reset_on()");
         return;
     }
     _gem5_process->syncResetOn(include_descendants == SC_INCLUDE_DESCENDANTS);
@@ -313,8 +304,7 @@ sc_process_handle::sync_reset_off(
         sc_descendent_inclusion_info include_descendants)
 {
     if (!_gem5_process) {
-        SC_REPORT_WARNING("(W570) attempt to use an empty "
-                "process handle ignored", "sync_reset_off()");
+        SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "sync_reset_off()");
         return;
     }
     _gem5_process->syncResetOff(include_descendants == SC_INCLUDE_DESCENDANTS);
index 2accc93c1ef1bc3350a83829c7636246a0e60b45..58bf3c9dbf7c61d579d7ad736b026a52ecfca1a5 100644 (file)
@@ -32,6 +32,7 @@
 #include "systemc/ext/channel/sc_in.hh"
 #include "systemc/ext/channel/sc_inout.hh"
 #include "systemc/ext/channel/sc_signal_in_if.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_interface.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_sensitive.hh"
@@ -47,7 +48,7 @@ void
 checkIfRunning()
 {
     if (sc_is_running())
-        SC_REPORT_ERROR("(E526) make sensitive failed", "simulation running");
+        SC_REPORT_ERROR(SC_ID_MAKE_SENSITIVE_, "simulation running");
 }
 
 } // anonymous namespace
index 8c4d2bc72542f8a036e49e1394a85f26eb227d73..5e6d89d13e7b05e88519fa2e085b9aa48ca52533 100644 (file)
@@ -35,6 +35,7 @@
 #include "systemc/ext/channel/sc_inout.hh"
 #include "systemc/ext/channel/sc_out.hh"
 #include "systemc/ext/channel/sc_signal_in_if.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_module.hh"
 #include "systemc/ext/core/sc_spawn.hh"
@@ -105,9 +106,7 @@ spawnWork(ProcessFuncWrapper *func, const char *name,
             opts->_events.empty() && opts->_ports.empty() &&
             opts->_exports.empty() && opts->_interfaces.empty() &&
             opts->_finders.empty()) {
-        SC_REPORT_WARNING(
-                "(W558) disable() or dont_initialize() called on process "
-                "with no static sensitivity, it will be orphaned",
+        SC_REPORT_WARNING(sc_core::SC_ID_DISABLE_WILL_ORPHAN_PROCESS_,
                 proc->name());
     }
 
index 88058a733ab56b02e68323610a2da8e0893ae1cd..2dbc648f3a255b6bfa0d1abc92b67b507a93cc1d 100644 (file)
@@ -36,6 +36,7 @@
 #include "sim/core.hh"
 #include "systemc/core/python.hh"
 #include "systemc/core/time.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_time.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -164,8 +165,7 @@ sc_time::sc_time(double d, const char *unit)
     }
 
     if (tu > SC_SEC) {
-        SC_REPORT_ERROR("(E567) sc_time conversion failed",
-                "invalid unit given");
+        SC_REPORT_ERROR(SC_ID_TIME_CONVERSION_FAILED_,"invalid unit given");
         val = 0;
         return;
     }
@@ -311,8 +311,7 @@ sc_time::from_string(const char *str)
 
     double d = str ? std::strtod(str, &end) : 0.0;
     if (str == end || d < 0.0) {
-        SC_REPORT_ERROR("(E567) sc_time conversion failed",
-                "invalid value given");
+        SC_REPORT_ERROR(SC_ID_TIME_CONVERSION_FAILED_, "invalid value given");
         return SC_ZERO_TIME;
     }
 
@@ -373,40 +372,34 @@ const sc_time SC_ZERO_TIME;
 void
 sc_set_time_resolution(double d, sc_time_unit tu)
 {
-    if (d <= 0.0) {
-        SC_REPORT_ERROR("(E514) set time resolution failed",
-                "value not positive");
-    }
+    if (d <= 0.0)
+        SC_REPORT_ERROR(SC_ID_SET_TIME_RESOLUTION_, "value not positive");
+
     double dummy;
     if (modf(log10(d), &dummy) != 0.0) {
-        SC_REPORT_ERROR("(E514) set time resolution failed",
+        SC_REPORT_ERROR(SC_ID_SET_TIME_RESOLUTION_,
                 "value not a power of ten");
     }
-    if (sc_is_running()) {
-        SC_REPORT_ERROR("(E514) set time resolution failed",
-                "simulation running");
-    }
+    if (sc_is_running())
+        SC_REPORT_ERROR(SC_ID_SET_TIME_RESOLUTION_, "simulation running");
+
     static bool specified = false;
-    if (specified) {
-        SC_REPORT_ERROR("(E514) set time resolution failed",
-                "already specified");
-    }
+    if (specified)
+        SC_REPORT_ERROR(SC_ID_SET_TIME_RESOLUTION_, "already specified");
+
     // This won't detect the timescale being fixed outside of systemc, but
     // it's at least some protection.
     if (timeFixed) {
-        SC_REPORT_ERROR("(E514) set time resolution failed",
+        SC_REPORT_ERROR(SC_ID_SET_TIME_RESOLUTION_,
                 "sc_time object(s) constructed");
     }
 
     double seconds = d * sc_gem5::TimeUnitScale[tu];
-    if (seconds < sc_gem5::TimeUnitScale[SC_FS]) {
-        SC_REPORT_ERROR("(E514) set time resolution failed",
-                "value smaller than 1 fs");
-    }
+    if (seconds < sc_gem5::TimeUnitScale[SC_FS])
+        SC_REPORT_ERROR(SC_ID_SET_TIME_RESOLUTION_, "value smaller than 1 fs");
 
     if (seconds > defaultUnit) {
-        SC_REPORT_WARNING(
-                "(W516) default time unit changed to time resolution", "");
+        SC_REPORT_WARNING(SC_ID_DEFAULT_TIME_UNIT_CHANGED_, "");
         defaultUnit = seconds;
     }
 
@@ -438,28 +431,25 @@ sc_max_time()
 void
 sc_set_default_time_unit(double d, sc_time_unit tu)
 {
-    if (d < 0.0) {
-        SC_REPORT_ERROR("(E515) set default time unit failed",
-                "value not positive");
-    }
+    if (d < 0.0)
+        SC_REPORT_ERROR(SC_ID_SET_DEFAULT_TIME_UNIT_, "value not positive");
+
     double dummy;
     if (modf(log10(d), &dummy) != 0.0) {
-        SC_REPORT_ERROR("(E515) set default time unit failed",
+        SC_REPORT_ERROR(SC_ID_SET_DEFAULT_TIME_UNIT_,
                 "value not a power of ten");
     }
-    if (sc_is_running()) {
-        SC_REPORT_ERROR("(E515) set default time unit failed",
-                "simulation running");
-    }
+    if (sc_is_running())
+        SC_REPORT_ERROR(SC_ID_SET_DEFAULT_TIME_UNIT_, "simulation running");
+
     static bool specified = false;
     if (specified) {
-        SC_REPORT_ERROR("(E515) set default time unit failed",
-                "already specified");
+        SC_REPORT_ERROR(SC_ID_SET_DEFAULT_TIME_UNIT_, "already specified");
     }
     // This won't detect the timescale being fixed outside of systemc, but
     // it's at least some protection.
     if (timeFixed) {
-        SC_REPORT_ERROR("(E515) set default time unit failed",
+        SC_REPORT_ERROR(SC_ID_SET_DEFAULT_TIME_UNIT_,
                 "sc_time object(s) constructed");
     }
 
@@ -471,7 +461,7 @@ sc_set_default_time_unit(double d, sc_time_unit tu)
     if (resolution == 0.0)
         resolution = sc_gem5::TimeUnitScale[SC_PS];
     if (defaultUnit < resolution) {
-        SC_REPORT_ERROR("(E515) set default time unit failed",
+        SC_REPORT_ERROR(SC_ID_SET_DEFAULT_TIME_UNIT_,
                 "value smaller than time resolution");
     }
 }
index 969e4015500ecd0bd08ad187db0dfc85ca468ecf..ec91c795a8c79924eae0e3714d879a3605f8e745 100644 (file)
@@ -33,6 +33,7 @@
 #include "base/logging.hh"
 #include "sim/eventq.hh"
 #include "systemc/core/kernel.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/utils/sc_report.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -112,10 +113,8 @@ Scheduler::initPhase()
 
         if (p->dontInitialize()) {
             if (!p->hasStaticSensitivities() && !p->internal()) {
-                SC_REPORT_WARNING(
-                        "(W558) disable() or dont_initialize() called on "
-                        "process with no static sensitivity, it will be "
-                        "orphaned", p->name());
+                SC_REPORT_WARNING(sc_core::SC_ID_DISABLE_WILL_ORPHAN_PROCESS_,
+                        p->name());
             }
         } else {
             p->ready();
@@ -484,11 +483,15 @@ reportifyException()
         } catch (const ::sc_core::sc_unwind_exception &) {
             panic("Kill/reset exception escaped a Process::run()");
         } catch (const std::exception &e) {
-            SC_REPORT_ERROR("uncaught exception", e.what());
+            SC_REPORT_ERROR(
+                    sc_core::SC_ID_SIMULATION_UNCAUGHT_EXCEPTION_, e.what());
         } catch (const char *msg) {
-            SC_REPORT_ERROR("uncaught exception", msg);
+            SC_REPORT_ERROR(
+                    sc_core::SC_ID_SIMULATION_UNCAUGHT_EXCEPTION_, msg);
         } catch (...) {
-            SC_REPORT_ERROR("uncaught exception", "UNKNOWN EXCEPTION");
+            SC_REPORT_ERROR(
+                    sc_core::SC_ID_SIMULATION_UNCAUGHT_EXCEPTION_,
+                    "UNKNOWN EXCEPTION");
         }
     } catch (const ::sc_core::sc_report &r) {
         ::sc_core::sc_report_handler::set_handler(old_handler);
index 11e04a1005990721cdb4f28c747eaf748df7a23b..75128cb7fb45ef9bfdefe04e386e29e73147b618 100644 (file)
@@ -37,6 +37,7 @@
 #include "systemc/ext/channel/sc_in.hh"
 #include "systemc/ext/channel/sc_inout.hh"
 #include "systemc/ext/channel/sc_out.hh"
+#include "systemc/ext/core/messages.hh"
 #include "systemc/ext/core/sc_export.hh"
 #include "systemc/ext/core/sc_interface.hh"
 #include "systemc/ext/core/sc_port.hh"
@@ -67,8 +68,8 @@ Sensitivity::notify(Event *e)
     if (scheduler.current() == process) {
         static bool warned = false;
         if (!warned) {
-            SC_REPORT_WARNING("(W536) immediate self-notification ignored "
-                    "as of IEEE 1666-2011", process->name());
+            SC_REPORT_WARNING(sc_core::SC_ID_IMMEDIATE_SELF_NOTIFICATION_,
+                    process->name());
             warned = true;
         }
         return false;
index 03a04addef8f63ffbc1ac3c03e4523e60f80dbb5..5335b7dc54d4e543cfb3babccf310ac2a374fca4 100644 (file)
@@ -30,6 +30,7 @@
 #ifndef __SYSTEMC_EXT_CORE__CORE_HH__
 #define __SYSTEMC_EXT_CORE__CORE_HH__
 
+#include "messages.hh"
 #include "sc_attr.hh"
 #include "sc_event.hh"
 #include "sc_export.hh"
index 71d4cf9097db79265d2bf43a0ab87549f7603e59..7cd89632bfa530e4cf6075035c45785ee97e48b8 100644 (file)
@@ -160,4 +160,76 @@ using sc_core::sc_max_time;
 using sc_core::sc_get_default_time_unit;
 using sc_core::sc_set_default_time_unit;
 
+using sc_core::SC_ID_NO_BOOL_RETURNED_;
+using sc_core::SC_ID_NO_INT_RETURNED_;
+using sc_core::SC_ID_NO_SC_LOGIC_RETURNED_;
+using sc_core::SC_ID_OPERAND_NOT_SC_LOGIC_;
+using sc_core::SC_ID_OPERAND_NOT_BOOL_;
+using sc_core::SC_ID_INSTANCE_EXISTS_;
+using sc_core::SC_ID_ILLEGAL_CHARACTERS_;
+using sc_core::SC_ID_VC6_PROCESS_HELPER_;
+using sc_core::SC_ID_VC6_MAX_PROCESSES_EXCEEDED_;
+using sc_core::SC_ID_END_MODULE_NOT_CALLED_;
+using sc_core::SC_ID_HIER_NAME_INCORRECT_;
+using sc_core::SC_ID_SET_STACK_SIZE_;
+using sc_core::SC_ID_SC_MODULE_NAME_USE_;
+using sc_core::SC_ID_SC_MODULE_NAME_REQUIRED_;
+using sc_core::SC_ID_SET_TIME_RESOLUTION_;
+using sc_core::SC_ID_SET_DEFAULT_TIME_UNIT_;
+using sc_core::SC_ID_DEFAULT_TIME_UNIT_CHANGED_;
+using sc_core::SC_ID_INCONSISTENT_API_CONFIG_;
+using sc_core::SC_ID_WAIT_NOT_ALLOWED_;
+using sc_core::SC_ID_NEXT_TRIGGER_NOT_ALLOWED_;
+using sc_core::SC_ID_IMMEDIATE_NOTIFICATION_;
+using sc_core::SC_ID_HALT_NOT_ALLOWED_;
+using sc_core::SC_ID_WATCHING_NOT_ALLOWED_;
+using sc_core::SC_ID_DONT_INITIALIZE_;
+using sc_core::SC_ID_WAIT_N_INVALID_;
+using sc_core::SC_ID_MAKE_SENSITIVE_;
+using sc_core::SC_ID_MAKE_SENSITIVE_POS_;
+using sc_core::SC_ID_MAKE_SENSITIVE_NEG_;
+using sc_core::SC_ID_INSERT_MODULE_;
+using sc_core::SC_ID_REMOVE_MODULE_;
+using sc_core::SC_ID_NOTIFY_DELAYED_;
+using sc_core::SC_ID_GEN_UNIQUE_NAME_;
+using sc_core::SC_ID_MODULE_NAME_STACK_EMPTY_;
+using sc_core::SC_ID_NAME_EXISTS_;
+using sc_core::SC_ID_IMMEDIATE_SELF_NOTIFICATION_;
+using sc_core::SC_ID_WAIT_DURING_UNWINDING_;
+using sc_core::SC_ID_CYCLE_MISSES_EVENTS_;
+using sc_core::SC_ID_RETHROW_UNWINDING_;
+using sc_core::SC_ID_PROCESS_ALREADY_UNWINDING_;
+using sc_core::SC_ID_MODULE_METHOD_AFTER_START_;
+using sc_core::SC_ID_MODULE_THREAD_AFTER_START_;
+using sc_core::SC_ID_MODULE_CTHREAD_AFTER_START_;
+using sc_core::SC_ID_SIMULATION_TIME_OVERFLOW_;
+using sc_core::SC_ID_SIMULATION_STOP_CALLED_TWICE_;
+using sc_core::SC_ID_SIMULATION_START_AFTER_STOP_;
+using sc_core::SC_ID_STOP_MODE_AFTER_START_;
+using sc_core::SC_ID_SIMULATION_START_AFTER_ERROR_;
+using sc_core::SC_ID_SIMULATION_UNCAUGHT_EXCEPTION_;
+using sc_core::SC_ID_PHASE_CALLBACKS_UNSUPPORTED_;
+using sc_core::SC_ID_PHASE_CALLBACK_NOT_IMPLEMENTED_;
+using sc_core::SC_ID_PHASE_CALLBACK_REGISTER_;
+using sc_core::SC_ID_PHASE_CALLBACK_FORBIDDEN_;
+using sc_core::SC_ID_SIMULATION_START_UNEXPECTED_;
+using sc_core::SC_ID_THROW_IT_IGNORED_;
+using sc_core::SC_ID_NOT_EXPECTING_DYNAMIC_EVENT_NOTIFY_;
+using sc_core::SC_ID_DISABLE_WILL_ORPHAN_PROCESS_;
+using sc_core::SC_ID_PROCESS_CONTROL_CORNER_CASE_;
+using sc_core::SC_ID_METHOD_TERMINATION_EVENT_;
+using sc_core::SC_ID_JOIN_ON_METHOD_HANDLE_;
+using sc_core::SC_ID_NO_PROCESS_SEMANTICS_;
+using sc_core::SC_ID_EVENT_ON_NULL_PROCESS_;
+using sc_core::SC_ID_EVENT_LIST_FAILED_;
+using sc_core::SC_ID_UNKNOWN_PROCESS_TYPE_;
+using sc_core::SC_ID_TIME_CONVERSION_FAILED_;
+using sc_core::SC_ID_NEGATIVE_SIMULATION_TIME_;
+using sc_core::SC_ID_BAD_SC_MODULE_CONSTRUCTOR_;
+using sc_core::SC_ID_EMPTY_PROCESS_HANDLE_;
+using sc_core::SC_ID_NO_SC_START_ACTIVITY_;
+using sc_core::SC_ID_KILL_PROCESS_WHILE_UNITIALIZED_;
+using sc_core::SC_ID_RESET_PROCESS_WHILE_NOT_RUNNING_;
+using sc_core::SC_ID_THROW_IT_WHILE_NOT_RUNNING_;
+
 #endif  //__SYSTEMC_EXT_CORE__USING_HH__
diff --git a/src/systemc/ext/core/messages.hh b/src/systemc/ext/core/messages.hh
new file mode 100644 (file)
index 0000000..bddd9f2
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright 2018 Google, Inc.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met: redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer;
+ * redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution;
+ * neither the name of the copyright holders nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Gabe Black
+ */
+
+#ifndef __SYSTEMC_EXT_CORE_MESSAGES_HH__
+#define __SYSTEMC_EXT_CORE_MESSAGES_HH__
+
+namespace sc_core
+{
+
+extern const char SC_ID_NO_BOOL_RETURNED_[];
+extern const char SC_ID_NO_INT_RETURNED_[];
+extern const char SC_ID_NO_SC_LOGIC_RETURNED_[];
+extern const char SC_ID_OPERAND_NOT_SC_LOGIC_[];
+extern const char SC_ID_OPERAND_NOT_BOOL_[];
+extern const char SC_ID_INSTANCE_EXISTS_[];
+extern const char SC_ID_ILLEGAL_CHARACTERS_[];
+extern const char SC_ID_VC6_PROCESS_HELPER_[];
+extern const char SC_ID_VC6_MAX_PROCESSES_EXCEEDED_[];
+extern const char SC_ID_END_MODULE_NOT_CALLED_[];
+extern const char SC_ID_HIER_NAME_INCORRECT_[];
+extern const char SC_ID_SET_STACK_SIZE_[];
+extern const char SC_ID_SC_MODULE_NAME_USE_[];
+extern const char SC_ID_SC_MODULE_NAME_REQUIRED_[];
+extern const char SC_ID_SET_TIME_RESOLUTION_[];
+extern const char SC_ID_SET_DEFAULT_TIME_UNIT_[];
+extern const char SC_ID_DEFAULT_TIME_UNIT_CHANGED_[];
+extern const char SC_ID_INCONSISTENT_API_CONFIG_[];
+extern const char SC_ID_WAIT_NOT_ALLOWED_[];
+extern const char SC_ID_NEXT_TRIGGER_NOT_ALLOWED_[];
+extern const char SC_ID_IMMEDIATE_NOTIFICATION_[];
+extern const char SC_ID_HALT_NOT_ALLOWED_[];
+extern const char SC_ID_WATCHING_NOT_ALLOWED_[];
+extern const char SC_ID_DONT_INITIALIZE_[];
+extern const char SC_ID_WAIT_N_INVALID_[];
+extern const char SC_ID_MAKE_SENSITIVE_[];
+extern const char SC_ID_MAKE_SENSITIVE_POS_[];
+extern const char SC_ID_MAKE_SENSITIVE_NEG_[];
+extern const char SC_ID_INSERT_MODULE_[];
+extern const char SC_ID_REMOVE_MODULE_[];
+extern const char SC_ID_NOTIFY_DELAYED_[];
+extern const char SC_ID_GEN_UNIQUE_NAME_[];
+extern const char SC_ID_MODULE_NAME_STACK_EMPTY_[];
+extern const char SC_ID_NAME_EXISTS_[];
+extern const char SC_ID_IMMEDIATE_SELF_NOTIFICATION_[];
+extern const char SC_ID_WAIT_DURING_UNWINDING_[];
+extern const char SC_ID_CYCLE_MISSES_EVENTS_[];
+extern const char SC_ID_RETHROW_UNWINDING_[];
+extern const char SC_ID_PROCESS_ALREADY_UNWINDING_[];
+extern const char SC_ID_MODULE_METHOD_AFTER_START_[];
+extern const char SC_ID_MODULE_THREAD_AFTER_START_[];
+extern const char SC_ID_MODULE_CTHREAD_AFTER_START_[];
+extern const char SC_ID_SIMULATION_TIME_OVERFLOW_[];
+extern const char SC_ID_SIMULATION_STOP_CALLED_TWICE_[];
+extern const char SC_ID_SIMULATION_START_AFTER_STOP_[];
+extern const char SC_ID_STOP_MODE_AFTER_START_[];
+extern const char SC_ID_SIMULATION_START_AFTER_ERROR_[];
+extern const char SC_ID_SIMULATION_UNCAUGHT_EXCEPTION_[];
+extern const char SC_ID_PHASE_CALLBACKS_UNSUPPORTED_[];
+extern const char SC_ID_PHASE_CALLBACK_NOT_IMPLEMENTED_[];
+extern const char SC_ID_PHASE_CALLBACK_REGISTER_[];
+extern const char SC_ID_PHASE_CALLBACK_FORBIDDEN_[];
+extern const char SC_ID_SIMULATION_START_UNEXPECTED_[];
+extern const char SC_ID_THROW_IT_IGNORED_[];
+extern const char SC_ID_NOT_EXPECTING_DYNAMIC_EVENT_NOTIFY_[];
+extern const char SC_ID_DISABLE_WILL_ORPHAN_PROCESS_[];
+extern const char SC_ID_PROCESS_CONTROL_CORNER_CASE_[];
+extern const char SC_ID_METHOD_TERMINATION_EVENT_[];
+extern const char SC_ID_JOIN_ON_METHOD_HANDLE_[];
+extern const char SC_ID_NO_PROCESS_SEMANTICS_[];
+extern const char SC_ID_EVENT_ON_NULL_PROCESS_[];
+extern const char SC_ID_EVENT_LIST_FAILED_[];
+extern const char SC_ID_UNKNOWN_PROCESS_TYPE_[];
+extern const char SC_ID_TIME_CONVERSION_FAILED_[];
+extern const char SC_ID_NEGATIVE_SIMULATION_TIME_[];
+extern const char SC_ID_BAD_SC_MODULE_CONSTRUCTOR_[];
+extern const char SC_ID_EMPTY_PROCESS_HANDLE_[];
+extern const char SC_ID_NO_SC_START_ACTIVITY_[];
+extern const char SC_ID_KILL_PROCESS_WHILE_UNITIALIZED_[];
+extern const char SC_ID_RESET_PROCESS_WHILE_NOT_RUNNING_[];
+extern const char SC_ID_THROW_IT_WHILE_NOT_RUNNING_[];
+
+} // namespace sc_core
+
+#endif // __SYSTEMC_EXT_CORE_MESSAGES_HH__
index b9bb9a0c4cdc75196d119ac7a9de0f051a25a48a..c33bd78d51a45c31f6294767453c6c2a9bb139dd 100644 (file)
@@ -34,6 +34,7 @@
 #include <vector>
 
 #include "../utils/sc_report_handler.hh"
+#include "messages.hh"
 #include "sc_object.hh"
 
 namespace sc_gem5
@@ -214,8 +215,7 @@ class sc_process_handle
              SC_NO_DESCENDANTS)
     {
         if (!_gem5_process) {
-            SC_REPORT_WARNING("(W570) attempt to use an empty "
-                    "process handle ignored", "throw_it()");
+            SC_REPORT_WARNING(SC_ID_EMPTY_PROCESS_HANDLE_, "throw_it()");
             return;
         }
         ::sc_gem5::ExceptionWrapper<T> exc(user_defined_exception);
index 5f5d9908115ed1e8268f3058e039b7b660f7a2fe..560643bc144419f81ade8f6a5a0f282af60a73ec 100644 (file)
@@ -72,7 +72,7 @@ SC_MODULE(X)
 {
     SC_CTOR(X)
     {
-        SC_REPORT_ERROR("set time resolution failed","");
+        SC_REPORT_ERROR(SC_ID_SET_TIME_RESOLUTION_,"");
     }
 };
 
index 4e62c1091bec774483c814193f96f196e1030c51..c7a7f357ce5fe55c1db6e6b02b20df014e2968a6 100644 (file)
@@ -59,8 +59,8 @@ void check_time( const sc_time& t, sc_time_unit tu, const std::string & str )
 
 int sc_main( int, char*[] )
 {
-    sc_report_handler::set_actions( "set time resolution failed", SC_DO_NOTHING );
-    sc_report_handler::set_actions( "sc_time conversion failed", SC_DISPLAY );
+    sc_report_handler::set_actions( SC_ID_SET_TIME_RESOLUTION_, SC_DO_NOTHING );
+    sc_report_handler::set_actions( SC_ID_TIME_CONVERSION_FAILED_, SC_DISPLAY );
 
     unsigned resolutions[] = { 100, 10, 1 };
     sc_time_unit resunit   = SC_FS;