summaryrefslogtreecommitdiff
path: root/src/systemc/ext
diff options
context:
space:
mode:
Diffstat (limited to 'src/systemc/ext')
-rw-r--r--src/systemc/ext/channel/_channel.hh1
-rw-r--r--src/systemc/ext/channel/_using.hh31
-rw-r--r--src/systemc/ext/channel/messages.hh69
-rw-r--r--src/systemc/ext/channel/sc_fifo.hh17
-rw-r--r--src/systemc/ext/channel/sc_in_rv.hh5
-rw-r--r--src/systemc/ext/channel/sc_inout_rv.hh5
-rw-r--r--src/systemc/ext/core/sc_event.hh3
-rw-r--r--src/systemc/ext/core/sc_export.hh21
-rw-r--r--src/systemc/ext/core/sc_port.hh13
9 files changed, 128 insertions, 37 deletions
diff --git a/src/systemc/ext/channel/_channel.hh b/src/systemc/ext/channel/_channel.hh
index d95cfc244..390ea15a6 100644
--- a/src/systemc/ext/channel/_channel.hh
+++ b/src/systemc/ext/channel/_channel.hh
@@ -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"
diff --git a/src/systemc/ext/channel/_using.hh b/src/systemc/ext/channel/_using.hh
index e582ea282..e59cde355 100644
--- a/src/systemc/ext/channel/_using.hh
+++ b/src/systemc/ext/channel/_using.hh
@@ -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
index 000000000..fe36f467c
--- /dev/null
+++ b/src/systemc/ext/channel/messages.hh
@@ -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__
diff --git a/src/systemc/ext/channel/sc_fifo.hh b/src/systemc/ext/channel/sc_fifo.hh
index a1c454a8f..0c83f6692 100644
--- a/src/systemc/ext/channel/sc_fifo.hh
+++ b/src/systemc/ext/channel/sc_fifo.hh
@@ -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");
}
}
diff --git a/src/systemc/ext/channel/sc_in_rv.hh b/src/systemc/ext/channel/sc_in_rv.hh
index 278b95864..b963bfdfc 100644
--- a/src/systemc/ext/channel/sc_in_rv.hh
+++ b/src/systemc/ext/channel/sc_in_rv.hh
@@ -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());
}
}
diff --git a/src/systemc/ext/channel/sc_inout_rv.hh b/src/systemc/ext/channel/sc_inout_rv.hh
index 54f54ff7c..d91a48b78 100644
--- a/src/systemc/ext/channel/sc_inout_rv.hh
+++ b/src/systemc/ext/channel/sc_inout_rv.hh
@@ -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());
}
}
diff --git a/src/systemc/ext/core/sc_event.hh b/src/systemc/ext/core/sc_event.hh
index 90fd41f2a..56ee24f76 100644
--- a/src/systemc/ext/core/sc_event.hh
+++ b/src/systemc/ext/core/sc_event.hh
@@ -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)();
diff --git a/src/systemc/ext/core/sc_export.hh b/src/systemc/ext/core/sc_export.hh
index e36e34ae9..100ce66db 100644
--- a/src/systemc/ext/core/sc_export.hh
+++ b/src/systemc/ext/core/sc_export.hh
@@ -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;
}
diff --git a/src/systemc/ext/core/sc_port.hh b/src/systemc/ext/core/sc_port.hh
index aa9a322b8..c4160bafe 100644
--- a/src/systemc/ext/core/sc_port.hh
+++ b/src/systemc/ext/core/sc_port.hh
@@ -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");
}
}