diff options
author | Gabe Black <gabeblack@google.com> | 2018-09-15 16:20:27 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-10-16 00:23:20 +0000 |
commit | 509b1b8439050231f50ae12397b59aa06df5fba9 (patch) | |
tree | f06efc693700752567868762f12c5757932c009b /src/systemc/core | |
parent | 170b9f90c2d2b40114da8b95fd0a2562013353cf (diff) | |
download | gem5-509b1b8439050231f50ae12397b59aa06df5fba9.tar.xz |
systemc: Add an error check whether an interface is alread bound to a port.
Change-Id: I06e3484176c0c06daa28f7be0ed8437b3b15ddb2
Reviewed-on: https://gem5-review.googlesource.com/c/12816
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.hh | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/systemc/core/port.hh b/src/systemc/core/port.hh index 15e7bbed1..217269d86 100644 --- a/src/systemc/core/port.hh +++ b/src/systemc/core/port.hh @@ -33,6 +33,7 @@ #include <list> #include <vector> +#include "base/cprintf.hh" #include "systemc/ext/core/sc_interface.hh" #include "systemc/ext/core/sc_port.hh" @@ -59,10 +60,19 @@ class Port void finalizeFinder(StaticSensitivityFinder *finder); void - addInterface(::sc_core::sc_interface *i) + addInterface(::sc_core::sc_interface *iface) { + for (int i = 0; i < _size; i++) { + if (getInterface(i) == iface) { + std::string msg = + csprintf("interface already bound to port: port '%s' (%s)", + portBase->name(), portBase->kind()); + SC_REPORT_ERROR("(E107) bind interface to port failed", + msg.c_str()); + } + } _size++; - portBase->_gem5AddInterface(i); + portBase->_gem5AddInterface(iface); } void |