diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh index 358ad1003d..167364ff1d 100644 --- a/src/mem/cache/tags/base.hh +++ b/src/mem/cache/tags/base.hh @@ -195,6 +195,15 @@ class BaseTags : public ClockedObject */ virtual CacheBlk * findBlock(Addr addr, bool is_secure) const = 0; + /** + * Find a block given set and way. + * + * @param set The set of the block. + * @param way The way of the block. + * @return The block. + */ + virtual ReplaceableEntry* findBlockBySetAndWay(int set, int way) const = 0; + /** * Align an address to the block size. * @param addr the address to align. @@ -215,14 +224,6 @@ class BaseTags : public ClockedObject return (addr & blkMask); } - /** - * Find the cache block given set and way - * @param set The set of the block. - * @param way The way of the block. - * @return The cache block. - */ - virtual CacheBlk *findBlockBySetAndWay(int set, int way) const = 0; - /** * Limit the allocation for the cache ways. * @param ways The maximum number of ways available for replacement. diff --git a/src/mem/cache/tags/base_set_assoc.cc b/src/mem/cache/tags/base_set_assoc.cc index 9cd93dbea9..ae98dcf3d5 100644 --- a/src/mem/cache/tags/base_set_assoc.cc +++ b/src/mem/cache/tags/base_set_assoc.cc @@ -126,7 +126,7 @@ BaseSetAssoc::findBlock(Addr addr, bool is_secure) const return blk; } -CacheBlk* +ReplaceableEntry* BaseSetAssoc::findBlockBySetAndWay(int set, int way) const { return sets[set].blks[way]; diff --git a/src/mem/cache/tags/base_set_assoc.hh b/src/mem/cache/tags/base_set_assoc.hh index 830af6f3d7..4755662684 100644 --- a/src/mem/cache/tags/base_set_assoc.hh +++ b/src/mem/cache/tags/base_set_assoc.hh @@ -129,14 +129,6 @@ class BaseSetAssoc : public BaseTags */ void invalidate(CacheBlk *blk) override; - /** - * Find the cache block given set and way - * @param set The set of the block. - * @param way The way of the block. - * @return The cache block. - */ - CacheBlk *findBlockBySetAndWay(int set, int way) const override; - /** * Access block and update replacement data. May not succeed, in which case * nullptr is returned. This has all the implications of a cache @@ -198,6 +190,15 @@ class BaseSetAssoc : public BaseTags */ CacheBlk* findBlock(Addr addr, bool is_secure) const override; + /** + * Find a block given set and way. + * + * @param set The set of the block. + * @param way The way of the block. + * @return The block. + */ + ReplaceableEntry* findBlockBySetAndWay(int set, int way) const override; + /** * Find replacement victim based on address. * diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc index 29dab3b642..a6e1b3be14 100644 --- a/src/mem/cache/tags/fa_lru.cc +++ b/src/mem/cache/tags/fa_lru.cc @@ -185,7 +185,7 @@ FALRU::findBlock(Addr addr, bool is_secure) const return blk; } -CacheBlk* +ReplaceableEntry* FALRU::findBlockBySetAndWay(int set, int way) const { assert(set == 0); diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh index dbb39b7d10..22b67c534d 100644 --- a/src/mem/cache/tags/fa_lru.hh +++ b/src/mem/cache/tags/fa_lru.hh @@ -185,6 +185,15 @@ class FALRU : public BaseTags */ CacheBlk* findBlock(Addr addr, bool is_secure) const override; + /** + * Find a block given set and way. + * + * @param set The set of the block. + * @param way The way of the block. + * @return The block. + */ + ReplaceableEntry* findBlockBySetAndWay(int set, int way) const override; + /** * Find replacement victim based on address. * @@ -201,14 +210,6 @@ class FALRU : public BaseTags */ void insertBlock(PacketPtr pkt, CacheBlk *blk) override; - /** - * Find the cache block given set and way - * @param set The set of the block. - * @param way The way of the block. - * @return The cache block. - */ - CacheBlk* findBlockBySetAndWay(int set, int way) const override; - /** * Generate the tag from the addres. For fully associative this is just the * block address.