summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabe Black <gblack@eecs.umich.edu>2006-10-10 23:28:33 -0400
committerGabe Black <gblack@eecs.umich.edu>2006-10-10 23:28:33 -0400
commit8353b1e21f40b9d1b45577821dc9826ad48213d6 (patch)
treedd081657c559f45c1a7af51f8282f20f93926a44 /src
parent59dd317cb5251c8cff714a94b5d772af201febbe (diff)
downloadgem5-8353b1e21f40b9d1b45577821dc9826ad48213d6.tar.xz
Make the bus is occupied for none broadcast packets as well.
--HG-- extra : convert_revision : aef3c625172e92be8f29c4c57077fefee43046bb
Diffstat (limited to 'src')
-rw-r--r--src/mem/bus.cc96
-rw-r--r--src/mem/bus.hh2
2 files changed, 53 insertions, 45 deletions
diff --git a/src/mem/bus.cc b/src/mem/bus.cc
index 3b8a079ca..7bdd44100 100644
--- a/src/mem/bus.cc
+++ b/src/mem/bus.cc
@@ -80,52 +80,8 @@ const char * Bus::BusFreeEvent::description()
return "bus became available";
}
-/** Function called by the port when the bus is receiving a Timing
- * transaction.*/
-bool
-Bus::recvTiming(Packet *pkt)
+void Bus::occupyBus(PacketPtr pkt)
{
- Port *port;
- DPRINTF(Bus, "recvTiming: packet src %d dest %d addr 0x%x cmd %s\n",
- pkt->getSrc(), pkt->getDest(), pkt->getAddr(), pkt->cmdString());
-
- BusPort *pktPort = interfaces[pkt->getSrc()];
-
- // If the bus is busy, or other devices are in line ahead of the current
- // one, put this device on the retry list.
- if (tickNextIdle > curTick ||
- (retryList.size() && (!inRetry || pktPort != retryList.front()))) {
- addToRetryList(pktPort);
- return false;
- }
-
- short dest = pkt->getDest();
- if (dest == Packet::Broadcast) {
- if (timingSnoop(pkt)) {
- pkt->flags |= SNOOP_COMMIT;
- bool success = timingSnoop(pkt);
- assert(success);
- if (pkt->flags & SATISFIED) {
- //Cache-Cache transfer occuring
- if (inRetry) {
- retryList.front()->onRetryList(false);
- retryList.pop_front();
- inRetry = false;
- }
- return true;
- }
- port = findPort(pkt->getAddr(), pkt->getSrc());
- } else {
- //Snoop didn't succeed
- addToRetryList(pktPort);
- return false;
- }
- } else {
- assert(dest >= 0 && dest < interfaces.size());
- assert(dest != pkt->getSrc()); // catch infinite loops
- port = interfaces[dest];
- }
-
//Bring tickNextIdle up to the present tick
//There is some potential ambiguity where a cycle starts, which might make
//a difference when devices are acting right around a cycle boundary. Using
@@ -177,6 +133,56 @@ Bus::recvTiming(Packet *pkt)
// The bus will become idle once the current packet is delivered.
pkt->finishTime = tickNextIdle;
+}
+
+/** Function called by the port when the bus is receiving a Timing
+ * transaction.*/
+bool
+Bus::recvTiming(Packet *pkt)
+{
+ Port *port;
+ DPRINTF(Bus, "recvTiming: packet src %d dest %d addr 0x%x cmd %s\n",
+ pkt->getSrc(), pkt->getDest(), pkt->getAddr(), pkt->cmdString());
+
+ BusPort *pktPort = interfaces[pkt->getSrc()];
+
+ // If the bus is busy, or other devices are in line ahead of the current
+ // one, put this device on the retry list.
+ if (tickNextIdle > curTick ||
+ (retryList.size() && (!inRetry || pktPort != retryList.front()))) {
+ addToRetryList(pktPort);
+ return false;
+ }
+
+ short dest = pkt->getDest();
+ if (dest == Packet::Broadcast) {
+ if (timingSnoop(pkt)) {
+ pkt->flags |= SNOOP_COMMIT;
+ bool success = timingSnoop(pkt);
+ assert(success);
+ if (pkt->flags & SATISFIED) {
+ //Cache-Cache transfer occuring
+ if (inRetry) {
+ retryList.front()->onRetryList(false);
+ retryList.pop_front();
+ inRetry = false;
+ }
+ occupyBus(pkt);
+ return true;
+ }
+ port = findPort(pkt->getAddr(), pkt->getSrc());
+ } else {
+ //Snoop didn't succeed
+ addToRetryList(pktPort);
+ return false;
+ }
+ } else {
+ assert(dest >= 0 && dest < interfaces.size());
+ assert(dest != pkt->getSrc()); // catch infinite loops
+ port = interfaces[dest];
+ }
+
+ occupyBus(pkt);
if (port->sendTiming(pkt)) {
// Packet was successfully sent. Return true.
diff --git a/src/mem/bus.hh b/src/mem/bus.hh
index 4f330230f..3d0d07a7f 100644
--- a/src/mem/bus.hh
+++ b/src/mem/bus.hh
@@ -125,6 +125,8 @@ class Bus : public MemObject
*/
void addressRanges(AddrRangeList &resp, AddrRangeList &snoop, int id);
+ /** Occupy the bus with transmitting the packet pkt */
+ void occupyBus(PacketPtr pkt);
/** Declaration of the buses port type, one will be instantiated for each
of the interfaces connecting to the bus. */