345,346d344
< // Note that lat is passed by reference here. The function
< // access() will set the lat value.
349c347,352
< bool satisfied = access(pkt, blk, lat);
---
> bool satisfied = false;
> {
> PacketList writebacks;
> // Note that lat is passed by reference here. The function
> // access() will set the lat value.
> satisfied = access(pkt, blk, lat, writebacks);
350a354,359
> // After the evicted blocks are selected, they must be forwarded
> // to the write buffer to ensure they logically precede anything
> // happening below
> doWritebacks(writebacks, clockEdge(lat + forwardLatency));
> }
>
450a460,461
> PacketList writebacks;
>
467c478
< blk = handleFill(pkt, blk, allocate);
---
> blk = handleFill(pkt, blk, writebacks, allocate);
523c534
< evictBlock(blk, clockEdge(forwardLatency) + pkt->headerDelay);
---
> evictBlock(blk, writebacks);
525a537,540
> const Tick forward_time = clockEdge(forwardLatency) + pkt->headerDelay;
> // copy writebacks to write buffer
> doWritebacks(writebacks, forward_time);
>
543c558,559
< bool satisfied = access(pkt, blk, lat);
---
> PacketList writebacks;
> bool satisfied = access(pkt, blk, lat, writebacks);
552a569
> writebacks.push_back(wb_pkt);
554d570
< doWritebacksAtomic(wb_pkt);
556a573,577
> // handle writebacks resulting from the access here to ensure they
> // logically precede anything happening below
> doWritebacksAtomic(writebacks);
> assert(writebacks.empty());
>
558c579
< lat += handleAtomicReqMiss(pkt, blk);
---
> lat += handleAtomicReqMiss(pkt, blk, writebacks);
571a593,595
> // do any writebacks resulting from the response handling
> doWritebacksAtomic(writebacks);
>
779c803
< uint32_t delay, Cycles tag_latency)
---
> PacketList &writebacks)
869,870c893
< Cycles lat = calculateAccessLatency(evict_blk, delay, tag_latency);
< evictBlock(evict_blk, clockEdge(lat + forwardLatency));
---
> evictBlock(evict_blk, writebacks);
1004c1027,1028
< BaseCache::access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat)
---
> BaseCache::access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat,
> PacketList &writebacks)
1103c1127
< blk = allocateBlock(pkt, tag_latency);
---
> blk = allocateBlock(pkt, writebacks);
1122c1146
< pkt->headerDelay, tag_latency)) {
---
> writebacks)) {
1198c1222
< blk = allocateBlock(pkt, tag_latency);
---
> blk = allocateBlock(pkt, writebacks);
1221c1245
< pkt->headerDelay, tag_latency)) {
---
> writebacks)) {
1314c1338,1339
< BaseCache::handleFill(PacketPtr pkt, CacheBlk *blk, bool allocate)
---
> BaseCache::handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks,
> bool allocate)
1331,1336c1356,1358
< // Need to do a replacement if allocating, otherwise we stick
< // with the temporary storage. The tag lookup has already been
< // done to decide the eviction victims, so it is set to 0 here.
< // The eviction itself, however, is delayed until the new data
< // for the block that is requesting the replacement arrives.
< blk = allocate ? allocateBlock(pkt, Cycles(0)) : nullptr;
---
> // need to do a replacement if allocating, otherwise we stick
> // with the temporary storage
> blk = allocate ? allocateBlock(pkt, writebacks) : nullptr;
1437c1459
< BaseCache::allocateBlock(const PacketPtr pkt, Cycles tag_latency)
---
> BaseCache::allocateBlock(const PacketPtr pkt, PacketList &writebacks)
1510,1512c1532
< Cycles lat =
< calculateAccessLatency(blk, pkt->headerDelay, tag_latency);
< evictBlock(blk, clockEdge(lat + forwardLatency));
---
> evictBlock(blk, writebacks);
1545c1565
< BaseCache::evictBlock(CacheBlk *blk, Tick forward_timing)
---
> BaseCache::evictBlock(CacheBlk *blk, PacketList &writebacks)
1549,1553c1569
< if (system->isTimingMode()) {
< doWritebacks(pkt, forward_timing);
< } else {
< doWritebacksAtomic(pkt);
< }
---
> writebacks.push_back(pkt);
1822c1838,1840
< doWritebacks(wb_pkt, 0);
---
> PacketList writebacks;
> writebacks.push_back(wb_pkt);
> doWritebacks(writebacks, 0);