bridge.hh (8975:7f36d4436074) | bridge.hh (9029:120ba616606e) |
---|---|
1/* 2 * Copyright (c) 2011-2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 67 unchanged lines hidden (view full) --- 76 * accepted (recvTiming returns true), but is potentially NACKed if 77 * there is no request space or response space. 78 */ 79class Bridge : public MemObject 80{ 81 protected: 82 83 /** | 1/* 2 * Copyright (c) 2011-2012 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 67 unchanged lines hidden (view full) --- 76 * accepted (recvTiming returns true), but is potentially NACKed if 77 * there is no request space or response space. 78 */ 79class Bridge : public MemObject 80{ 81 protected: 82 83 /** |
84 * A packet buffer stores packets along with their sender state 85 * and scheduled time for transmission. | 84 * A bridge request state stores packets along with their sender 85 * state and original source. It has enough information to also 86 * restore the response once it comes back to the bridge. |
86 */ | 87 */ |
87 class PacketBuffer : public Packet::SenderState, public FastAlloc { | 88 class RequestState : public Packet::SenderState, public FastAlloc 89 { |
88 89 public: | 90 91 public: |
90 Tick ready; 91 PacketPtr pkt; 92 bool nackedHere; | 92 |
93 Packet::SenderState *origSenderState; 94 Packet::NodeID origSrc; | 93 Packet::SenderState *origSenderState; 94 Packet::NodeID origSrc; |
95 bool expectResponse; | |
96 | 95 |
97 PacketBuffer(PacketPtr _pkt, Tick t, bool nack = false) 98 : ready(t), pkt(_pkt), nackedHere(nack), 99 origSenderState(_pkt->senderState), 100 origSrc(nack ? _pkt->getDest() : _pkt->getSrc() ), 101 expectResponse(_pkt->needsResponse() && !nack) | 96 RequestState(PacketPtr _pkt) 97 : origSenderState(_pkt->senderState), 98 origSrc(_pkt->getSrc()) 99 { } |
102 | 100 |
103 { 104 if (!pkt->isResponse() && !nack) 105 pkt->senderState = this; 106 } 107 | |
108 void fixResponse(PacketPtr pkt) 109 { 110 assert(pkt->senderState == this); 111 pkt->setDest(origSrc); 112 pkt->senderState = origSenderState; 113 } 114 }; 115 | 101 void fixResponse(PacketPtr pkt) 102 { 103 assert(pkt->senderState == this); 104 pkt->setDest(origSrc); 105 pkt->senderState = origSenderState; 106 } 107 }; 108 |
109 /** 110 * A deferred request stores a packet along with its scheduled 111 * transmission time, and whether we can expect to see a response 112 * or not. 113 */ 114 class DeferredRequest 115 { 116 117 public: 118 119 Tick ready; 120 PacketPtr pkt; 121 bool expectResponse; 122 123 DeferredRequest(PacketPtr _pkt, Tick t) 124 : ready(t), pkt(_pkt), expectResponse(_pkt->needsResponse()) 125 { } 126 }; 127 128 /** 129 * A deferred response stores a packet along with its scheduled 130 * transmission time. It also contains information of whether the 131 * bridge NACKed the packet to be able to correctly maintain 132 * counters of outstanding responses. 133 */ 134 class DeferredResponse { 135 136 public: 137 138 Tick ready; 139 PacketPtr pkt; 140 bool nackedHere; 141 142 DeferredResponse(PacketPtr _pkt, Tick t, bool nack = false) 143 : ready(t), pkt(_pkt), nackedHere(nack) 144 { } 145 }; 146 |
|
116 // Forward declaration to allow the slave port to have a pointer 117 class BridgeMasterPort; 118 119 /** 120 * The port on the side that receives requests and sends 121 * responses. The slave port has a set of address ranges that it 122 * is responsible for. The slave port also has a buffer for the 123 * responses not yet sent. --- 21 unchanged lines hidden (view full) --- 145 /** Address ranges to pass through the bridge */ 146 AddrRangeList ranges; 147 148 /** 149 * Response packet queue. Response packets are held in this 150 * queue for a specified delay to model the processing delay 151 * of the bridge. 152 */ | 147 // Forward declaration to allow the slave port to have a pointer 148 class BridgeMasterPort; 149 150 /** 151 * The port on the side that receives requests and sends 152 * responses. The slave port has a set of address ranges that it 153 * is responsible for. The slave port also has a buffer for the 154 * responses not yet sent. --- 21 unchanged lines hidden (view full) --- 176 /** Address ranges to pass through the bridge */ 177 AddrRangeList ranges; 178 179 /** 180 * Response packet queue. Response packets are held in this 181 * queue for a specified delay to model the processing delay 182 * of the bridge. 183 */ |
153 std::list<PacketBuffer*> responseQueue; | 184 std::list<DeferredResponse> responseQueue; |
154 155 /** Counter to track the outstanding responses. */ 156 unsigned int outstandingResponses; 157 158 /** If we're waiting for a retry to happen. */ 159 bool inRetry; 160 161 /** Max queue size for reserved responses. */ --- 110 unchanged lines hidden (view full) --- 272 /** Minimum delay though this bridge. */ 273 Tick delay; 274 275 /** 276 * Request packet queue. Request packets are held in this 277 * queue for a specified delay to model the processing delay 278 * of the bridge. 279 */ | 185 186 /** Counter to track the outstanding responses. */ 187 unsigned int outstandingResponses; 188 189 /** If we're waiting for a retry to happen. */ 190 bool inRetry; 191 192 /** Max queue size for reserved responses. */ --- 110 unchanged lines hidden (view full) --- 303 /** Minimum delay though this bridge. */ 304 Tick delay; 305 306 /** 307 * Request packet queue. Request packets are held in this 308 * queue for a specified delay to model the processing delay 309 * of the bridge. 310 */ |
280 std::list<PacketBuffer*> requestQueue; | 311 std::list<DeferredRequest> requestQueue; |
281 282 /** If we're waiting for a retry to happen. */ 283 bool inRetry; 284 285 /** Max queue size for request packets */ 286 unsigned int reqQueueLimit; 287 288 /** --- 102 unchanged lines hidden --- | 312 313 /** If we're waiting for a retry to happen. */ 314 bool inRetry; 315 316 /** Max queue size for request packets */ 317 unsigned int reqQueueLimit; 318 319 /** --- 102 unchanged lines hidden --- |