summaryrefslogtreecommitdiff
path: root/src/mem/bridge.hh
diff options
context:
space:
mode:
authorAndreas Hansson <andreas.hansson@arm.com>2012-05-30 05:28:06 -0400
committerAndreas Hansson <andreas.hansson@arm.com>2012-05-30 05:28:06 -0400
commit3b367db42c5eedac8a60cbbd58bb4e39012bb5cf (patch)
tree34f47c89a8d96c3fb5e258da6b40f20c7e8ea1ba /src/mem/bridge.hh
parentd9988ded3c0857b3bfef656109ab1e33ff068e16 (diff)
downloadgem5-3b367db42c5eedac8a60cbbd58bb4e39012bb5cf.tar.xz
Bridge: Split deferred request, response and sender state
This patch splits the PacketBuffer class into a RequestState and a DeferredRequest and DeferredResponse. Only the requests need a SenderState, and the deferred requests and responses only need an associated point in time for the request and the response queue. Besides the cleaning up, the goal is to simplify the transition to a new port handshake, and with these changes, the two packet queues are starting to look very similar to the generic packet queue, but currently they do a few unique things relating to the NACK and counting of requests/responses that the packet queue cannot be conveniently used. This will be addressed in a later patch.
Diffstat (limited to 'src/mem/bridge.hh')
-rw-r--r--src/mem/bridge.hh69
1 files changed, 50 insertions, 19 deletions
diff --git a/src/mem/bridge.hh b/src/mem/bridge.hh
index d7bed9605..0160b8b9e 100644
--- a/src/mem/bridge.hh
+++ b/src/mem/bridge.hh
@@ -81,29 +81,22 @@ class Bridge : public MemObject
protected:
/**
- * A packet buffer stores packets along with their sender state
- * and scheduled time for transmission.
+ * A bridge request state stores packets along with their sender
+ * state and original source. It has enough information to also
+ * restore the response once it comes back to the bridge.
*/
- class PacketBuffer : public Packet::SenderState, public FastAlloc {
+ class RequestState : public Packet::SenderState, public FastAlloc
+ {
public:
- Tick ready;
- PacketPtr pkt;
- bool nackedHere;
+
Packet::SenderState *origSenderState;
Packet::NodeID origSrc;
- bool expectResponse;
- PacketBuffer(PacketPtr _pkt, Tick t, bool nack = false)
- : ready(t), pkt(_pkt), nackedHere(nack),
- origSenderState(_pkt->senderState),
- origSrc(nack ? _pkt->getDest() : _pkt->getSrc() ),
- expectResponse(_pkt->needsResponse() && !nack)
-
- {
- if (!pkt->isResponse() && !nack)
- pkt->senderState = this;
- }
+ RequestState(PacketPtr _pkt)
+ : origSenderState(_pkt->senderState),
+ origSrc(_pkt->getSrc())
+ { }
void fixResponse(PacketPtr pkt)
{
@@ -113,6 +106,44 @@ class Bridge : public MemObject
}
};
+ /**
+ * A deferred request stores a packet along with its scheduled
+ * transmission time, and whether we can expect to see a response
+ * or not.
+ */
+ class DeferredRequest
+ {
+
+ public:
+
+ Tick ready;
+ PacketPtr pkt;
+ bool expectResponse;
+
+ DeferredRequest(PacketPtr _pkt, Tick t)
+ : ready(t), pkt(_pkt), expectResponse(_pkt->needsResponse())
+ { }
+ };
+
+ /**
+ * A deferred response stores a packet along with its scheduled
+ * transmission time. It also contains information of whether the
+ * bridge NACKed the packet to be able to correctly maintain
+ * counters of outstanding responses.
+ */
+ class DeferredResponse {
+
+ public:
+
+ Tick ready;
+ PacketPtr pkt;
+ bool nackedHere;
+
+ DeferredResponse(PacketPtr _pkt, Tick t, bool nack = false)
+ : ready(t), pkt(_pkt), nackedHere(nack)
+ { }
+ };
+
// Forward declaration to allow the slave port to have a pointer
class BridgeMasterPort;
@@ -150,7 +181,7 @@ class Bridge : public MemObject
* queue for a specified delay to model the processing delay
* of the bridge.
*/
- std::list<PacketBuffer*> responseQueue;
+ std::list<DeferredResponse> responseQueue;
/** Counter to track the outstanding responses. */
unsigned int outstandingResponses;
@@ -277,7 +308,7 @@ class Bridge : public MemObject
* queue for a specified delay to model the processing delay
* of the bridge.
*/
- std::list<PacketBuffer*> requestQueue;
+ std::list<DeferredRequest> requestQueue;
/** If we're waiting for a retry to happen. */
bool inRetry;