From 8155e61a601a37fb210a7676ba500014a7b5d054 Mon Sep 17 00:00:00 2001 From: Ron Dreslinski Date: Tue, 14 Nov 2006 01:38:42 -0500 Subject: [PATCH] Update atomic and functional paths for snoops as well --HG-- extra : convert_revision : 566d73438efb87ca683e4dee23454d880db3dfc7 --- src/mem/bus.cc | 31 +++++++++++++++++-------------- src/mem/bus.hh | 4 ++-- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/mem/bus.cc b/src/mem/bus.cc index a9f95fdc7..92722fd97 100644 --- a/src/mem/bus.cc +++ b/src/mem/bus.cc @@ -331,17 +331,19 @@ Bus::findSnoopPorts(Addr addr, int id) } Tick -Bus::atomicSnoop(PacketPtr pkt) +Bus::atomicSnoop(PacketPtr pkt, Port *responder) { std::vector ports = findSnoopPorts(pkt->getAddr(), pkt->getSrc()); Tick response_time = 0; while (!ports.empty()) { - Tick response = interfaces[ports.back()]->sendAtomic(pkt); - if (response) { - assert(!response_time); //Multiple responders - response_time = response; + if (interfaces[ports.back()] != responder) { + Tick response = interfaces[ports.back()]->sendAtomic(pkt); + if (response) { + assert(!response_time); //Multiple responders + response_time = response; + } } ports.pop_back(); } @@ -349,7 +351,7 @@ Bus::atomicSnoop(PacketPtr pkt) } void -Bus::functionalSnoop(PacketPtr pkt) +Bus::functionalSnoop(PacketPtr pkt, Port *responder) { std::vector ports = findSnoopPorts(pkt->getAddr(), pkt->getSrc()); @@ -357,7 +359,8 @@ Bus::functionalSnoop(PacketPtr pkt) int id = pkt->getSrc(); while (!ports.empty() && pkt->result != Packet::Success) { - interfaces[ports.back()]->sendFunctional(pkt); + if (interfaces[ports.back()] != responder) + interfaces[ports.back()]->sendFunctional(pkt); ports.pop_back(); pkt->setSrc(id); } @@ -394,12 +397,13 @@ Bus::recvAtomic(PacketPtr pkt) // some clock skew issues yet again... pkt->finishTime = curTick + clock; - Tick snoopTime = atomicSnoop(pkt); + Port *port = findPort(pkt->getAddr(), pkt->getSrc()); + Tick snoopTime = atomicSnoop(pkt, port); if (snoopTime) return snoopTime; //Snoop satisfies it else - return findPort(pkt->getAddr(), pkt->getSrc())->sendAtomic(pkt); + return port->sendAtomic(pkt); } /** Function called by the port when the bus is receiving a Functional @@ -412,13 +416,12 @@ Bus::recvFunctional(PacketPtr pkt) assert(pkt->getDest() == Packet::Broadcast); pkt->flags |= SNOOP_COMMIT; - functionalSnoop(pkt); + Port* port = findPort(pkt->getAddr(), pkt->getSrc()); + functionalSnoop(pkt, port ? port : interfaces[pkt->getSrc()]); // If the snooping found what we were looking for, we're done. - if (pkt->result != Packet::Success) { - Port* port = findPort(pkt->getAddr(), pkt->getSrc()); - if (port) - port->sendFunctional(pkt); + if (pkt->result != Packet::Success && port) { + port->sendFunctional(pkt); } } diff --git a/src/mem/bus.hh b/src/mem/bus.hh index 7169a8e6d..c472b6143 100644 --- a/src/mem/bus.hh +++ b/src/mem/bus.hh @@ -109,10 +109,10 @@ class Bus : public MemObject std::vector findSnoopPorts(Addr addr, int id); /** Snoop all relevant ports atomicly. */ - Tick atomicSnoop(PacketPtr pkt); + Tick atomicSnoop(PacketPtr pkt, Port* responder); /** Snoop all relevant ports functionally. */ - void functionalSnoop(PacketPtr pkt); + void functionalSnoop(PacketPtr pkt, Port *responder); /** Call snoop on caches, be sure to set SNOOP_COMMIT bit if you want * the snoop to happen -- 2.30.2