diff options
author | Gabe Black <gabeblack@google.com> | 2018-08-23 17:55:18 -0700 |
---|---|---|
committer | Gabe Black <gabeblack@google.com> | 2018-09-26 00:01:23 +0000 |
commit | ccd671c4891e79bbb2359089ffa494e06254b0af (patch) | |
tree | cfacb715bc484460b777458d2c45a42f06fb9d9b /src/systemc/core/module.cc | |
parent | abb7d288e9e278a0e7428846909c2d5c790c5e3a (diff) | |
download | gem5-ccd671c4891e79bbb2359089ffa494e06254b0af.tar.xz |
systemc: Implement positional binding.
Change-Id: Ifbcd7e4148b82b9bf5241e040e812925daea3705
Reviewed-on: https://gem5-review.googlesource.com/12263
Reviewed-by: Gabe Black <gabeblack@google.com>
Maintainer: Gabe Black <gabeblack@google.com>
Diffstat (limited to 'src/systemc/core/module.cc')
-rw-r--r-- | src/systemc/core/module.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/systemc/core/module.cc b/src/systemc/core/module.cc index 0c118e0c5..78ce2c6fb 100644 --- a/src/systemc/core/module.cc +++ b/src/systemc/core/module.cc @@ -32,6 +32,7 @@ #include <cassert> #include "base/logging.hh" +#include "systemc/ext/core/sc_port.hh" #include "systemc/ext/utils/sc_report_handler.hh" namespace sc_gem5 @@ -85,6 +86,25 @@ Module::pop() _modules.pop_back(); } +void +Module::bindPorts(std::vector<const ::sc_core::sc_bind_proxy *> &proxies) +{ + panic_if(proxies.size() > ports.size(), + "Trying to bind %d interfaces/ports to %d ports.\n", + proxies.size(), ports.size()); + + auto proxyIt = proxies.begin(); + auto portIt = ports.begin(); + for (; proxyIt != proxies.end(); proxyIt++, portIt++) { + auto proxy = *proxyIt; + auto port = *portIt; + if (proxy->interface()) + port->vbind(*proxy->interface()); + else + port->vbind(*proxy->port()); + } +} + Module * currentModule() { |