mem-cache: Populate whenReady for blocks filled from writebacks
authorNikos Nikoleris <nikos.nikoleris@arm.com>
Mon, 7 Nov 2016 15:51:45 +0000 (15:51 +0000)
committerNikos Nikoleris <nikos.nikoleris@arm.com>
Tue, 6 Mar 2018 14:09:05 +0000 (14:09 +0000)
Writebacks write data to either an existing block or a newly allocated
block. In either case we need to populate the whenReady field of the
block which will determine when the new value can be used.

Change-Id: I5788fad0b8086a1be96714639bf6a9470b334926
Reviewed-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Curtis Dunham <curtis.dunham@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/8285
Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>

src/mem/cache/cache.cc

index 64438c1c84003f6eaa255ae749693b4d339b8c88..7bf073419807c6bc1e7fce0ebb35106484d96e05 100644 (file)
@@ -419,6 +419,9 @@ Cache::access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat,
         std::memcpy(blk->data, pkt->getConstPtr<uint8_t>(), blkSize);
         DPRINTF(Cache, "%s new state is %s\n", __func__, blk->print());
         incHitCount(pkt);
+        // populate the time when the block will be ready to access.
+        blk->whenReady = clockEdge(fillLatency) + pkt->headerDelay +
+            pkt->payloadDelay;
         return true;
     } else if (pkt->cmd == MemCmd::CleanEvict) {
         if (blk != nullptr) {