diff options
author | Lisa Hsu <hsul@eecs.umich.edu> | 2008-11-04 11:35:58 -0500 |
---|---|---|
committer | Lisa Hsu <hsul@eecs.umich.edu> | 2008-11-04 11:35:58 -0500 |
commit | c68032ddcbf0aad10123710e7c7c932bf52061a0 (patch) | |
tree | 1bbeeb7adc7012716bf51c6546d7a52a3267226d /src/mem/cache/cache_impl.hh | |
parent | 4ab52cb986962f7c0fb0fa07de10d8cdfb51458a (diff) | |
download | gem5-c68032ddcbf0aad10123710e7c7c932bf52061a0.tar.xz |
decouple eviction from insertion in the cache.
Diffstat (limited to 'src/mem/cache/cache_impl.hh')
-rw-r--r-- | src/mem/cache/cache_impl.hh | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/mem/cache/cache_impl.hh b/src/mem/cache/cache_impl.hh index af179ff91..40d1c9c2f 100644 --- a/src/mem/cache/cache_impl.hh +++ b/src/mem/cache/cache_impl.hh @@ -319,6 +319,7 @@ Cache<TagStore>::access(PacketPtr pkt, BlkType *&blk, incMissCount(pkt); return false; } + tags->insertBlock(pkt->getAddr(), blk); blk->status = BlkValid | BlkReadable; } std::memcpy(blk->data, pkt->getPtr<uint8_t>(), blkSize); @@ -879,7 +880,7 @@ template<class TagStore> typename Cache<TagStore>::BlkType* Cache<TagStore>::allocateBlock(Addr addr, PacketList &writebacks) { - BlkType *blk = tags->findReplacement(addr, writebacks); + BlkType *blk = tags->findVictim(addr, writebacks); if (blk->isValid()) { Addr repl_addr = tags->regenerateBlkAddr(blk->tag, blk->set); @@ -890,6 +891,7 @@ Cache<TagStore>::allocateBlock(Addr addr, PacketList &writebacks) assert(!blk->isWritable()); assert(repl_mshr->needsExclusive()); // too hard to replace block with transient state + // allocation failed, block not inserted return NULL; } else { DPRINTF(Cache, "replacement: replacing %x with %x: %s\n", @@ -903,8 +905,6 @@ Cache<TagStore>::allocateBlock(Addr addr, PacketList &writebacks) } } - // Set tag for new block. Caller is responsible for setting status. - blk->tag = tags->extractTag(addr); return blk; } @@ -937,6 +937,8 @@ Cache<TagStore>::handleFill(PacketPtr pkt, BlkType *blk, tempBlock->set = tags->extractSet(addr); tempBlock->tag = tags->extractTag(addr); DPRINTF(Cache, "using temp block for %x\n", addr); + } else { + tags->insertBlock(addr, blk); } } else { // existing block... probably an upgrade |