diff options
Diffstat (limited to 'src/mem/cache/tags/base.cc')
-rw-r--r-- | src/mem/cache/tags/base.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mem/cache/tags/base.cc b/src/mem/cache/tags/base.cc index d2d6e8eef..d467019f6 100644 --- a/src/mem/cache/tags/base.cc +++ b/src/mem/cache/tags/base.cc @@ -76,6 +76,54 @@ BaseTags::setCache(BaseCache *_cache) } void +BaseTags::insertBlock(PacketPtr pkt, CacheBlk *blk) +{ + // Get address + Addr addr = pkt->getAddr(); + + // Update warmup data + 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 + MasterID master_id = pkt->req->masterId(); + assert(master_id < cache->system->maxMasters()); + occupancies[master_id]++; + blk->srcMasterId = master_id; + + // Set task id + blk->task_id = pkt->req->taskId(); + + // We only need to write into one tag and one data block. + tagAccesses += 1; + dataAccesses += 1; +} + +void BaseTags::regStats() { ClockedObject::regStats(); |