From 4c92708b48d51bfb6592ff48925f5a7a0157da5b Mon Sep 17 00:00:00 2001 From: Andreas Hansson Date: Wed, 25 Apr 2012 10:41:23 -0400 Subject: MEM: Add the PortId type and a corresponding id field to Port This patch introduces the PortId type, moves the definition of INVALID_PORT_ID to the Port class, and also gives every port an id to reflect the fact that each element in a vector port has an identifier/index. Previously the bus and Ruby testers (and potentially other users of the vector ports) added the id field in their port subclasses, and now this functionality is always present as it is moved to the base class. --- src/cpu/testers/rubytest/RubyTester.cc | 2 +- src/cpu/testers/rubytest/RubyTester.hh | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'src/cpu/testers/rubytest') diff --git a/src/cpu/testers/rubytest/RubyTester.cc b/src/cpu/testers/rubytest/RubyTester.cc index 1e9827515..2862a261d 100644 --- a/src/cpu/testers/rubytest/RubyTester.cc +++ b/src/cpu/testers/rubytest/RubyTester.cc @@ -156,7 +156,7 @@ RubyTester::CpuPort::recvTiming(PacketPtr pkt) // pop the sender state from the packet pkt->senderState = senderState->saved; - tester->hitCallback(idx, subblock); + tester->hitCallback(id, subblock); // Now that the tester has completed, delete the senderState // (includes sublock) and the packet, then return diff --git a/src/cpu/testers/rubytest/RubyTester.hh b/src/cpu/testers/rubytest/RubyTester.hh index 266209b8f..5d2202f65 100644 --- a/src/cpu/testers/rubytest/RubyTester.hh +++ b/src/cpu/testers/rubytest/RubyTester.hh @@ -57,12 +57,10 @@ class RubyTester : public MemObject // RubyPorts that support both types of requests, separate InstOnly // and DataOnly CpuPorts will map to that RubyPort - CpuPort(const std::string &_name, RubyTester *_tester, int _idx) - : MasterPort(_name, _tester), tester(_tester), idx(_idx) + CpuPort(const std::string &_name, RubyTester *_tester, PortId _id) + : MasterPort(_name, _tester, _id), tester(_tester) {} - int idx; - protected: virtual bool recvTiming(PacketPtr pkt); virtual void recvRetry() -- cgit v1.2.3