diff options
author | Steve Reinhardt <stever@eecs.umich.edu> | 2007-07-02 01:02:35 -0700 |
---|---|---|
committer | Steve Reinhardt <stever@eecs.umich.edu> | 2007-07-02 01:02:35 -0700 |
commit | ffd697e14933b3012aaaa0fb93168b2fda59ea4a (patch) | |
tree | e76aca7aef9abe31f0cb539328105393c9967dda | |
parent | 3ad761bc8e89ff034fbf5ec6d8e9661e1025dcd7 (diff) | |
download | gem5-ffd697e14933b3012aaaa0fb93168b2fda59ea4a.tar.xz |
bus.cc:
Fix atomic timing issue.
src/mem/bus.cc:
Fix atomic timing issue.
--HG--
extra : convert_revision : a22ff80cd75f83c785b0604c2a4fde2e2e9f71ef
-rw-r--r-- | src/mem/bus.cc | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/mem/bus.cc b/src/mem/bus.cc index 83ce0f87d..34f7f4fd0 100644 --- a/src/mem/bus.cc +++ b/src/mem/bus.cc @@ -377,7 +377,8 @@ Bus::recvAtomic(PacketPtr pkt) // original command so that additional snoops can take place // properly MemCmd orig_cmd = pkt->cmd; - MemCmd response_cmd = MemCmd::InvalidCmd; + MemCmd snoop_response_cmd = MemCmd::InvalidCmd; + Tick snoop_response_latency = 0; int orig_src = pkt->getSrc(); Port *target_port = findPort(pkt->getAddr(), pkt->getSrc()); @@ -388,15 +389,16 @@ Bus::recvAtomic(PacketPtr pkt) // same port should not have both target addresses and snooping assert(p != target_port); if (p->getId() != pkt->getSrc()) { - p->sendAtomic(pkt); + Tick latency = p->sendAtomic(pkt); if (pkt->isResponse()) { // response from snoop agent assert(pkt->cmd != orig_cmd); assert(pkt->memInhibitAsserted()); // should only happen once - assert(response_cmd == MemCmd::InvalidCmd); + assert(snoop_response_cmd == MemCmd::InvalidCmd); // save response state - response_cmd = pkt->cmd; + snoop_response_cmd = pkt->cmd; + snoop_response_latency = latency; // restore original packet state for remaining snoopers pkt->cmd = orig_cmd; pkt->setSrc(orig_src); @@ -405,19 +407,20 @@ Bus::recvAtomic(PacketPtr pkt) } } - Tick response_time = target_port->sendAtomic(pkt); + Tick response_latency = target_port->sendAtomic(pkt); // if we got a response from a snooper, restore it here - if (response_cmd != MemCmd::InvalidCmd) { + if (snoop_response_cmd != MemCmd::InvalidCmd) { // no one else should have responded assert(!pkt->isResponse()); assert(pkt->cmd == orig_cmd); - pkt->cmd = response_cmd; + pkt->cmd = snoop_response_cmd; + response_latency = snoop_response_latency; } // why do we have this packet field and the return value both??? - pkt->finishTime = std::max(response_time, curTick + clock); - return pkt->finishTime; + pkt->finishTime = curTick + response_latency; + return response_latency; } /** Function called by the port when the bus is receiving a Functional |