diff options
Diffstat (limited to 'src/cpu/testers/rubytest/RubyTester.cc')
-rw-r--r-- | src/cpu/testers/rubytest/RubyTester.cc | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/cpu/testers/rubytest/RubyTester.cc b/src/cpu/testers/rubytest/RubyTester.cc index 81bb93253..70ee40aed 100644 --- a/src/cpu/testers/rubytest/RubyTester.cc +++ b/src/cpu/testers/rubytest/RubyTester.cc @@ -1,4 +1,16 @@ /* + * Copyright (c) 2012 ARM Limited + * All rights reserved + * + * The license below extends only to copyright in the software and shall + * not be construed as granting a license to any other intellectual + * property including but not limited to intellectual property relating + * to a hardware implementation of the functionality of the software + * licensed hereunder. You may use the software subject to the license + * terms below provided that you ensure that this notice is replicated + * unmodified and in its entirety in all distributions of the software, + * modified or unmodified, in source code or in binary form. + * * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood * Copyright (c) 2009 Advanced Micro Devices, Inc. * All rights reserved. @@ -48,6 +60,12 @@ RubyTester::RubyTester(const Params *p) { m_checks_completed = 0; + // create the ports + for (int i = 0; i < p->port_cpuPort_connection_count; ++i) { + ports.push_back(new CpuPort(csprintf("%s-port%d", name(), i), + this, i)); + } + // add the check start event to the event queue schedule(checkStartEvent, 1); } @@ -78,21 +96,14 @@ Port * RubyTester::getPort(const std::string &if_name, int idx) { if (if_name != "cpuPort") { - panic("RubyTester::getPort: unknown port %s requested", if_name); + panic("RubyTester::getPort: unknown port %s requested\n", if_name); } - if (idx >= (int)ports.size()) { - ports.resize(idx + 1); + if (idx >= static_cast<int>(ports.size())) { + panic("RubyTester::getPort: unknown index %d requested\n", idx); } - if (ports[idx] != NULL) { - panic("RubyTester::getPort: port %d already assigned", idx); - } - - CpuPort *port = new CpuPort(csprintf("%s-port%d", name(), idx), this, idx); - - ports[idx] = port; - return port; + return ports[idx]; } Tick |