mem-cache: Use ReplaceableEntry in findBlockBySetAndWay
With a sector cache you can't find a block using only its set and way, as there is the sector offset to take into account. As all of these blocks inherit from ReplaceableEntry, the return type of this function has been updated. This function has also been declared closer to findBlock() due to their similar functionality. Change-Id: I4730a2b4ebb5738f7fc118201e208a1b9c3ba8e8 Reviewed-on: https://gem5-review.googlesource.com/10141 Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com> Maintainer: Nikos Nikoleris <nikos.nikoleris@arm.com>
This commit is contained in:
committed by
Daniel Carvalho
parent
b2d3cc00e8
commit
815b12fb4a
17
src/mem/cache/tags/base.hh
vendored
17
src/mem/cache/tags/base.hh
vendored
@@ -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.
|
||||
|
||||
2
src/mem/cache/tags/base_set_assoc.cc
vendored
2
src/mem/cache/tags/base_set_assoc.cc
vendored
@@ -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];
|
||||
|
||||
17
src/mem/cache/tags/base_set_assoc.hh
vendored
17
src/mem/cache/tags/base_set_assoc.hh
vendored
@@ -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.
|
||||
*
|
||||
|
||||
2
src/mem/cache/tags/fa_lru.cc
vendored
2
src/mem/cache/tags/fa_lru.cc
vendored
@@ -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);
|
||||
|
||||
17
src/mem/cache/tags/fa_lru.hh
vendored
17
src/mem/cache/tags/fa_lru.hh
vendored
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user