From ccd671c4891e79bbb2359089ffa494e06254b0af Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Thu, 23 Aug 2018 17:55:18 -0700 Subject: systemc: Implement positional binding. Change-Id: Ifbcd7e4148b82b9bf5241e040e812925daea3705 Reviewed-on: https://gem5-review.googlesource.com/12263 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/systemc/core/module.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'src/systemc/core/module.cc') 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 #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 &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() { -- cgit v1.2.3