diff options
author | Gabe Black <gabeblack@google.com> | 2018-10-04 16:41:32 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-10-16 00:53:23 +0000 |
commit | f39a68fcca3643a0bda2ca965c432ad70402fbd9 (patch) | |
tree | 2a6abbd2ac3daef906d6e609a3af3694b27a933a /src/systemc/core | |
parent | 1618220d6d37e8ee8b374699898e5c5d3c5da0ed (diff) | |
download | gem5-f39a68fcca3643a0bda2ca965c432ad70402fbd9.tar.xz |
systemc: Fill out some error reporting in sc_port.
Rather than just asserting some invariants are true, report errors if
they aren't.
Change-Id: Id361b8a13011e1a75289ddddb6b41c1d09dbf794
Reviewed-on: https://gem5-review.googlesource.com/c/13296
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/sc_port.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/systemc/core/sc_port.cc b/src/systemc/core/sc_port.cc index 50a67a3b6..60911f8e1 100644 --- a/src/systemc/core/sc_port.cc +++ b/src/systemc/core/sc_port.cc @@ -27,6 +27,8 @@ * Authors: Gabe Black */ +#include <sstream> + #include "base/logging.hh" #include "systemc/core/module.hh" #include "systemc/core/port.hh" @@ -88,6 +90,16 @@ sc_port_base::warn_unimpl(const char *func) const warn("%s not implemented.\n", func); } +void +sc_port_base::report_error(const char *id, const char *add_msg) const +{ + std::ostringstream ss; + if (add_msg) + ss << add_msg << ": "; + ss << "port '" << name() << "' (" << kind() << ")"; + SC_REPORT_ERROR(id, ss.str().c_str()); +} + int sc_port_base::maxSize() const { return _gem5Port->maxSize(); } int sc_port_base::size() const { return _gem5Port->size(); } |