diff options
author | Gabe Black <gabeblack@google.com> | 2018-10-07 05:23:49 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-10-16 01:12:58 +0000 |
commit | e07f7efb75f0f7322d752608eb1cb1e1145b4a98 (patch) | |
tree | c70d86ba3130636fd8c6ff3c0d159727b81932c8 /src/systemc/core | |
parent | 3420f0e223888bf70cd502efb5a534e651891b5c (diff) | |
download | gem5-e07f7efb75f0f7322d752608eb1cb1e1145b4a98.tar.xz |
systemc: Switch to using predefined messages for channels.
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>
Diffstat (limited to 'src/systemc/core')
-rw-r--r-- | src/systemc/core/port.cc | 13 | ||||
-rw-r--r-- | src/systemc/core/sc_export.cc | 17 | ||||
-rw-r--r-- | src/systemc/core/sc_interface.cc | 3 | ||||
-rw-r--r-- | src/systemc/core/sc_port.cc | 13 | ||||
-rw-r--r-- | src/systemc/core/sc_prim.cc | 13 |
5 files changed, 27 insertions, 32 deletions
diff --git a/src/systemc/core/port.cc b/src/systemc/core/port.cc index e8a783231..109d9df93 100644 --- a/src/systemc/core/port.cc +++ b/src/systemc/core/port.cc @@ -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: diff --git a/src/systemc/core/sc_export.cc b/src/systemc/core/sc_export.cc index 9123a2553..a2cee316c 100644 --- a/src/systemc/core/sc_export.cc +++ b/src/systemc/core/sc_export.cc @@ -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() {} diff --git a/src/systemc/core/sc_interface.cc b/src/systemc/core/sc_interface.cc index 93aff6712..88b448742 100644 --- a/src/systemc/core/sc_interface.cc +++ b/src/systemc/core/sc_interface.cc @@ -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; } diff --git a/src/systemc/core/sc_port.cc b/src/systemc/core/sc_port.cc index 60911f8e1..69fe6f579 100644 --- a/src/systemc/core/sc_port.cc +++ b/src/systemc/core/sc_port.cc @@ -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); } diff --git a/src/systemc/core/sc_prim.cc b/src/systemc/core/sc_prim.cc index 099e5d8bf..5dacc7f2f 100644 --- a/src/systemc/core/sc_prim.cc +++ b/src/systemc/core/sc_prim.cc @@ -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); } |