diff options
author | Brad Beckmann <Brad.Beckmann@amd.com> | 2009-11-18 13:55:58 -0800 |
---|---|---|
committer | Brad Beckmann <Brad.Beckmann@amd.com> | 2009-11-18 13:55:58 -0800 |
commit | 93f0069dd5d542883f93a75ca2d98a2008190693 (patch) | |
tree | 08f573b44757520409c5c395cee4395a4057e019 | |
parent | 204d1776caa17329b84e5ebbe50fca4f1e80c100 (diff) | |
download | gem5-93f0069dd5d542883f93a75ca2d98a2008190693.tar.xz |
ruby: getPort function fix
Fixed RubyMemory::getPort function to not pass in a -1 for the idx parameter
-rw-r--r-- | src/mem/rubymem.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mem/rubymem.cc b/src/mem/rubymem.cc index 9a1a7927d..74a6e390e 100644 --- a/src/mem/rubymem.cc +++ b/src/mem/rubymem.cc @@ -186,10 +186,19 @@ RubyMemory::getPort(const std::string &if_name, int idx) ruby_ports.size(), ruby_dma_ports.size()); + // + // By default, getPort will be passed an idx of -1. Of course this is an + // invalid ruby port index and must be a modified + // + if (idx == -1) { + idx = 0; + } + // Accept request for "functional" port for backwards compatibility // with places where this function is called from C++. I'd prefer // to move all these into Python someday. if (if_name == "functional") { + assert(idx < ruby_ports.size()); return new Port(csprintf("%s-functional", name()), this, ruby_ports[idx]); |