From 584eba3ab66c8f95e2344cf7115ec2fb13604eb1 Mon Sep 17 00:00:00 2001 From: Lena Olson Date: Tue, 11 Sep 2012 14:14:49 -0400 Subject: Cache: Split invalidateBlk up to seperate block vs. tags This seperates the functionality to clear the state in a block into blk.hh and the functionality to udpate the tag information into the tags. This gets rid of the case where calling invalidateBlk on an already-invalid block does something different than calling it on a valid block, which was confusing. --- src/mem/cache/tags/lru.cc | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'src/mem/cache/tags/lru.cc') diff --git a/src/mem/cache/tags/lru.cc b/src/mem/cache/tags/lru.cc index c73f557b9..8d32d4b35 100644 --- a/src/mem/cache/tags/lru.cc +++ b/src/mem/cache/tags/lru.cc @@ -92,7 +92,7 @@ LRU::LRU(unsigned _numSets, unsigned _blkSize, unsigned _assoc, ++blkIndex; // invalidate new cache block - blk->status = 0; + blk->invalidate(); //EGH Fix Me : do we need to initialize blk? @@ -186,8 +186,11 @@ LRU::insertBlock(Addr addr, BlkType *blk, int master_id) // deal with evicted block assert(blk->srcMasterId < cache->system->maxMasters()); occupancies[blk->srcMasterId]--; + + blk->invalidate(); } + blk->isTouched = true; // Set tag for new block. Caller is responsible for setting status. blk->tag = extractTag(addr); @@ -201,23 +204,18 @@ LRU::insertBlock(Addr addr, BlkType *blk, int master_id) } void -LRU::invalidateBlk(BlkType *blk) +LRU::invalidate(BlkType *blk) { - if (blk) { - if (blk->isValid()) { - tagsInUse--; - assert(blk->srcMasterId < cache->system->maxMasters()); - occupancies[blk->srcMasterId]--; - blk->srcMasterId = Request::invldMasterId; - } - blk->status = 0; - blk->isTouched = false; - blk->clearLoadLocks(); - - // should be evicted before valid blocks - unsigned set = blk->set; - sets[set].moveToTail(blk); - } + assert(blk); + assert(blk->isValid()); + tagsInUse--; + assert(blk->srcMasterId < cache->system->maxMasters()); + occupancies[blk->srcMasterId]--; + blk->srcMasterId = Request::invldMasterId; + + // should be evicted before valid blocks + unsigned set = blk->set; + sets[set].moveToTail(blk); } void -- cgit v1.2.3