ruby: fixes to support more types of RubyRequests
[gem5.git] / src / mem / bridge.cc
index cc9b83d3eee9754f704e07c1c35812ffeb93acfe..4b83250883b46bdd052563de2a5c38218a0d1847 100644 (file)
@@ -93,7 +93,9 @@ Bridge::init()
         fatal("Both ports of bus bridge are not connected to a bus.\n");
 
     if (portA.peerBlockSize() != portB.peerBlockSize())
-        fatal("Busses don't have the same block size... Not supported.\n");
+        fatal("port A size %d, port B size %d \n " \
+              "Busses don't have the same block size... Not supported.\n",
+              portA.peerBlockSize(), portB.peerBlockSize());
 }
 
 bool
@@ -156,7 +158,7 @@ Bridge::BridgePort::nackRequest(PacketPtr pkt)
     pkt->setNacked();
 
     //put it on the list to send
-    Tick readyTime = curTick + nackDelay;
+    Tick readyTime = curTick() + nackDelay;
     PacketBuffer *buf = new PacketBuffer(pkt, readyTime, true);
 
     // nothing on the list, add it and we're done
@@ -219,7 +221,7 @@ Bridge::BridgePort::queueForSendTiming(PacketPtr pkt)
 
 
 
-    Tick readyTime = curTick + delay;
+    Tick readyTime = curTick() + delay;
     PacketBuffer *buf = new PacketBuffer(pkt, readyTime);
 
     // If we're about to put this packet at the head of the queue, we
@@ -239,7 +241,7 @@ Bridge::BridgePort::trySend()
 
     PacketBuffer *buf = sendQueue.front();
 
-    assert(buf->ready <= curTick);
+    assert(buf->ready <= curTick());
 
     PacketPtr pkt = buf->pkt;
 
@@ -281,7 +283,7 @@ Bridge::BridgePort::trySend()
         if (!sendQueue.empty()) {
             buf = sendQueue.front();
             DPRINTF(BusBridge, "Scheduling next send\n");
-            schedule(sendEvent, std::max(buf->ready, curTick + 1));
+            schedule(sendEvent, std::max(buf->ready, curTick() + 1));
         }
     } else {
         DPRINTF(BusBridge, "  unsuccessful\n");
@@ -299,7 +301,7 @@ Bridge::BridgePort::recvRetry()
 {
     inRetry = false;
     Tick nextReady = sendQueue.front()->ready;
-    if (nextReady <= curTick)
+    if (nextReady <= curTick())
         trySend();
     else
         schedule(sendEvent, nextReady);
@@ -323,8 +325,10 @@ Bridge::BridgePort::recvFunctional(PacketPtr pkt)
     pkt->pushLabel(name());
 
     for (i = sendQueue.begin();  i != sendQueue.end(); ++i) {
-        if (pkt->checkFunctional((*i)->pkt))
+        if (pkt->checkFunctional((*i)->pkt)) {
+            pkt->makeResponse();
             return;
+        }
     }
 
     pkt->popLabel();