diff options
author | Daniel R. Carvalho <odanrc@yahoo.com.br> | 2018-03-09 14:53:17 +0100 |
---|---|---|
committer | Daniel Carvalho <odanrc@yahoo.com.br> | 2018-04-06 08:23:16 +0000 |
commit | affbf2a6086631e724949cf5764ba55f4e40423d (patch) | |
tree | 03a89a651477a2c933614821829ab95b150f5539 /src/mem/cache/tags/base_set_assoc.hh | |
parent | f7c6d86009c03a953da25df8f29186d6cc07eff3 (diff) | |
download | gem5-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/base_set_assoc.hh')
-rw-r--r-- | src/mem/cache/tags/base_set_assoc.hh | 56 |
1 files changed, 10 insertions, 46 deletions
diff --git a/src/mem/cache/tags/base_set_assoc.hh b/src/mem/cache/tags/base_set_assoc.hh index 3bc275b28..ed9997608 100644 --- a/src/mem/cache/tags/base_set_assoc.hh +++ b/src/mem/cache/tags/base_set_assoc.hh @@ -212,55 +212,19 @@ class BaseSetAssoc : public BaseTags } /** - * Insert the new block into the cache. + * Insert the new block into the cache and update replacement data. + * * @param pkt Packet holding the address to update * @param blk The block to update. */ - void insertBlock(PacketPtr pkt, CacheBlk *blk) override - { - Addr addr = pkt->getAddr(); - MasterID master_id = pkt->req->masterId(); - uint32_t task_id = pkt->req->taskId(); - - if (!blk->isTouched) { - if (!warmedUp && tagsInUse.value() >= warmupBound) { - warmedUp = true; - warmupCycle = curTick(); - } - } - - // If we're replacing a block that was previously valid update - // stats for it. This can't be done in findBlock() because a - // found block might not actually be replaced there if the - // coherence protocol says it can't be. - if (blk->isValid()) { - replacements[0]++; - totalRefs += blk->refCount; - ++sampledRefs; - - invalidate(blk); - blk->invalidate(); - } - - // Previous block, if existed, has been removed, and now we have - // to insert the new one - tagsInUse++; - - // Set tag for new block. Caller is responsible for setting status. - blk->tag = extractTag(addr); - - // deal with what we are bringing in - assert(master_id < cache->system->maxMasters()); - occupancies[master_id]++; - blk->srcMasterId = master_id; - blk->task_id = task_id; - - // We only need to write into one tag and one data block. - tagAccesses += 1; - dataAccesses += 1; - - replacementPolicy->reset(blk); - } + void insertBlock(PacketPtr pkt, CacheBlk *blk) override + { + // Insert block + BaseTags::insertBlock(pkt, blk); + + // Update replacement policy + replacementPolicy->reset(blk); + } /** * Limit the allocation for the cache ways. |