Fix bus in FS mode.
authorRon Dreslinski <rdreslin@umich.edu>
Wed, 11 Oct 2006 23:25:48 +0000 (19:25 -0400)
committerRon Dreslinski <rdreslin@umich.edu>
Wed, 11 Oct 2006 23:25:48 +0000 (19:25 -0400)
src/mem/bus.cc:
    Add debugging statement
src/mem/bus.hh:
    Fix implementation of bus for subsequent recvTimings while handling a retry request.
src/mem/tport.cc:
    Rework timing port to retry properly

--HG--
extra : convert_revision : fbfb5e8b4a625e49c6cd764da1df46a4f336b1b2

src/mem/bus.cc
src/mem/bus.hh
src/mem/tport.cc

index b34944ed70c83dbac28c14de2144b0566b122633..8dd16874a6b2ac6280a48828fe5eaf1fea1f5799 100644 (file)
@@ -173,6 +173,7 @@ Bus::recvTiming(Packet *pkt)
             port = findPort(pkt->getAddr(), pkt->getSrc());
         } else {
             //Snoop didn't succeed
+            DPRINTF(Bus, "Adding a retry to RETRY list %i\n", pktPort);
             addToRetryList(pktPort);
             return false;
         }
index a168c3c4992de89927ac9a5796fa39e334b786a6..b1cbbe1e3f12e4ad63e0706629c172429462a110 100644 (file)
@@ -224,13 +224,15 @@ class Bus : public MemObject
             port->onRetryList(true);
             retryList.push_back(port);
         } else {
-            // The device was retrying a packet. It didn't work, so we'll leave
-            // it at the head of the retry list.
-            inRetry = false;
-
-/*         // We shouldn't be receiving a packet from one port when a different
-            // one is retrying.
-            assert(port == retryingPort);*/
+            if (port->onRetryList()) {
+                // The device was retrying a packet. It didn't work, so we'll leave
+                // it at the head of the retry list.
+                assert(port == retryList.front());
+                inRetry = false;
+            }
+            else {
+                retryList.push_back(port);
+            }
         }
     }
 
index 528067170566c6c9bca20541fbbbd1aa464bacb9..456878d0a9d64b9dd39140c18a98d136cf67d411 100644 (file)
@@ -58,15 +58,17 @@ SimpleTimingPort::recvTiming(Packet *pkt)
 void
 SimpleTimingPort::recvRetry()
 {
-    bool result = true;
-
-    assert(transmitList.size());
-    while (result && transmitList.size()) {
-        result = sendTiming(transmitList.front());
-        if (result)
-            transmitList.pop_front();
+    assert(outTiming > 0);
+    assert(!transmitList.empty());
+    if (sendTiming(transmitList.front())) {
+        transmitList.pop_front();
+        outTiming--;
+        DPRINTF(Bus, "No Longer waiting on retry\n");
+        if (!transmitList.empty())
+            sendTimingLater(transmitList.front(), 1);
     }
-    if (transmitList.size() == 0 && drainEvent) {
+
+    if (transmitList.empty() && drainEvent) {
         drainEvent->process();
         drainEvent = NULL;
     }
@@ -75,20 +77,28 @@ SimpleTimingPort::recvRetry()
 void
 SimpleTimingPort::SendEvent::process()
 {
-    port->outTiming--;
-    assert(port->outTiming >= 0);
-    if (port->transmitList.size()) {
+    assert(port->outTiming > 0);
+    if (!port->transmitList.empty() && port->transmitList.front() != packet) {
+        //We are not the head of the list
         port->transmitList.push_back(packet);
     } else if (port->sendTiming(packet)) {
         // send successful
-        if (port->transmitList.size() == 0 && port->drainEvent) {
+        if (port->transmitList.size()) {
+            port->transmitList.pop_front();
+            port->outTiming--;
+           if (!port->transmitList.empty())
+                port->sendTimingLater(port->transmitList.front(), 1);
+        }
+        if (port->transmitList.empty() && port->drainEvent) {
             port->drainEvent->process();
             port->drainEvent = NULL;
         }
     } else {
         // send unsuccessful (due to flow control).  Will get retry
-        // callback later; save for then.
-        port->transmitList.push_back(packet);
+        // callback later; save for then if not already
+        DPRINTF(Bus, "Waiting on retry\n");
+        if (!(port->transmitList.front() == packet))
+            port->transmitList.push_back(packet);
     }
 }