summaryrefslogtreecommitdiff
path: root/src/mem/cache/tags/lru.cc
diff options
context:
space:
mode:
authorLena Olson <lena@cs.wisc.edu>2012-09-11 14:14:49 -0400
committerLena Olson <lena@cs.wisc.edu>2012-09-11 14:14:49 -0400
commit584eba3ab66c8f95e2344cf7115ec2fb13604eb1 (patch)
treea616f7cd709a46c6c1fe3c55d4d190f02e5261c7 /src/mem/cache/tags/lru.cc
parentfe5deb4a22260b3e67839fb1efa978cff51e79ba (diff)
downloadgem5-584eba3ab66c8f95e2344cf7115ec2fb13604eb1.tar.xz
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.
Diffstat (limited to 'src/mem/cache/tags/lru.cc')
-rw-r--r--src/mem/cache/tags/lru.cc32
1 files changed, 15 insertions, 17 deletions
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