summaryrefslogtreecommitdiff
path: root/src/systemc/ext/channel
diff options
context:
space:
mode:
authorGabe Black <gabeblack@google.com>2018-10-07 05:23:49 -0700
committerGabe Black <gabeblack@google.com>2018-10-16 01:12:58 +0000
commite07f7efb75f0f7322d752608eb1cb1e1145b4a98 (patch)
treec70d86ba3130636fd8c6ff3c0d159727b81932c8 /src/systemc/ext/channel
parent3420f0e223888bf70cd502efb5a534e651891b5c (diff)
downloadgem5-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/ext/channel')
-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
6 files changed, 111 insertions, 17 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());
}
}