From 403c0158f57090dbbd4b21166887eb53b13a7fc6 Mon Sep 17 00:00:00 2001 From: Nikos Nikoleris Date: Tue, 1 May 2018 12:02:14 +0100 Subject: [PATCH] mem-cache: Simplify writeback for the tempBlock in recvTimingResp When we use the tempBlock to fill-in, we have to write it back and invalidate it at the end of current transaction. This patch simplifies the writeback flow by treating it as a regular writeback. Change-Id: I257be7bbff211e2832ad001a4e991daf67704485 Reviewed-on: https://gem5-review.googlesource.com/10421 Reviewed-by: Daniel Carvalho Reviewed-by: Jason Lowe-Power Maintainer: Nikos Nikoleris --- src/mem/cache/cache.cc | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/src/mem/cache/cache.cc b/src/mem/cache/cache.cc index 2d3ab8312..b9625beee 100644 --- a/src/mem/cache/cache.cc +++ b/src/mem/cache/cache.cc @@ -1611,33 +1611,17 @@ Cache::recvTimingResp(PacketPtr pkt) // reset the xbar additional timinig as it is now accounted for pkt->headerDelay = pkt->payloadDelay = 0; - // copy writebacks to write buffer - doWritebacks(writebacks, forward_time); - // if we used temp block, check to see if its valid and then clear it out if (blk == tempBlock && tempBlock->isValid()) { - // We use forwardLatency here because we are copying - // Writebacks/CleanEvicts to write buffer. It specifies the latency to - // allocate an internal buffer and to schedule an event to the - // queued port. - if (blk->isDirty() || writebackClean) { - PacketPtr wbPkt = writebackBlk(blk); - allocateWriteBuffer(wbPkt, forward_time); - // Set BLOCK_CACHED flag if cached above. - if (isCachedAbove(wbPkt)) - wbPkt->setBlockCached(); - } else { - PacketPtr wcPkt = cleanEvictBlk(blk); - // Check to see if block is cached above. If not allocate - // write buffer - if (isCachedAbove(wcPkt)) - delete wcPkt; - else - allocateWriteBuffer(wcPkt, forward_time); - } - invalidateBlock(blk); + PacketPtr wb_pkt = tempBlock->isDirty() || writebackClean ? + writebackBlk(blk) : cleanEvictBlk(blk); + writebacks.push_back(wb_pkt); + invalidateBlock(tempBlock); } + // copy writebacks to write buffer + doWritebacks(writebacks, forward_time); + DPRINTF(CacheVerbose, "%s: Leaving with %s\n", __func__, pkt->print()); delete pkt; } -- 2.30.2