{
blocked = false;
cshrRetry = NULL;
+ waitingOnRetry = false;
//Start ports at null if more than one is created we should panic
//cpuSidePort = NULL;
//memSidePort = NULL;
BaseCache::CachePort::recvRetry()
{
Packet *pkt;
+ assert(waitingOnRetry);
if (!drainList.empty()) {
//We have some responses to drain first
- bool result = true;
- while (result && !drainList.empty()) {
- result = sendTiming(drainList.front());
- if (result)
- drainList.pop_front();
+ if (sendTiming(drainList.front())) {
+ drainList.pop_front();
+ if (!drainList.empty() ||
+ !isCpuSide && cache->doMasterRequest() ||
+ isCpuSide && cache->doSlaveRequest()) {
+ BaseCache::CacheEvent * reqCpu = new BaseCache::CacheEvent(this);
+ reqCpu->schedule(curTick + 1);
+ }
+ waitingOnRetry = false;
}
- if (!result) return;
}
else if (!isCpuSide)
{
- if (!cache->doMasterRequest()) return;
+ assert(cache->doMasterRequest());
pkt = cache->getPacket();
MSHR* mshr = (MSHR*)pkt->senderState;
bool success = sendTiming(pkt);
DPRINTF(Cache, "Address %x was %s in sending the timing request\n",
pkt->getAddr(), success ? "succesful" : "unsuccesful");
cache->sendResult(pkt, mshr, success);
+ waitingOnRetry = !success;
if (success && cache->doMasterRequest())
{
//Still more to issue, rerequest in 1 cycle
reqCpu->schedule(curTick + 1);
}
}
- else if (cshrRetry)
+ else
{
+ assert(cshrRetry);
//pkt = cache->getCoherencePacket();
//We save the packet, no reordering on CSHRS
pkt = cshrRetry;
bool success = sendTiming(pkt);
+ waitingOnRetry = !success;
if (success && cache->doSlaveRequest())
{
//Still more to issue, rerequest in 1 cycle
reqCpu->schedule(curTick + 1);
cshrRetry = NULL;
}
-
}
return;
}
void
BaseCache::CacheEvent::process()
{
- if (!cachePort->drainList.empty()) {
- //We have some responses to drain first
- bool result = true;
- while (result && !cachePort->drainList.empty()) {
- result = cachePort->sendTiming(cachePort->drainList.front());
- if (result)
- cachePort->drainList.pop_front();
- }
- if (!result) return;
- }
-
if (!pkt)
{
- if (!cachePort->isCpuSide)
+ if (cachePort->waitingOnRetry) return;
+ //We have some responses to drain first
+ if (!cachePort->drainList.empty()) {
+ if (cachePort->sendTiming(cachePort->drainList.front())) {
+ cachePort->drainList.pop_front();
+ if (!cachePort->drainList.empty() ||
+ !cachePort->isCpuSide && cachePort->cache->doMasterRequest() ||
+ cachePort->isCpuSide && cachePort->cache->doSlaveRequest())
+ this->schedule(curTick + 1);
+ }
+ else cachePort->waitingOnRetry = true;
+ }
+ else if (!cachePort->isCpuSide)
{
- //For now, doMasterRequest somehow is still getting set
- if (!cachePort->cache->doMasterRequest()) return;
//MSHR
pkt = cachePort->cache->getPacket();
MSHR* mshr = (MSHR*) pkt->senderState;
DPRINTF(Cache, "Address %x was %s in sending the timing request\n",
pkt->getAddr(), success ? "succesful" : "unsuccesful");
cachePort->cache->sendResult(pkt, mshr, success);
+ cachePort->waitingOnRetry = !success;
if (success && cachePort->cache->doMasterRequest())
{
//Still more to issue, rerequest in 1 cycle
if (!success) {
//Need to send on a retry
cachePort->cshrRetry = pkt;
+ cachePort->waitingOnRetry = true;
}
else if (cachePort->cache->doSlaveRequest())
{
pkt->result = Packet::Success;
pkt->makeTimingResponse();
if (!cachePort->drainList.empty()) {
- //Already blocked waiting for bus, just append
+ //Already have a list, just append
cachePort->drainList.push_back(pkt);
}
else if (!cachePort->sendTiming(pkt)) {
//It failed, save it to list of drain events
cachePort->drainList.push_back(pkt);
+ cachePort->waitingOnRetry = true;
}
}
prefetcher->handleMiss(pkt, curTick);
}
if (!pkt->req->isUncacheable()) {
- if (pkt->isInvalidate() && !pkt->isRead()
- && !pkt->isWrite()) {
- //Upgrade or Invalidate
- //Look into what happens if two slave caches on bus
- DPRINTF(Cache, "%s %x ? blk_addr: %x\n", pkt->cmdString(),
- pkt->getAddr() & (((ULL(1))<<48)-1),
- pkt->getAddr() & ~((Addr)blkSize - 1));
-
- pkt->flags |= SATISFIED;
- //Invalidates/Upgrades need no response if they get the bus
-// return MA_HIT; //@todo, return values
- return true;
- }
blk = tags->handleAccess(pkt, lat, writebacks);
} else {
size = pkt->getSize();
// clear dirty bit if write through
if (pkt->needsResponse())
respond(pkt, curTick+lat);
-// return MA_HIT;
+ if (pkt->cmd == Packet::Writeback) {
+ //Signal that you can kill the pkt/req
+ pkt->flags |= SATISFIED;
+ }
return true;
}
Cache<TagStore,Buffering,Coherence>::sendResult(PacketPtr &pkt, MSHR* mshr, bool success)
{
if (success && !(pkt->flags & NACKED_LINE)) {
- missQueue->markInService(pkt, mshr);
- //Temp Hack for UPGRADES
- if (pkt->cmd == Packet::UpgradeReq) {
- pkt->flags &= ~CACHE_LINE_FILL;
- BlkType *blk = tags->findBlock(pkt);
- CacheBlk::State old_state = (blk) ? blk->status : 0;
- CacheBlk::State new_state = coherence->getNewState(pkt,old_state);
- DPRINTF(Cache, "Block for blk addr %x moving from state %i to %i\n",
+ missQueue->markInService(pkt, mshr);
+ //Temp Hack for UPGRADES
+ if (pkt->cmd == Packet::UpgradeReq) {
+ pkt->flags &= ~CACHE_LINE_FILL;
+ BlkType *blk = tags->findBlock(pkt);
+ CacheBlk::State old_state = (blk) ? blk->status : 0;
+ CacheBlk::State new_state = coherence->getNewState(pkt,old_state);
+ DPRINTF(Cache, "Block for blk addr %x moving from state %i to %i\n",
pkt->getAddr() & (((ULL(1))<<48)-1), old_state, new_state);
- //Set the state on the upgrade
- memcpy(pkt->getPtr<uint8_t>(), blk->data, blkSize);
- PacketList writebacks;
- tags->handleFill(blk, mshr, new_state, writebacks, pkt);
- assert(writebacks.empty());
- missQueue->handleResponse(pkt, curTick + hitLatency);
- }
+ //Set the state on the upgrade
+ memcpy(pkt->getPtr<uint8_t>(), blk->data, blkSize);
+ PacketList writebacks;
+ tags->handleFill(blk, mshr, new_state, writebacks, pkt);
+ assert(writebacks.empty());
+ missQueue->handleResponse(pkt, curTick + hitLatency);
+ }
} else if (pkt && !pkt->req->isUncacheable()) {
pkt->flags &= ~NACKED_LINE;
pkt->flags &= ~SATISFIED;