bridge.cc (9648:f10eb34e3e38) | bridge.cc (9786:03a075377221) |
---|---|
1/* | 1/* |
2 * Copyright (c) 2011-2012 ARM Limited | 2 * Copyright (c) 2011-2013 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 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 104 unchanged lines hidden (view full) --- 115 "Busses don't have the same block size... Not supported.\n", 116 slavePort.peerBlockSize(), masterPort.peerBlockSize()); 117 118 // notify the master side of our address ranges 119 slavePort.sendRangeChange(); 120} 121 122bool | 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 9 * licensed hereunder. You may use the software subject to the license 10 * terms below provided that you ensure that this notice is replicated --- 104 unchanged lines hidden (view full) --- 115 "Busses don't have the same block size... Not supported.\n", 116 slavePort.peerBlockSize(), masterPort.peerBlockSize()); 117 118 // notify the master side of our address ranges 119 slavePort.sendRangeChange(); 120} 121 122bool |
123Bridge::BridgeSlavePort::respQueueFull() | 123Bridge::BridgeSlavePort::respQueueFull() const |
124{ 125 return outstandingResponses == respQueueLimit; 126} 127 128bool | 124{ 125 return outstandingResponses == respQueueLimit; 126} 127 128bool |
129Bridge::BridgeMasterPort::reqQueueFull() | 129Bridge::BridgeMasterPort::reqQueueFull() const |
130{ 131 return transmitList.size() == reqQueueLimit; 132} 133 134bool 135Bridge::BridgeMasterPort::recvTimingResp(PacketPtr pkt) 136{ 137 // all checks are done when the request is accepted on the slave --- 12 unchanged lines hidden (view full) --- 150} 151 152bool 153Bridge::BridgeSlavePort::recvTimingReq(PacketPtr pkt) 154{ 155 DPRINTF(Bridge, "recvTimingReq: %s addr 0x%x\n", 156 pkt->cmdString(), pkt->getAddr()); 157 | 130{ 131 return transmitList.size() == reqQueueLimit; 132} 133 134bool 135Bridge::BridgeMasterPort::recvTimingResp(PacketPtr pkt) 136{ 137 // all checks are done when the request is accepted on the slave --- 12 unchanged lines hidden (view full) --- 150} 151 152bool 153Bridge::BridgeSlavePort::recvTimingReq(PacketPtr pkt) 154{ 155 DPRINTF(Bridge, "recvTimingReq: %s addr 0x%x\n", 156 pkt->cmdString(), pkt->getAddr()); 157 |
158 // ensure we do not have something waiting to retry 159 if(retryReq) 160 return false; | 158 // we should not see a timing request if we are already in a retry 159 assert(!retryReq); |
161 162 DPRINTF(Bridge, "Response queue size: %d outresp: %d\n", 163 transmitList.size(), outstandingResponses); 164 | 160 161 DPRINTF(Bridge, "Response queue size: %d outresp: %d\n", 162 transmitList.size(), outstandingResponses); 163 |
164 // if the request queue is full then there is no hope |
|
165 if (masterPort.reqQueueFull()) { 166 DPRINTF(Bridge, "Request queue full\n"); 167 retryReq = true; | 165 if (masterPort.reqQueueFull()) { 166 DPRINTF(Bridge, "Request queue full\n"); 167 retryReq = true; |
168 } else if (pkt->needsResponse()) { 169 if (respQueueFull()) { 170 DPRINTF(Bridge, "Response queue full\n"); 171 retryReq = true; 172 } else { 173 DPRINTF(Bridge, "Reserving space for response\n"); 174 assert(outstandingResponses != respQueueLimit); 175 ++outstandingResponses; 176 retryReq = false; | 168 } else { 169 // look at the response queue if we expect to see a response 170 bool expects_response = pkt->needsResponse() && 171 !pkt->memInhibitAsserted(); 172 if (expects_response) { 173 if (respQueueFull()) { 174 DPRINTF(Bridge, "Response queue full\n"); 175 retryReq = true; 176 } else { 177 // ok to send the request with space for the response 178 DPRINTF(Bridge, "Reserving space for response\n"); 179 assert(outstandingResponses != respQueueLimit); 180 ++outstandingResponses; |
177 | 181 |
182 // no need to set retryReq to false as this is already the 183 // case 184 } 185 } 186 187 if (!retryReq) { |
|
178 // @todo: We need to pay for this and not just zero it out 179 pkt->busFirstWordDelay = pkt->busLastWordDelay = 0; 180 181 masterPort.schedTimingReq(pkt, bridge.clockEdge(delay)); 182 } 183 } 184 185 // remember that we are now stalling a packet and that we have to --- 83 unchanged lines hidden (view full) --- 269 270 if (sendTimingReq(pkt)) { 271 // send successful 272 transmitList.pop_front(); 273 DPRINTF(Bridge, "trySend request successful\n"); 274 275 // If there are more packets to send, schedule event to try again. 276 if (!transmitList.empty()) { | 188 // @todo: We need to pay for this and not just zero it out 189 pkt->busFirstWordDelay = pkt->busLastWordDelay = 0; 190 191 masterPort.schedTimingReq(pkt, bridge.clockEdge(delay)); 192 } 193 } 194 195 // remember that we are now stalling a packet and that we have to --- 83 unchanged lines hidden (view full) --- 279 280 if (sendTimingReq(pkt)) { 281 // send successful 282 transmitList.pop_front(); 283 DPRINTF(Bridge, "trySend request successful\n"); 284 285 // If there are more packets to send, schedule event to try again. 286 if (!transmitList.empty()) { |
277 req = transmitList.front(); | 287 DeferredPacket next_req = transmitList.front(); |
278 DPRINTF(Bridge, "Scheduling next send\n"); | 288 DPRINTF(Bridge, "Scheduling next send\n"); |
279 bridge.schedule(sendEvent, std::max(req.tick, | 289 bridge.schedule(sendEvent, std::max(next_req.tick, |
280 bridge.clockEdge())); 281 } 282 283 // if we have stalled a request due to a full request queue, 284 // then send a retry at this point, also note that if the 285 // request we stalled was waiting for the response queue 286 // rather than the request queue we might stall it again 287 slavePort.retryStalledReq(); --- 22 unchanged lines hidden (view full) --- 310 transmitList.pop_front(); 311 DPRINTF(Bridge, "trySend response successful\n"); 312 313 assert(outstandingResponses != 0); 314 --outstandingResponses; 315 316 // If there are more packets to send, schedule event to try again. 317 if (!transmitList.empty()) { | 290 bridge.clockEdge())); 291 } 292 293 // if we have stalled a request due to a full request queue, 294 // then send a retry at this point, also note that if the 295 // request we stalled was waiting for the response queue 296 // rather than the request queue we might stall it again 297 slavePort.retryStalledReq(); --- 22 unchanged lines hidden (view full) --- 320 transmitList.pop_front(); 321 DPRINTF(Bridge, "trySend response successful\n"); 322 323 assert(outstandingResponses != 0); 324 --outstandingResponses; 325 326 // If there are more packets to send, schedule event to try again. 327 if (!transmitList.empty()) { |
318 resp = transmitList.front(); | 328 DeferredPacket next_resp = transmitList.front(); |
319 DPRINTF(Bridge, "Scheduling next send\n"); | 329 DPRINTF(Bridge, "Scheduling next send\n"); |
320 bridge.schedule(sendEvent, std::max(resp.tick, | 330 bridge.schedule(sendEvent, std::max(next_resp.tick, |
321 bridge.clockEdge())); 322 } 323 324 // if there is space in the request queue and we were stalling 325 // a request, it will definitely be possible to accept it now 326 // since there is guaranteed space in the response queue 327 if (!masterPort.reqQueueFull() && retryReq) { 328 DPRINTF(Bridge, "Request waiting for retry, now retrying\n"); --- 4 unchanged lines hidden (view full) --- 333 334 // if the send failed, then we try again once we receive a retry, 335 // and therefore there is no need to take any action 336} 337 338void 339Bridge::BridgeMasterPort::recvRetry() 340{ | 331 bridge.clockEdge())); 332 } 333 334 // if there is space in the request queue and we were stalling 335 // a request, it will definitely be possible to accept it now 336 // since there is guaranteed space in the response queue 337 if (!masterPort.reqQueueFull() && retryReq) { 338 DPRINTF(Bridge, "Request waiting for retry, now retrying\n"); --- 4 unchanged lines hidden (view full) --- 343 344 // if the send failed, then we try again once we receive a retry, 345 // and therefore there is no need to take any action 346} 347 348void 349Bridge::BridgeMasterPort::recvRetry() 350{ |
341 Tick nextReady = transmitList.front().tick; 342 if (nextReady <= curTick()) 343 trySendTiming(); 344 else 345 bridge.schedule(sendEvent, nextReady); | 351 trySendTiming(); |
346} 347 348void 349Bridge::BridgeSlavePort::recvRetry() 350{ | 352} 353 354void 355Bridge::BridgeSlavePort::recvRetry() 356{ |
351 Tick nextReady = transmitList.front().tick; 352 if (nextReady <= curTick()) 353 trySendTiming(); 354 else 355 bridge.schedule(sendEvent, nextReady); | 357 trySendTiming(); |
356} 357 358Tick 359Bridge::BridgeSlavePort::recvAtomic(PacketPtr pkt) 360{ 361 return delay * bridge.clockPeriod() + masterPort.sendAtomic(pkt); 362} 363 364void 365Bridge::BridgeSlavePort::recvFunctional(PacketPtr pkt) 366{ | 358} 359 360Tick 361Bridge::BridgeSlavePort::recvAtomic(PacketPtr pkt) 362{ 363 return delay * bridge.clockPeriod() + masterPort.sendAtomic(pkt); 364} 365 366void 367Bridge::BridgeSlavePort::recvFunctional(PacketPtr pkt) 368{ |
367 std::list<DeferredPacket>::iterator i; 368 | |
369 pkt->pushLabel(name()); 370 371 // check the response queue | 369 pkt->pushLabel(name()); 370 371 // check the response queue |
372 for (i = transmitList.begin(); i != transmitList.end(); ++i) { | 372 for (auto i = transmitList.begin(); i != transmitList.end(); ++i) { |
373 if (pkt->checkFunctional((*i).pkt)) { 374 pkt->makeResponse(); 375 return; 376 } 377 } 378 379 // also check the master port's request queue 380 if (masterPort.checkFunctional(pkt)) { --- 5 unchanged lines hidden (view full) --- 386 // fall through if pkt still not satisfied 387 masterPort.sendFunctional(pkt); 388} 389 390bool 391Bridge::BridgeMasterPort::checkFunctional(PacketPtr pkt) 392{ 393 bool found = false; | 373 if (pkt->checkFunctional((*i).pkt)) { 374 pkt->makeResponse(); 375 return; 376 } 377 } 378 379 // also check the master port's request queue 380 if (masterPort.checkFunctional(pkt)) { --- 5 unchanged lines hidden (view full) --- 386 // fall through if pkt still not satisfied 387 masterPort.sendFunctional(pkt); 388} 389 390bool 391Bridge::BridgeMasterPort::checkFunctional(PacketPtr pkt) 392{ 393 bool found = false; |
394 std::list<DeferredPacket>::iterator i = transmitList.begin(); | 394 auto i = transmitList.begin(); |
395 396 while(i != transmitList.end() && !found) { 397 if (pkt->checkFunctional((*i).pkt)) { 398 pkt->makeResponse(); 399 found = true; 400 } 401 ++i; 402 } --- 15 unchanged lines hidden --- | 395 396 while(i != transmitList.end() && !found) { 397 if (pkt->checkFunctional((*i).pkt)) { 398 pkt->makeResponse(); 399 found = true; 400 } 401 ++i; 402 } --- 15 unchanged lines hidden --- |