systemc: Switch to using predefined messages for channels.
authorGabe Black <gabeblack@google.com>
Sun, 7 Oct 2018 12:23:49 +0000 (05:23 -0700)
committerGabe Black <gabeblack@google.com>
Tue, 16 Oct 2018 01:12:58 +0000 (01:12 +0000)
Create and use predefined messages for channels which match the ones
Accellera uses.

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

26 files changed:
src/systemc/channel/SConscript
src/systemc/channel/messages.cc [new file with mode: 0644]
src/systemc/channel/sc_clock.cc
src/systemc/channel/sc_inout_resolved.cc
src/systemc/channel/sc_semaphore.cc
src/systemc/channel/sc_signal.cc
src/systemc/core/port.cc
src/systemc/core/sc_export.cc
src/systemc/core/sc_interface.cc
src/systemc/core/sc_port.cc
src/systemc/core/sc_prim.cc
src/systemc/ext/channel/_channel.hh
src/systemc/ext/channel/_using.hh
src/systemc/ext/channel/messages.hh [new file with mode: 0644]
src/systemc/ext/channel/sc_fifo.hh
src/systemc/ext/channel/sc_in_rv.hh
src/systemc/ext/channel/sc_inout_rv.hh
src/systemc/ext/core/sc_event.hh
src/systemc/ext/core/sc_export.hh
src/systemc/ext/core/sc_port.hh
src/systemc/tests/include/specialized_signals/scx_signal_int.h
src/systemc/tests/include/specialized_signals/scx_signal_signed.h
src/systemc/tests/include/specialized_signals/scx_signal_uint.h
src/systemc/tests/include/specialized_signals/scx_signal_unsigned.h
src/systemc/tests/systemc/communication/sc_signal/check_writer/test16/expected_returncode [deleted file]
src/systemc/utils/sc_report_handler.cc

index fe79737700b252a639e67fb3956d18795fbed529..30ae76ab44bdc4873f01596b0b5dc5b570b1fcb9 100644 (file)
@@ -28,6 +28,7 @@
 Import('*')
 
 if env['USE_SYSTEMC']:
+    Source('messages.cc')
     Source('sc_clock.cc')
     Source('sc_event_queue.cc')
     Source('sc_in_resolved.cc')
diff --git a/src/systemc/channel/messages.cc b/src/systemc/channel/messages.cc
new file mode 100644 (file)
index 0000000..7bbda59
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * 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/channel/messages.hh"
+#include "systemc/utils/report.hh"
+
+namespace sc_core
+{
+
+const char SC_ID_PORT_OUTSIDE_MODULE_[] = "port specified outside of module";
+const char SC_ID_CLOCK_PERIOD_ZERO_[] = "sc_clock period is zero";
+const char SC_ID_CLOCK_HIGH_TIME_ZERO_[] = "sc_clock high time is zero";
+const char SC_ID_CLOCK_LOW_TIME_ZERO_[] = "sc_clock low time is zero";
+const char SC_ID_MORE_THAN_ONE_FIFO_READER_[] =
+    "sc_fifo<T> cannot have more than one reader";
+const char SC_ID_MORE_THAN_ONE_FIFO_WRITER_[] =
+    "sc_fifo<T> cannot have more than one writer";
+const char SC_ID_INVALID_FIFO_SIZE_[] =
+    "sc_fifo<T> must have a size of at least 1";
+const char SC_ID_BIND_IF_TO_PORT_[] = "bind interface to port failed";
+const char SC_ID_BIND_PORT_TO_PORT_[] = "bind parent port to port failed";
+const char SC_ID_COMPLETE_BINDING_[] = "complete binding failed";
+const char SC_ID_INSERT_PORT_[] = "insert port failed";
+const char SC_ID_REMOVE_PORT_[] = "remove port failed";
+const char SC_ID_GET_IF_[] = "get interface failed";
+const char SC_ID_INSERT_PRIM_CHANNEL_[] = "insert primitive channel failed";
+const char SC_ID_REMOVE_PRIM_CHANNEL_[] = "remove primitive channel failed";
+const char SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_[] =
+    "sc_signal<T> cannot have more than one driver";
+const char SC_ID_NO_DEFAULT_EVENT_[] = "channel doesn't have a default event";
+const char SC_ID_RESOLVED_PORT_NOT_BOUND_[] =
+    "resolved port not bound to resolved signal";
+const char SC_ID_FIND_EVENT_[] = "find event failed";
+const char SC_ID_INVALID_SEMAPHORE_VALUE_[] =
+    "sc_semaphore requires an initial value >= 0";
+const char SC_ID_SC_EXPORT_HAS_NO_INTERFACE_[] =
+    "sc_export instance has no interface";
+const char SC_ID_INSERT_EXPORT_[] = "insert sc_export failed";
+const char SC_ID_EXPORT_OUTSIDE_MODULE_[] =
+    "sc_export specified outside of module";
+const char SC_ID_SC_EXPORT_NOT_REGISTERED_[] =
+    "remove sc_export failed, sc_export not registered";
+const char SC_ID_SC_EXPORT_NOT_BOUND_AFTER_CONSTRUCTION_[] =
+    "sc_export instance not bound to interface at end of construction";
+const char SC_ID_ATTEMPT_TO_WRITE_TO_CLOCK_[] =
+    "attempt to write the value of an sc_clock instance";
+const char SC_ID_SC_EXPORT_ALREADY_BOUND_[] =
+    "sc_export instance already bound";
+const char SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_[] =
+    "attempted specalized signal operation on non-specialized signal";
+const char SC_ID_ATTEMPT_TO_BIND_CLOCK_TO_OUTPUT_[] =
+    "attempted to bind sc_clock instance to sc_inout or sc_out";
+const char SC_ID_NO_ASYNC_UPDATE_[] =
+    "this build has no asynchronous update support";
+
+namespace
+{
+
+sc_gem5::DefaultReportMessages predefinedMessages{
+    {100, SC_ID_PORT_OUTSIDE_MODULE_},
+    {101, SC_ID_CLOCK_PERIOD_ZERO_},
+    {102, SC_ID_CLOCK_HIGH_TIME_ZERO_},
+    {103, SC_ID_CLOCK_LOW_TIME_ZERO_},
+    {104, SC_ID_MORE_THAN_ONE_FIFO_READER_},
+    {105, SC_ID_MORE_THAN_ONE_FIFO_WRITER_},
+    {106, SC_ID_INVALID_FIFO_SIZE_},
+    {107, SC_ID_BIND_IF_TO_PORT_},
+    {108, SC_ID_BIND_PORT_TO_PORT_},
+    {109, SC_ID_COMPLETE_BINDING_},
+    {110, SC_ID_INSERT_PORT_},
+    {111, SC_ID_REMOVE_PORT_},
+    {112, SC_ID_GET_IF_},
+    {113, SC_ID_INSERT_PRIM_CHANNEL_},
+    {114, SC_ID_REMOVE_PRIM_CHANNEL_},
+    {115, SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_},
+    {116, SC_ID_NO_DEFAULT_EVENT_},
+    {117, SC_ID_RESOLVED_PORT_NOT_BOUND_},
+    {118, SC_ID_FIND_EVENT_},
+    {119, SC_ID_INVALID_SEMAPHORE_VALUE_},
+    {120, SC_ID_SC_EXPORT_HAS_NO_INTERFACE_},
+    {121, SC_ID_INSERT_EXPORT_},
+    {122, SC_ID_EXPORT_OUTSIDE_MODULE_},
+    {123, SC_ID_SC_EXPORT_NOT_REGISTERED_},
+    {124, SC_ID_SC_EXPORT_NOT_BOUND_AFTER_CONSTRUCTION_},
+    {125, SC_ID_ATTEMPT_TO_WRITE_TO_CLOCK_},
+    {126, SC_ID_SC_EXPORT_ALREADY_BOUND_},
+    {127, SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_},
+    {128, SC_ID_ATTEMPT_TO_BIND_CLOCK_TO_OUTPUT_},
+    {129, SC_ID_NO_ASYNC_UPDATE_}
+};
+
+} // anonymous namespace
+
+} // namespace sc_core
index 898e7b8660b0836d04c4fe964071ac9bfd6c62fa..7ab86eeb8b241a890562c9d8f7a76ae551b9240c 100644 (file)
@@ -35,6 +35,7 @@
 #include "systemc/core/process_types.hh"
 #include "systemc/core/sched_event.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/channel/messages.hh"
 #include "systemc/ext/channel/sc_clock.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name
@@ -113,21 +114,21 @@ sc_clock::sc_clock(const char *name, const sc_time &period,
         std::string msg =
             "increase the period: clock '" +
             std::string(name) + "'";
-        SC_REPORT_ERROR("(E101) sc_clock period is zero", msg.c_str());
+        SC_REPORT_ERROR(SC_ID_CLOCK_PERIOD_ZERO_, msg.c_str());
     }
 
     if (duty_cycle * period == SC_ZERO_TIME) {
         std::string msg =
             "increase the period or increase the duty cycle: clock '" +
             std::string(name) + "'";
-        SC_REPORT_ERROR("(E102) sc_clock high time is zero", msg.c_str());
+        SC_REPORT_ERROR(SC_ID_CLOCK_HIGH_TIME_ZERO_, msg.c_str());
     }
 
     if (duty_cycle * period == period) {
         std::string msg =
             "increase the period or decrease the duty cycle: clock '" +
             std::string(name) + "'";
-        SC_REPORT_ERROR("(E103) sc_clock low time is zero", msg.c_str());
+        SC_REPORT_ERROR(SC_ID_CLOCK_LOW_TIME_ZERO_, msg.c_str());
     }
 
     _gem5UpEdge = new ::sc_gem5::ClockTick(this, true, period);
index 2f3dd1883d1e39d61074a9a2ed443e00c3aaeaa7..3310e23de537e6af052cb6a16092d153b6d9db09 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include "base/logging.hh"
+#include "systemc/ext/channel/messages.hh"
 #include "systemc/ext/channel/sc_inout_resolved.hh"
 #include "systemc/ext/channel/sc_signal_resolved.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -49,8 +50,7 @@ sc_inout_resolved::end_of_elaboration()
     sc_inout<sc_dt::sc_logic>::end_of_elaboration();
     if (!dynamic_cast<sc_signal_resolved *>(get_interface())) {
         std::string msg = csprintf("port '%s' (%s)", name(), kind());
-        SC_REPORT_ERROR("(E117) resolved port not bound to resolved signal",
-                msg.c_str());
+        SC_REPORT_ERROR(SC_ID_RESOLVED_PORT_NOT_BOUND_, msg.c_str());
     }
 }
 
index 59191be4eef99fa4e12e25620d9f09a180c5c46e..9bace3964fd2f5ec48ec39ea0ab2f46e187814b4 100644 (file)
@@ -30,6 +30,7 @@
 #include <string>
 
 #include "base/logging.hh"
+#include "systemc/ext/channel/messages.hh"
 #include "systemc/ext/channel/sc_semaphore.hh"
 #include "systemc/ext/core/sc_module.hh" // for sc_gen_unique_name
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -46,8 +47,7 @@ sc_semaphore::sc_semaphore(const char *_name, int value) :
 {
     if (value < 0) {
         std::string msg = "semaphore '" + std::string(name()) + "'";
-        SC_REPORT_ERROR("(E119) sc_semaphore requires an initial value >= 0",
-                msg.c_str());
+        SC_REPORT_ERROR(SC_ID_INVALID_SEMAPHORE_VALUE_, msg.c_str());
     }
 }
 
index 14ee8a6e40bb12453f41f1bc25cbb9dd81f7e494..e3a3cf575beb402ed08aefd7fac6b456aef6521a 100644 (file)
@@ -30,6 +30,7 @@
 #include <sstream>
 
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/channel/messages.hh"
 #include "systemc/ext/channel/sc_signal.hh"
 #include "systemc/ext/core/sc_main.hh"
 
@@ -85,8 +86,7 @@ reportSignalError(ScSignalBase *sig, sc_core::sc_object *first,
         ss << "\n conflicting write in delta cycle " <<
             sc_core::sc_delta_count();
     }
-    SC_REPORT_ERROR(
-            "(E115) sc_signal<T> cannot have more than one driver",
+    SC_REPORT_ERROR(sc_core::SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_,
             ss.str().c_str());
 }
 
index e8a78323126732de1aa3f7f71ad881b283344b69..109d9df93a079cabe71e58510d39a6ae3930c307 100644 (file)
@@ -32,6 +32,7 @@
 #include "base/logging.hh"
 #include "systemc/core/process.hh"
 #include "systemc/core/sensitivity.hh"
+#include "systemc/ext/channel/messages.hh"
 #include "systemc/ext/channel/sc_signal_in_if.hh"
 
 namespace sc_gem5
@@ -129,23 +130,23 @@ Port::finalize()
         std::ostringstream ss;
         ss << size() << " binds exceeds maximum of " << maxSize() <<
             " allowed";
-        portBase->report_error(
-                "(E109) complete binding failed", ss.str().c_str());
+        portBase->report_error(sc_core::SC_ID_COMPLETE_BINDING_,
+                ss.str().c_str());
     }
 
     switch (portBase->_portPolicy()) {
       case sc_core::SC_ONE_OR_MORE_BOUND:
         if (size() == 0)
-            portBase->report_error(
-                    "(E109) complete binding failed", "port not bound");
+            portBase->report_error(sc_core::SC_ID_COMPLETE_BINDING_,
+                    "port not bound");
         break;
       case sc_core::SC_ALL_BOUND:
         if (size() < maxSize() || size() < 1) {
             std::stringstream ss;
             ss << size() << " actual binds is less than required " <<
                 maxSize();
-            portBase->report_error(
-                    "(E109) complete binding failed", ss.str().c_str());
+            portBase->report_error(sc_core::SC_ID_COMPLETE_BINDING_,
+                    ss.str().c_str());
         }
         break;
       case sc_core::SC_ZERO_OR_MORE_BOUND:
index 9123a25535cc173738a7e20273753a30a3802bee..a2cee316ca7f0792e4716b7ae903f27817bd4aa0 100644 (file)
@@ -30,6 +30,7 @@
 #include "base/logging.hh"
 #include "systemc/core/module.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/channel/messages.hh"
 #include "systemc/ext/core/sc_export.hh"
 #include "systemc/ext/core/sc_main.hh"
 
@@ -57,21 +58,17 @@ reportError(const char *id, const char *add_msg,
 sc_export_base::sc_export_base(const char *n) : sc_object(n)
 {
     if (sc_is_running()) {
-        reportError("(E121) insert sc_export failed", "simulation running",
-                name(), kind());
-    }
-    if (::sc_gem5::scheduler.elaborationDone()) {
-        reportError("(E121) insert sc_export failed", "elaboration done",
+        reportError(SC_ID_INSERT_EXPORT_, "simulation running",
                 name(), kind());
     }
+    if (::sc_gem5::scheduler.elaborationDone())
+        reportError(SC_ID_INSERT_EXPORT_, "elaboration done", name(), kind());
 
     auto m = sc_gem5::pickParentModule();
-    if (!m) {
-        reportError("(E122) sc_export specified outside of module",
-                nullptr, name(), kind());
-    } else {
+    if (!m)
+        reportError(SC_ID_EXPORT_OUTSIDE_MODULE_, nullptr, name(), kind());
+    else
         m->exports.push_back(this);
-    }
 }
 sc_export_base::~sc_export_base() {}
 
index 93aff6712affd7249b87860e70fabd9bcc7806a9..88b4487425a2dc1235c7f29a824189cf3920743d 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include "base/logging.hh"
+#include "systemc/ext/channel/messages.hh"
 #include "systemc/ext/core/sc_event.hh"
 #include "systemc/ext/core/sc_interface.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
@@ -40,7 +41,7 @@ void sc_interface::register_port(sc_port_base &, const char *) {}
 const sc_event &
 sc_interface::default_event() const
 {
-    SC_REPORT_WARNING("(W116) channel doesn't have a default event", "");
+    SC_REPORT_WARNING(SC_ID_NO_DEFAULT_EVENT_, "");
     static sc_gem5::InternalScEvent dummy;
     return dummy;
 }
index 60911f8e1c35e471d47420e598c1fb1442e16290..69fe6f579410655859e9d416709f224daa469d41 100644 (file)
@@ -33,6 +33,7 @@
 #include "systemc/core/module.hh"
 #include "systemc/core/port.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/channel/messages.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_port.hh"
 
@@ -61,21 +62,19 @@ sc_port_base::sc_port_base(const char *n, int max_size, sc_port_policy p) :
     sc_object(n), _gem5Port(nullptr)
 {
     if (sc_is_running()) {
-        reportError("(E110) insert port failed", "simulation running",
+        reportError(SC_ID_INSERT_PORT_, "simulation running",
                 name(), kind());
     }
     if (::sc_gem5::scheduler.elaborationDone()) {
-        reportError("(E110) insert port failed", "elaboration done",
+        reportError(SC_ID_INSERT_PORT_, "elaboration done",
                 name(), kind());
     }
 
     auto m = sc_gem5::pickParentModule();
-    if (!m) {
-        reportError("(E100) port specified outside of module",
-                nullptr, name(), kind());
-    } else {
+    if (!m)
+        reportError(SC_ID_PORT_OUTSIDE_MODULE_, nullptr, name(), kind());
+    else
         m->ports.push_back(this);
-    }
     _gem5Port = new ::sc_gem5::Port(this, max_size);
 }
 
index 099e5d8bfc4bb82cf23fd5424b94b75dd14fdf39..5dacc7f2f4b20083d7c3fe2a251da43a79b4f682 100644 (file)
@@ -30,6 +30,7 @@
 #include "base/logging.hh"
 #include "systemc/core/channel.hh"
 #include "systemc/core/scheduler.hh"
+#include "systemc/ext/channel/messages.hh"
 #include "systemc/ext/core/sc_main.hh"
 #include "systemc/ext/core/sc_prim.hh"
 
@@ -46,12 +47,10 @@ namespace sc_core
 sc_prim_channel::sc_prim_channel() : _gem5_channel(nullptr)
 {
     if (sc_is_running()) {
-        SC_REPORT_ERROR("(E113) insert primitive channel failed",
-                "simulation running");
+        SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "simulation running");
     }
     if (::sc_gem5::scheduler.elaborationDone()) {
-        SC_REPORT_ERROR("(E113) insert primitive channel failed",
-                "elaboration done");
+        SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "elaboration done");
     }
     _gem5_channel = new sc_gem5::Channel(this);
 }
@@ -60,12 +59,10 @@ sc_prim_channel::sc_prim_channel(const char *_name) :
     sc_object(_name), _gem5_channel(nullptr)
 {
     if (sc_is_running()) {
-        SC_REPORT_ERROR("(E113) insert primitive channel failed",
-                "simulation running");
+        SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "simulation running");
     }
     if (::sc_gem5::scheduler.elaborationDone()) {
-        SC_REPORT_ERROR("(E113) insert primitive channel failed",
-                "elaboration done");
+        SC_REPORT_ERROR(SC_ID_INSERT_PRIM_CHANNEL_, "elaboration done");
     }
     _gem5_channel = new sc_gem5::Channel(this);
 }
index d95cfc2446580df01fb54835f2c6f16c8c83b052..390ea15a6a812d0334991c03a05f0fb72376b5d9 100644 (file)
@@ -30,6 +30,7 @@
 #ifndef __SYSTEMC_EXT_CHANNEL__CHANNEL_HH__
 #define __SYSTEMC_EXT_CHANNEL__CHANNEL_HH__
 
+#include "messages.hh"
 #include "sc_buffer.hh"
 #include "sc_clock.hh"
 #include "sc_event_queue.hh"
index e582ea2828a4d3e02d017533c0d697973b8c4d81..e59cde355054963598ac26a1a1e4a44e00ed8850 100644 (file)
@@ -97,4 +97,35 @@ using sc_core::sc_signal_resolved;
 
 using sc_core::sc_signal_rv;
 
+using sc_core::SC_ID_PORT_OUTSIDE_MODULE_;
+using sc_core::SC_ID_CLOCK_PERIOD_ZERO_;
+using sc_core::SC_ID_CLOCK_HIGH_TIME_ZERO_;
+using sc_core::SC_ID_CLOCK_LOW_TIME_ZERO_;
+using sc_core::SC_ID_MORE_THAN_ONE_FIFO_READER_;
+using sc_core::SC_ID_MORE_THAN_ONE_FIFO_WRITER_;
+using sc_core::SC_ID_INVALID_FIFO_SIZE_;
+using sc_core::SC_ID_BIND_IF_TO_PORT_;
+using sc_core::SC_ID_BIND_PORT_TO_PORT_;
+using sc_core::SC_ID_COMPLETE_BINDING_;
+using sc_core::SC_ID_INSERT_PORT_;
+using sc_core::SC_ID_REMOVE_PORT_;
+using sc_core::SC_ID_GET_IF_;
+using sc_core::SC_ID_INSERT_PRIM_CHANNEL_;
+using sc_core::SC_ID_REMOVE_PRIM_CHANNEL_;
+using sc_core::SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_;
+using sc_core::SC_ID_NO_DEFAULT_EVENT_;
+using sc_core::SC_ID_RESOLVED_PORT_NOT_BOUND_;
+using sc_core::SC_ID_FIND_EVENT_;
+using sc_core::SC_ID_INVALID_SEMAPHORE_VALUE_;
+using sc_core::SC_ID_SC_EXPORT_HAS_NO_INTERFACE_;
+using sc_core::SC_ID_INSERT_EXPORT_;
+using sc_core::SC_ID_EXPORT_OUTSIDE_MODULE_;
+using sc_core::SC_ID_SC_EXPORT_NOT_REGISTERED_;
+using sc_core::SC_ID_SC_EXPORT_NOT_BOUND_AFTER_CONSTRUCTION_;
+using sc_core::SC_ID_ATTEMPT_TO_WRITE_TO_CLOCK_;
+using sc_core::SC_ID_SC_EXPORT_ALREADY_BOUND_;
+using sc_core::SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_;
+using sc_core::SC_ID_ATTEMPT_TO_BIND_CLOCK_TO_OUTPUT_;
+using sc_core::SC_ID_NO_ASYNC_UPDATE_;
+
 #endif  //__SYSTEMC_EXT_CHANNEL__USING_HH__
diff --git a/src/systemc/ext/channel/messages.hh b/src/systemc/ext/channel/messages.hh
new file mode 100644 (file)
index 0000000..fe36f46
--- /dev/null
@@ -0,0 +1,69 @@
+/*
+ * 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_CHANNEL_MESSAGES_HH__
+#define __SYSTEMC_EXT_CHANNEL_MESSAGES_HH__
+
+namespace sc_core
+{
+
+extern const char SC_ID_PORT_OUTSIDE_MODULE_[];
+extern const char SC_ID_CLOCK_PERIOD_ZERO_[];
+extern const char SC_ID_CLOCK_HIGH_TIME_ZERO_[];
+extern const char SC_ID_CLOCK_LOW_TIME_ZERO_[];
+extern const char SC_ID_MORE_THAN_ONE_FIFO_READER_[];
+extern const char SC_ID_MORE_THAN_ONE_FIFO_WRITER_[];
+extern const char SC_ID_INVALID_FIFO_SIZE_[];
+extern const char SC_ID_BIND_IF_TO_PORT_[];
+extern const char SC_ID_BIND_PORT_TO_PORT_[];
+extern const char SC_ID_COMPLETE_BINDING_[];
+extern const char SC_ID_INSERT_PORT_[];
+extern const char SC_ID_REMOVE_PORT_[];
+extern const char SC_ID_GET_IF_[];
+extern const char SC_ID_INSERT_PRIM_CHANNEL_[];
+extern const char SC_ID_REMOVE_PRIM_CHANNEL_[];
+extern const char SC_ID_MORE_THAN_ONE_SIGNAL_DRIVER_[];
+extern const char SC_ID_NO_DEFAULT_EVENT_[];
+extern const char SC_ID_RESOLVED_PORT_NOT_BOUND_[];
+extern const char SC_ID_FIND_EVENT_[];
+extern const char SC_ID_INVALID_SEMAPHORE_VALUE_[];
+extern const char SC_ID_SC_EXPORT_HAS_NO_INTERFACE_[];
+extern const char SC_ID_INSERT_EXPORT_[];
+extern const char SC_ID_EXPORT_OUTSIDE_MODULE_[];
+extern const char SC_ID_SC_EXPORT_NOT_REGISTERED_[];
+extern const char SC_ID_SC_EXPORT_NOT_BOUND_AFTER_CONSTRUCTION_[];
+extern const char SC_ID_ATTEMPT_TO_WRITE_TO_CLOCK_[];
+extern const char SC_ID_SC_EXPORT_ALREADY_BOUND_[];
+extern const char SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_[];
+extern const char SC_ID_ATTEMPT_TO_BIND_CLOCK_TO_OUTPUT_[];
+extern const char SC_ID_NO_ASYNC_UPDATE_[];
+
+} // namespace sc_core
+
+#endif  // __SYSTEMC_EXT_CHANNEL_MESSAGES_HH__
index a1c454a8fa29b7fb5baed15fc18297c1f0a5fc54..0c83f6692cef81bfe31e16fc9977a87020977f62 100644 (file)
@@ -36,6 +36,7 @@
 #include "../core/sc_module.hh" // for sc_gen_unique_name
 #include "../core/sc_prim.hh"
 #include "../utils/sc_report_handler.hh"
+#include "messages.hh"
 #include "sc_fifo_in_if.hh"
 #include "sc_fifo_out_if.hh"
 
@@ -69,22 +70,16 @@ class sc_fifo : public sc_fifo_in_if<T>,
         std::string tn(iface_type_name);
         if (tn == typeid(sc_fifo_in_if<T>).name() ||
                 tn == typeid(sc_fifo_blocking_in_if<T>).name()) {
-            if (_reader) {
-                SC_REPORT_ERROR(
-                        "(E104) sc_fifo<T> cannot have more than one reader",
-                        "");
-            }
+            if (_reader)
+                SC_REPORT_ERROR(SC_ID_MORE_THAN_ONE_FIFO_READER_, "");
             _reader = &port;
         } else if (tn == typeid(sc_fifo_out_if<T>).name() ||
                 tn == typeid(sc_fifo_blocking_out_if<T>).name()) {
-            if (_writer) {
-                SC_REPORT_ERROR(
-                        "(E105) sc_fifo<T> cannot have more than one writer",
-                        "");
-            }
+            if (_writer)
+                SC_REPORT_ERROR(SC_ID_MORE_THAN_ONE_FIFO_WRITER_, "");
             _writer = &port;
         } else {
-            SC_REPORT_ERROR("(E107) bind interface to port failed",
+            SC_REPORT_ERROR(SC_ID_BIND_IF_TO_PORT_,
                     "sc_fifo<T> port not recognized");
         }
     }
index 278b95864c56949a68bd7303916dfc9b30cbda63..b963bfdfc1ed778c982869507d33a9051823693a 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <sstream>
 
+#include "messages.hh"
 #include "sc_in.hh"
 #include "sc_signal_rv.hh"
 
@@ -61,9 +62,7 @@ class sc_in_rv : public sc_in<sc_dt::sc_lv<W>>
         if (!dynamic_cast<sc_signal_rv<W> *>(this->get_interface())) {
             std::ostringstream ss;
             ss << "port '" << this->name() << "' (" << this->kind() << ")";
-            SC_REPORT_ERROR(
-                    "(E117) resolved port not bound to resolved signal",
-                    ss.str().c_str());
+            SC_REPORT_ERROR(SC_ID_RESOLVED_PORT_NOT_BOUND_, ss.str().c_str());
         }
     }
 
index 54f54ff7c311f51b5fc502c53aedaa2f56e8e2ca..d91a48b78c7d01343a53592b104bfcb2404b13fc 100644 (file)
@@ -33,6 +33,7 @@
 #include <sstream>
 
 #include "../core/sc_port.hh"
+#include "messages.hh"
 #include "sc_signal_in_if.hh"
 #include "sc_signal_inout_if.hh"
 #include "sc_signal_rv.hh"
@@ -94,9 +95,7 @@ class sc_inout_rv : public sc_inout<sc_dt::sc_lv<W>>
         if (!dynamic_cast<sc_signal_rv<W> *>(this->get_interface())) {
             std::ostringstream ss;
             ss << "port '" << this->name() << "' (" << this->kind() << ")";
-            SC_REPORT_ERROR(
-                    "(E117) resolved port not bound to resolved signal",
-                    ss.str().c_str());
+            SC_REPORT_ERROR(SC_ID_RESOLVED_PORT_NOT_BOUND_, ss.str().c_str());
         }
     }
 
index 90fd41f2a36a36fccda3cdfdaa288960549dc69e..56ee24f76b414fa77e60ad6b3c563007c47ae9d6 100644 (file)
@@ -35,6 +35,7 @@
 #include <sstream>
 #include <vector>
 
+#include "../channel/messages.hh"
 #include "../utils/sc_report_handler.hh"
 #include "sc_port.hh"
 #include "sc_time.hh"
@@ -247,7 +248,7 @@ class sc_event_finder_t : public sc_event_finder
             std::ostringstream ss;
             ss << "port is not bound: port '" << _port->name() << "' (" <<
                 _port->kind() << ")";
-            SC_REPORT_ERROR("(E118) find event failed", ss.str().c_str());
+            SC_REPORT_ERROR(SC_ID_FIND_EVENT_, ss.str().c_str());
             return none;
         }
         return (const_cast<IF *>(iface)->*_method)();
index e36e34ae918fe54d9a7717e0affe878f03c9db02..100ce66db4c5c8b94541284ace7186c6e5560ea5 100644 (file)
@@ -30,6 +30,7 @@
 #ifndef __SYSTEMC_EXT_CORE_SC_EXPORT_HH__
 #define __SYSTEMC_EXT_CORE_SC_EXPORT_HH__
 
+#include "../channel/messages.hh"
 #include "../utils/sc_report_handler.hh"
 #include "sc_module.hh" // for sc_gen_unique_name
 #include "sc_object.hh"
@@ -76,17 +77,15 @@ class sc_export : public sc_export_base
     bind(IF &i)
     {
         if (interface) {
-            SC_REPORT_ERROR("(E126) sc_export instance already bound", name());
+            SC_REPORT_ERROR(SC_ID_SC_EXPORT_ALREADY_BOUND_, name());
             return;
         }
         interface = &i;
     }
     operator IF & ()
     {
-        if (!interface) {
-            SC_REPORT_ERROR("(E120) sc_export instance has no interface",
-                    name());
-        }
+        if (!interface)
+            SC_REPORT_ERROR(SC_ID_SC_EXPORT_HAS_NO_INTERFACE_, name());
         return *interface;
     }
     operator const IF & () const { return *interface; }
@@ -94,19 +93,15 @@ class sc_export : public sc_export_base
     IF *
     operator -> ()
     {
-        if (!interface) {
-            SC_REPORT_ERROR("(E120) sc_export instance has no interface",
-                    name());
-        }
+        if (!interface)
+            SC_REPORT_ERROR(SC_ID_SC_EXPORT_HAS_NO_INTERFACE_, name());
         return interface;
     }
     const IF *
     operator -> () const
     {
-        if (!interface) {
-            SC_REPORT_ERROR("(E120) sc_export instance has no interface",
-                    name());
-        }
+        if (!interface)
+            SC_REPORT_ERROR(SC_ID_SC_EXPORT_HAS_NO_INTERFACE_, name());
         return interface;
     }
 
index aa9a322b8ee3c6981df8e1fc2975f49fda2fe802..c4160bafee87dabaec07f2549dfbe445d0a4475f 100644 (file)
@@ -33,6 +33,7 @@
 #include <typeinfo>
 #include <vector>
 
+#include "../channel/messages.hh"
 #include "../utils/sc_report_handler.hh"
 #include "sc_module.hh" // for sc_gen_unique_name
 #include "sc_object.hh"
@@ -129,7 +130,7 @@ class sc_port_b : public sc_port_base
     operator -> ()
     {
         if (_interfaces.empty()) {
-            report_error("(E112) get interface failed", "port is not bound");
+            report_error(SC_ID_GET_IF_, "port is not bound");
             sc_abort();
         }
         return _interfaces[0];
@@ -138,7 +139,7 @@ class sc_port_b : public sc_port_base
     operator -> () const
     {
         if (_interfaces.empty()) {
-            report_error("(E112) get interface failed", "port is not bound");
+            report_error(SC_ID_GET_IF_, "port is not bound");
             sc_abort();
         }
         return _interfaces[0];
@@ -148,7 +149,7 @@ class sc_port_b : public sc_port_base
     operator [] (int n)
     {
         if (n < 0 || n >= size()) {
-            report_error("(E112) get interface failed", "index out of range");
+            report_error(SC_ID_GET_IF_, "index out of range");
             return NULL;
         }
         return _interfaces[n];
@@ -157,7 +158,7 @@ class sc_port_b : public sc_port_base
     operator [] (int n) const
     {
         if (n < 0 || n >= size()) {
-            report_error("(E112) get interface failed", "index out of range");
+            report_error(SC_ID_GET_IF_, "index out of range");
             return NULL;
         }
         return _interfaces[n];
@@ -219,7 +220,7 @@ class sc_port_b : public sc_port_base
     _gem5Interface(int n) const
     {
         if (n < 0 || n >= size()) {
-            report_error("(E112) get interface failed", "index out of range");
+            report_error(SC_ID_GET_IF_, "index out of range");
             return NULL;
         }
         return _interfaces[n];
@@ -231,7 +232,7 @@ class sc_port_b : public sc_port_base
         sc_assert(interface);
         for (int i = 0; i < _interfaces.size(); i++) {
             if (interface == _interfaces[i]) {
-                report_error("(E107) bind interface to port failed",
+                report_error(SC_ID_BIND_IF_TO_PORT_,
                         "interface already bound to port");
             }
         }
index 050521de0b4f15a6edde5fd4a0a641bff6c2cdb8..b853acd1803c5a1b3a97b71fc5865ead7d70c391 100644 (file)
@@ -1556,26 +1556,22 @@ sc_vpool<sc_int_sigref> sc_int_sigref::m_pool(8);
 
 sc_dt::sc_int_base* sc_int_part_if::part_read_target()
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return 0;
 }
 sc_dt::uint64 sc_int_part_if::read_part( int /*left*/, int /*right*/ ) const
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return 0;
 }
 sc_int_sigref& sc_int_part_if::select_part( int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return *(sc_int_sigref*)0;
 }
 void sc_int_part_if::write_part( sc_dt::uint64 v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 
 
index bb48cecb396aa0a32e2de97105d1093bf1453fe6..baa6dd9ac1975b0f9aca566031cb6cf6b21be7ef 100644 (file)
@@ -1744,43 +1744,36 @@ sc_vpool<sc_signed_sigref> sc_signed_sigref::m_pool(8);
 
 sc_signed* sc_signed_part_if::part_read_target()
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return 0;
 }
 sc_signed sc_signed_part_if::read_part( int /*left*/, int /*right*/ ) const
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return sc_signed(1);
 }
 sc_signed_sigref& sc_signed_part_if::select_part( int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return *(sc_signed_sigref*)0;
 }
 void sc_signed_part_if::write_part( int64 v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 void sc_signed_part_if::write_part( uint64 v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 void sc_signed_part_if::write_part(
     const sc_signed& v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 void sc_signed_part_if::write_part(
     const sc_unsigned& v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 
 
index acc4a42199b741499242f8b889624d4ecfdb6427..a0ad01b450fe0581049bd58db5ce616ebd052140 100644 (file)
@@ -1604,26 +1604,22 @@ sc_vpool<sc_uint_sigref> sc_uint_sigref::m_pool(8);
 
 sc_dt::sc_uint_base* sc_uint_part_if::part_read_target()
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return 0;
 }
 sc_dt::uint64 sc_uint_part_if::read_part( int /*left*/, int /*right*/ ) const
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return 0;
 }
 sc_uint_sigref& sc_uint_part_if::select_part( int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return *(sc_uint_sigref*)0;
 }
 void sc_uint_part_if::write_part( sc_dt::uint64 v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 
 //------------------------------------------------------------------------------
index a356d44bdca382c55fe6a599504b9bfccf02c73f..7cfc409c181b3cc8a3396343ed254ce66fd30ae2 100644 (file)
@@ -1743,43 +1743,36 @@ sc_vpool<sc_unsigned_sigref> sc_unsigned_sigref::m_pool(8);
 //------------------------------------------------------------------------------
 sc_dt::sc_unsigned* sc_unsigned_part_if::part_read_target()
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return 0;
 }
 sc_dt::sc_unsigned sc_unsigned_part_if::read_part( int /*left*/, int /*right*/ ) const
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return sc_dt::sc_unsigned(1);
 }
 sc_unsigned_sigref& sc_unsigned_part_if::select_part(int /*left*/, int /*right*/)
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
     return *(sc_unsigned_sigref*)0;
 }
 void sc_unsigned_part_if::write_part( sc_dt::int64 v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 void sc_unsigned_part_if::write_part( sc_dt::uint64 v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 void sc_unsigned_part_if::write_part(
     const sc_dt::sc_signed& v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 void sc_unsigned_part_if::write_part(
     const sc_dt::sc_unsigned& v, int /*left*/, int /*right*/ )
 {
-    SC_REPORT_ERROR( "attempted specalized signal operation on "
-            "non-specialized signal", "int" );
+    SC_REPORT_ERROR( SC_ID_OPERATION_ON_NON_SPECIALIZED_SIGNAL_, "int" );
 }
 
 
diff --git a/src/systemc/tests/systemc/communication/sc_signal/check_writer/test16/expected_returncode b/src/systemc/tests/systemc/communication/sc_signal/check_writer/test16/expected_returncode
deleted file mode 100644 (file)
index d00491f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-1
index 1b725cc0f91046218cacd1d22e0e032d2fe7347c..a2b915ed1115660693353050aeae82c2e5241eca 100644 (file)
@@ -36,6 +36,7 @@
 #include "systemc/core/process.hh"
 #include "systemc/core/scheduler.hh"
 #include "systemc/ext/core/sc_main.hh"
+#include "systemc/ext/utils/messages.hh"
 #include "systemc/ext/utils/sc_report_handler.hh"
 #include "systemc/utils/report.hh"
 
@@ -62,6 +63,9 @@ sc_report_handler::report(sc_severity severity, const char *msg_type,
                           const char *msg, int verbosity, const char *file,
                           int line)
 {
+    if (!msg_type)
+        msg_type = SC_ID_UNKNOWN_ERROR_;
+
     if (severity == SC_INFO && verbosity > sc_gem5::reportVerbosityLevel)
         return;
 
@@ -127,6 +131,9 @@ sc_report_handler::set_actions(sc_severity severity, sc_actions actions)
 sc_actions
 sc_report_handler::set_actions(const char *msg_type, sc_actions actions)
 {
+    if (!msg_type)
+        msg_type = SC_ID_UNKNOWN_ERROR_;
+
     sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
     sc_actions previous = info.actions;
     info.actions = actions;
@@ -137,6 +144,9 @@ sc_actions
 sc_report_handler::set_actions(
         const char *msg_type, sc_severity severity, sc_actions actions)
 {
+    if (!msg_type)
+        msg_type = SC_ID_UNKNOWN_ERROR_;
+
     sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
     sc_actions previous = info.sevActions[severity];
     info.sevActions[severity] = actions;
@@ -155,6 +165,9 @@ sc_report_handler::stop_after(sc_severity severity, int limit)
 int
 sc_report_handler::stop_after(const char *msg_type, int limit)
 {
+    if (!msg_type)
+        msg_type = SC_ID_UNKNOWN_ERROR_;
+
     sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
     int previous = info.limit;
     info.limit = limit;
@@ -165,6 +178,9 @@ int
 sc_report_handler::stop_after(
         const char *msg_type, sc_severity severity, int limit)
 {
+    if (!msg_type)
+        msg_type = SC_ID_UNKNOWN_ERROR_;
+
     sc_gem5::ReportMsgInfo &info = sc_gem5::reportMsgInfoMap[msg_type];
     int previous = info.sevLimits[severity];
     info.sevLimits[severity] = limit;
@@ -180,12 +196,18 @@ sc_report_handler::get_count(sc_severity severity)
 int
 sc_report_handler::get_count(const char *msg_type)
 {
+    if (!msg_type)
+        msg_type = SC_ID_UNKNOWN_ERROR_;
+
     return sc_gem5::reportMsgInfoMap[msg_type].count;
 }
 
 int
 sc_report_handler::get_count(const char *msg_type, sc_severity severity)
 {
+    if (!msg_type)
+        msg_type = SC_ID_UNKNOWN_ERROR_;
+
     return sc_gem5::reportMsgInfoMap[msg_type].sevCounts[severity];
 }