diff options
Diffstat (limited to 'src/cpu')
-rw-r--r-- | src/cpu/testers/directedtest/RubyDirectedTester.cc | 34 | ||||
-rw-r--r-- | src/cpu/testers/rubytest/RubyTester.cc | 33 |
2 files changed, 45 insertions, 22 deletions
diff --git a/src/cpu/testers/directedtest/RubyDirectedTester.cc b/src/cpu/testers/directedtest/RubyDirectedTester.cc index b85cf781c..4518066eb 100644 --- a/src/cpu/testers/directedtest/RubyDirectedTester.cc +++ b/src/cpu/testers/directedtest/RubyDirectedTester.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-2010 Advanced Micro Devices, Inc. * All rights reserved. @@ -40,6 +52,12 @@ RubyDirectedTester::RubyDirectedTester(const Params *p) { m_requests_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(directedStartEvent, 1); } @@ -61,21 +79,15 @@ Port * RubyDirectedTester::getPort(const std::string &if_name, int idx) { if (if_name != "cpuPort") { - panic("RubyDirectedTester::getPort: unknown port %s requested", if_name); + panic("RubyDirectedTester::getPort: unknown port %s requested", + if_name); } - if (idx >= (int)ports.size()) { - ports.resize(idx + 1); + if (idx >= static_cast<int>(ports.size())) { + panic("RubyDirectedTester::getPort: unknown index %d requested\n", idx); } - if (ports[idx] != NULL) { - panic("RubyDirectedTester::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 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 |