# Node ID ded42ff6f410d4041a43c50a3a7284d2ef440eae # Parent 3147f3a868f79f5094d1cf7b1d2dbd77bf034ac1 diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -1729,45 +1729,43 @@ DPRINTF(Cache, "Snoop hit in writeback to addr: %x (%s)\n", pkt->getAddr(), is_secure ? "s" : "ns"); - //Look through writebacks for any non-uncachable writes, use that - if (writebacks.size()) { - // We should only ever find a single match - assert(writebacks.size() == 1); - mshr = writebacks[0]; - assert(!mshr->isUncacheable()); - assert(mshr->getNumTargets() == 1); - PacketPtr wb_pkt = mshr->getTarget()->pkt; - assert(wb_pkt->cmd == MemCmd::Writeback); + // Look through writebacks for any cachable writes. + // We should only ever find a single match. + assert(writebacks.size() == 1); + MSHR *wb_entry = writebacks[0]; + assert(!wb_entry->isUncacheable()); + assert(wb_entry->getNumTargets() == 1); + PacketPtr wb_pkt = wb_entry->getTarget()->pkt; + assert(wb_pkt->cmd == MemCmd::Writeback); - // Squash prefetch requests from below on write buffer hits - if (pkt->cmd == MemCmd::HardPFReq) { - DPRINTF(Cache, "Squashing prefetch from lower cache on " - "write buffer hit %#x\n", pkt->getAddr()); - pkt->setPrefetchSquashed(); - return; - } + // Squash prefetch requests from below on write buffer hits + if (pkt->cmd == MemCmd::HardPFReq) { + DPRINTF(Cache, "Squashing prefetch from lower cache on " + "write buffer hit %#x\n", pkt->getAddr()); + pkt->setPrefetchSquashed(); + return; + } - assert(!pkt->memInhibitAsserted()); - pkt->assertMemInhibit(); - if (!pkt->needsExclusive()) { - pkt->assertShared(); - // the writeback is no longer the exclusive copy in the system - wb_pkt->clearSupplyExclusive(); - } else { - // if we're not asserting the shared line, we need to - // invalidate our copy. we'll do that below as long as - // the packet's invalidate flag is set... - assert(pkt->isInvalidate()); - } - doTimingSupplyResponse(pkt, wb_pkt->getConstPtr(), - false, false); + assert(!pkt->memInhibitAsserted()); + pkt->assertMemInhibit(); + if (!pkt->needsExclusive()) { + pkt->assertShared(); + // the writeback is no longer the exclusive copy in the system + wb_pkt->clearSupplyExclusive(); + } else { + // if we're not asserting the shared line, we need to + // invalidate our copy. we'll do that below as long as + // the packet's invalidate flag is set... + assert(pkt->isInvalidate()); + } + doTimingSupplyResponse(pkt, wb_pkt->getConstPtr(), + false, false); - if (pkt->isInvalidate()) { - // Invalidation trumps our writeback... discard here - markInService(mshr, false); - delete wb_pkt; - } - } // writebacks.size() + if (pkt->isInvalidate()) { + // Invalidation trumps our writeback... discard here + markInService(wb_entry, false); + delete wb_pkt; + } } // If this was a shared writeback, there may still be