summaryrefslogtreecommitdiff
path: root/src/mem/cache/tags/fa_lru.cc
diff options
context:
space:
mode:
authorDaniel R. Carvalho <odanrc@yahoo.com.br>2018-03-09 14:53:17 +0100
committerDaniel Carvalho <odanrc@yahoo.com.br>2018-04-06 08:23:16 +0000
commitaffbf2a6086631e724949cf5764ba55f4e40423d (patch)
tree03a89a651477a2c933614821829ab95b150f5539 /src/mem/cache/tags/fa_lru.cc
parentf7c6d86009c03a953da25df8f29186d6cc07eff3 (diff)
downloadgem5-affbf2a6086631e724949cf5764ba55f4e40423d.tar.xz
mem-cache: Move insertBlock functionality in FALRU
Block insertion is being done in the getCandidates function, while the insertBlock function does not do anything. Besides, BaseTags' stats weren't being updated. Change-Id: Iadab9c1ea61519214f66fa24c4b91c4fc95604c0 Reviewed-on: https://gem5-review.googlesource.com/8882 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
Diffstat (limited to 'src/mem/cache/tags/fa_lru.cc')
-rw-r--r--src/mem/cache/tags/fa_lru.cc36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc
index 1f2909e31..652abc360 100644
--- a/src/mem/cache/tags/fa_lru.cc
+++ b/src/mem/cache/tags/fa_lru.cc
@@ -169,6 +169,9 @@ FALRU::invalidate(CacheBlk *blk)
{
// TODO: We need to move the block to the tail to make it the next victim
BaseTags::invalidate(blk);
+
+ // Erase block entry in the hash table
+ tagHash.erase(blk->tag);
}
CacheBlk*
@@ -250,28 +253,27 @@ FALRU::findBlockBySetAndWay(int set, int way) const
CacheBlk*
FALRU::findVictim(Addr addr)
{
- FALRUBlk * blk = tail;
- assert(blk->inCache == 0);
- moveToHead(blk);
- tagHash.erase(blk->tag);
- tagHash[blkAlign(addr)] = blk;
- if (blk->isValid()) {
- replacements[0]++;
- } else {
- tagsInUse++;
- if (!warmedUp && tagsInUse.value() >= warmupBound) {
- warmedUp = true;
- warmupCycle = curTick();
- }
- }
- //assert(check());
-
- return blk;
+ return tail;
}
void
FALRU::insertBlock(PacketPtr pkt, CacheBlk *blk)
{
+ FALRUBlk* falruBlk = static_cast<FALRUBlk*>(blk);
+
+ // Make sure block is not present in the cache
+ assert(falruBlk->inCache == 0);
+
+ // Do common block insertion functionality
+ BaseTags::insertBlock(pkt, blk);
+
+ // New block is the MRU
+ moveToHead(falruBlk);
+
+ // Insert new block in the hash table
+ tagHash[falruBlk->tag] = falruBlk;
+
+ //assert(check());
}
void