ruby: added Packet interface to makeRequest and isReady.
[gem5.git] / src / mem / bridge.hh
index 82001948e60071670a7072d434ce6957f23bc1c5..40f033811277e5ac453b4807680045d1d2be0d94 100644 (file)
@@ -42,6 +42,7 @@
 #include <inttypes.h>
 #include <queue>
 
+#include "base/fast_alloc.hh"
 #include "mem/mem_object.hh"
 #include "mem/packet.hh"
 #include "mem/port.hh"
@@ -73,22 +74,24 @@ class Bridge : public MemObject
         /** Pass ranges from one side of the bridge to the other? */
         std::vector<Range<Addr> > filterRanges;
 
-        class PacketBuffer : public Packet::SenderState {
+        class PacketBuffer : public Packet::SenderState, public FastAlloc {
 
           public:
             Tick ready;
             PacketPtr pkt;
+            bool nackedHere;
             Packet::SenderState *origSenderState;
             short origSrc;
             bool expectResponse;
 
             PacketBuffer(PacketPtr _pkt, Tick t, bool nack = false)
-                : ready(t), pkt(_pkt),
-                  origSenderState(_pkt->senderState), origSrc(_pkt->getSrc()),
+                : ready(t), pkt(_pkt), nackedHere(nack),
+                  origSenderState(_pkt->senderState),
+                  origSrc(nack ? _pkt->getDest() : _pkt->getSrc() ),
                   expectResponse(_pkt->needsResponse() && !nack)
 
             {
-                if (!pkt->isResponse() && !nack && !pkt->wasNacked())
+                if (!pkt->isResponse() && !nack)
                     pkt->senderState = this;
             }
 
@@ -143,12 +146,9 @@ class Bridge : public MemObject
             BridgePort *port;
 
           public:
-            SendEvent(BridgePort *p)
-                : Event(&mainEventQueue), port(p) {}
-
+            SendEvent(BridgePort *p) : port(p) {}
             virtual void process() { port->trySend(); }
-
-            virtual const char *description() { return "bridge send"; }
+            virtual const char *description() const { return "bridge send"; }
         };
 
         SendEvent sendEvent;