diff options
-rw-r--r-- | src/mem/cache/cache.cc | 16 | ||||
-rw-r--r-- | src/mem/cache/tags/base.hh | 8 | ||||
-rw-r--r-- | src/mem/cache/tags/base_set_assoc.hh | 12 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.hh | 10 | ||||
-rw-r--r-- | src/mem/cache/tags/lru.cc | 4 | ||||
-rw-r--r-- | src/mem/cache/tags/random_repl.cc | 2 |
6 files changed, 29 insertions, 23 deletions
diff --git a/src/mem/cache/cache.cc b/src/mem/cache/cache.cc index 7bf073419..85c96772c 100644 --- a/src/mem/cache/cache.cc +++ b/src/mem/cache/cache.cc @@ -1659,8 +1659,8 @@ Cache::writebackBlk(CacheBlk *blk) writebacks[Request::wbMasterId]++; - Request *req = new Request(tags->regenerateBlkAddr(blk->tag, blk->set), - blkSize, 0, Request::wbMasterId); + Request *req = new Request(tags->regenerateBlkAddr(blk), blkSize, 0, + Request::wbMasterId); if (blk->isSecure()) req->setFlags(Request::SECURE); @@ -1694,8 +1694,8 @@ Cache::writebackBlk(CacheBlk *blk) PacketPtr Cache::writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id) { - Request *req = new Request(tags->regenerateBlkAddr(blk->tag, blk->set), - blkSize, 0, Request::wbMasterId); + Request *req = new Request(tags->regenerateBlkAddr(blk), blkSize, 0, + Request::wbMasterId); if (blk->isSecure()) { req->setFlags(Request::SECURE); } @@ -1737,7 +1737,7 @@ Cache::cleanEvictBlk(CacheBlk *blk) assert(blk && blk->isValid() && !blk->isDirty()); // Creating a zero sized write, a message to the snoop filter Request *req = - new Request(tags->regenerateBlkAddr(blk->tag, blk->set), blkSize, 0, + new Request(tags->regenerateBlkAddr(blk), blkSize, 0, Request::wbMasterId); if (blk->isSecure()) req->setFlags(Request::SECURE); @@ -1780,8 +1780,8 @@ Cache::writebackVisitor(CacheBlk &blk) if (blk.isDirty()) { assert(blk.isValid()); - Request request(tags->regenerateBlkAddr(blk.tag, blk.set), - blkSize, 0, Request::funcMasterId); + Request request(tags->regenerateBlkAddr(&blk), blkSize, 0, + Request::funcMasterId); request.taskId(blk.task_id); if (blk.isSecure()) { request.setFlags(Request::SECURE); @@ -1823,7 +1823,7 @@ Cache::allocateBlock(Addr addr, bool is_secure, PacketList &writebacks) return nullptr; if (blk->isValid()) { - Addr repl_addr = tags->regenerateBlkAddr(blk->tag, blk->set); + Addr repl_addr = tags->regenerateBlkAddr(blk); MSHR *repl_mshr = mshrQueue.findMatch(repl_addr, blk->isSecure()); if (repl_mshr) { // must be an outstanding upgrade request diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh index dfd8aeb62..9e7242c1b 100644 --- a/src/mem/cache/tags/base.hh +++ b/src/mem/cache/tags/base.hh @@ -255,7 +255,13 @@ class BaseTags : public ClockedObject virtual void insertBlock(PacketPtr pkt, CacheBlk *blk) = 0; - virtual Addr regenerateBlkAddr(Addr tag, unsigned set) const = 0; + /** + * Regenerate the block address. + * + * @param block The block. + * @return the block address. + */ + virtual Addr regenerateBlkAddr(const CacheBlk* blk) const = 0; virtual CacheBlk* findVictim(Addr addr) = 0; diff --git a/src/mem/cache/tags/base_set_assoc.hh b/src/mem/cache/tags/base_set_assoc.hh index 835b0cfd4..1fd739110 100644 --- a/src/mem/cache/tags/base_set_assoc.hh +++ b/src/mem/cache/tags/base_set_assoc.hh @@ -301,14 +301,14 @@ public: } /** - * Regenerate the block address from the tag. - * @param tag The tag of the block. - * @param set The set of the block. - * @return The block address. + * Regenerate the block address from the tag and set. + * + * @param block The block. + * @return the block address. */ - Addr regenerateBlkAddr(Addr tag, unsigned set) const override + Addr regenerateBlkAddr(const CacheBlk* blk) const override { - return ((tag << tagShift) | ((Addr)set << setShift)); + return ((blk->tag << tagShift) | ((Addr)blk->set << setShift)); } /** diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh index a266fb516..559f56e28 100644 --- a/src/mem/cache/tags/fa_lru.hh +++ b/src/mem/cache/tags/fa_lru.hh @@ -242,14 +242,14 @@ public: } /** - * Regenerate the block address from the tag and the set. - * @param tag The tag of the block. - * @param set The set the block belongs to. + * Regenerate the block address from the tag. + * + * @param block The block. * @return the block address. */ - Addr regenerateBlkAddr(Addr tag, unsigned set) const override + Addr regenerateBlkAddr(const CacheBlk* blk) const override { - return (tag); + return blk->tag; } /** diff --git a/src/mem/cache/tags/lru.cc b/src/mem/cache/tags/lru.cc index 5fc48b963..4302a8de6 100644 --- a/src/mem/cache/tags/lru.cc +++ b/src/mem/cache/tags/lru.cc @@ -64,7 +64,7 @@ LRU::accessBlock(Addr addr, bool is_secure, Cycles &lat) // move this block to head of the MRU list sets[blk->set].moveToHead(blk); DPRINTF(CacheRepl, "set %x: moving blk %x (%s) to MRU\n", - blk->set, regenerateBlkAddr(blk->tag, blk->set), + blk->set, regenerateBlkAddr(blk), is_secure ? "s" : "ns"); } @@ -88,7 +88,7 @@ LRU::findVictim(Addr addr) if (blk && blk->isValid()) { DPRINTF(CacheRepl, "set %x: selecting blk %x for replacement\n", - set, regenerateBlkAddr(blk->tag, set)); + set, regenerateBlkAddr(blk)); } return blk; diff --git a/src/mem/cache/tags/random_repl.cc b/src/mem/cache/tags/random_repl.cc index c06b12096..aa5f6fcb9 100644 --- a/src/mem/cache/tags/random_repl.cc +++ b/src/mem/cache/tags/random_repl.cc @@ -86,7 +86,7 @@ RandomRepl::findVictim(Addr addr) assert(blk->way < allocAssoc); DPRINTF(CacheRepl, "set %x: selecting blk %x for replacement\n", - blk->set, regenerateBlkAddr(blk->tag, blk->set)); + blk->set, regenerateBlkAddr(blk)); } return blk; |