summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/systemc/core/SConscript1
-rw-r--r--src/systemc/core/event.cc16
-rw-r--r--src/systemc/core/messages.cc246
-rw-r--r--src/systemc/core/module.cc12
-rw-r--r--src/systemc/core/object.cc3
-rw-r--r--src/systemc/core/process.cc21
-rw-r--r--src/systemc/core/sc_join.cc4
-rw-r--r--src/systemc/core/sc_main.cc12
-rw-r--r--src/systemc/core/sc_module.cc47
-rw-r--r--src/systemc/core/sc_module_name.cc5
-rw-r--r--src/systemc/core/sc_process_handle.cc34
-rw-r--r--src/systemc/core/sc_sensitive.cc3
-rw-r--r--src/systemc/core/sc_spawn.cc5
-rw-r--r--src/systemc/core/sc_time.cc64
-rw-r--r--src/systemc/core/scheduler.cc17
-rw-r--r--src/systemc/core/sensitivity.cc5
-rw-r--r--src/systemc/ext/core/_core.hh1
-rw-r--r--src/systemc/ext/core/_using.hh72
-rw-r--r--src/systemc/ext/core/messages.hh110
-rw-r--r--src/systemc/ext/core/sc_process_handle.hh4
-rw-r--r--src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp2
-rw-r--r--src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp4
22 files changed, 540 insertions, 148 deletions
diff --git a/src/systemc/core/SConscript b/src/systemc/core/SConscript
index 0ce10290d..1f5498b93 100644
--- a/src/systemc/core/SConscript
+++ b/src/systemc/core/SConscript
@@ -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')
diff --git a/src/systemc/core/event.cc b/src/systemc/core/event.cc
index de5bc8c32..1c966d815 100644
--- a/src/systemc/core/event.cc
+++ b/src/systemc/core/event.cc
@@ -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
index 000000000..7d067cfd7
--- /dev/null
+++ b/src/systemc/core/messages.cc
@@ -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
diff --git a/src/systemc/core/module.cc b/src/systemc/core/module.cc
index ec6c7761a..4addb386c 100644
--- a/src/systemc/core/module.cc
+++ b/src/systemc/core/module.cc
@@ -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;
}
diff --git a/src/systemc/core/object.cc b/src/systemc/core/object.cc
index 781e6d6d1..55ea7e6d7 100644
--- a/src/systemc/core/object.cc
+++ b/src/systemc/core/object.cc
@@ -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;
}
diff --git a/src/systemc/core/process.cc b/src/systemc/core/process.cc
index 9f47bf94b..a0759d9cc 100644
--- a/src/systemc/core/process.cc
+++ b/src/systemc/core/process.cc
@@ -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;
}
diff --git a/src/systemc/core/sc_join.cc b/src/systemc/core/sc_join.cc
index 3c27eaa42..bc7441d6e 100644
--- a/src/systemc/core/sc_join.cc
+++ b/src/systemc/core/sc_join.cc
@@ -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;
}
diff --git a/src/systemc/core/sc_main.cc b/src/systemc/core/sc_main.cc
index 95e955002..a5e0366b9 100644
--- a/src/systemc/core/sc_main.cc
+++ b/src/systemc/core/sc_main.cc
@@ -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;
}
diff --git a/src/systemc/core/sc_module.cc b/src/systemc/core/sc_module.cc
index df23de4e1..ae2580639 100644
--- a/src/systemc/core/sc_module.cc
+++ b/src/systemc/core/sc_module.cc
@@ -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";
}
diff --git a/src/systemc/core/sc_module_name.cc b/src/systemc/core/sc_module_name.cc
index c18c0f9b8..27d115c95 100644
--- a/src/systemc/core/sc_module_name.cc
+++ b/src/systemc/core/sc_module_name.cc
@@ -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);
}
diff --git a/src/systemc/core/sc_process_handle.cc b/src/systemc/core/sc_process_handle.cc
index fff406161..9fd8efc40 100644
--- a/src/systemc/core/sc_process_handle.cc
+++ b/src/systemc/core/sc_process_handle.cc
@@ -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);
diff --git a/src/systemc/core/sc_sensitive.cc b/src/systemc/core/sc_sensitive.cc
index 2accc93c1..58bf3c9db 100644
--- a/src/systemc/core/sc_sensitive.cc
+++ b/src/systemc/core/sc_sensitive.cc
@@ -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
diff --git a/src/systemc/core/sc_spawn.cc b/src/systemc/core/sc_spawn.cc
index 8c4d2bc72..5e6d89d13 100644
--- a/src/systemc/core/sc_spawn.cc
+++ b/src/systemc/core/sc_spawn.cc
@@ -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());
}
diff --git a/src/systemc/core/sc_time.cc b/src/systemc/core/sc_time.cc
index 88058a733..2dbc648f3 100644
--- a/src/systemc/core/sc_time.cc
+++ b/src/systemc/core/sc_time.cc
@@ -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");
}
}
diff --git a/src/systemc/core/scheduler.cc b/src/systemc/core/scheduler.cc
index 969e40155..ec91c795a 100644
--- a/src/systemc/core/scheduler.cc
+++ b/src/systemc/core/scheduler.cc
@@ -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);
diff --git a/src/systemc/core/sensitivity.cc b/src/systemc/core/sensitivity.cc
index 11e04a100..75128cb7f 100644
--- a/src/systemc/core/sensitivity.cc
+++ b/src/systemc/core/sensitivity.cc
@@ -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;
diff --git a/src/systemc/ext/core/_core.hh b/src/systemc/ext/core/_core.hh
index 03a04adde..5335b7dc5 100644
--- a/src/systemc/ext/core/_core.hh
+++ b/src/systemc/ext/core/_core.hh
@@ -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"
diff --git a/src/systemc/ext/core/_using.hh b/src/systemc/ext/core/_using.hh
index 71d4cf909..7cd89632b 100644
--- a/src/systemc/ext/core/_using.hh
+++ b/src/systemc/ext/core/_using.hh
@@ -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
index 000000000..bddd9f2c5
--- /dev/null
+++ b/src/systemc/ext/core/messages.hh
@@ -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__
diff --git a/src/systemc/ext/core/sc_process_handle.hh b/src/systemc/ext/core/sc_process_handle.hh
index b9bb9a0c4..c33bd78d5 100644
--- a/src/systemc/ext/core/sc_process_handle.hh
+++ b/src/systemc/ext/core/sc_process_handle.hh
@@ -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);
diff --git a/src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp b/src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp
index 5f5d99081..560643bc1 100644
--- a/src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp
+++ b/src/systemc/tests/systemc/bugs/constructor_throw/constructor_throw.cpp
@@ -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_,"");
}
};
diff --git a/src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp b/src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp
index 4e62c1091..c7a7f357c 100644
--- a/src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp
+++ b/src/systemc/tests/systemc/kernel/sc_time/test19/test19.cpp
@@ -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;