Import('*')
if env['USE_SYSTEMC']:
+ Source('messages.cc')
Source('sc_clock.cc')
Source('sc_event_queue.cc')
Source('sc_in_resolved.cc')
--- /dev/null
+/*
+ * 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
#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
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);
*/
#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"
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());
}
}
#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"
{
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());
}
}
#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"
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());
}
#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
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:
#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"
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() {}
*/
#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"
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;
}
#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"
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);
}
#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"
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);
}
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);
}
#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"
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__
--- /dev/null
+/*
+ * 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__
#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"
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");
}
}
#include <sstream>
+#include "messages.hh"
#include "sc_in.hh"
#include "sc_signal_rv.hh"
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());
}
}
#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"
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());
}
}
#include <sstream>
#include <vector>
+#include "../channel/messages.hh"
#include "../utils/sc_report_handler.hh"
#include "sc_port.hh"
#include "sc_time.hh"
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)();
#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"
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; }
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;
}
#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"
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];
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];
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];
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];
_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];
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");
}
}
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" );
}
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" );
}
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" );
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
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" );
}
#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"
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;
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;
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;
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;
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;
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];
}