diff options
-rw-r--r-- | src/mem/cache/base.cc | 6 | ||||
-rw-r--r-- | src/mem/cache/tags/base.hh | 3 | ||||
-rw-r--r-- | src/mem/cache/tags/base_set_assoc.hh | 3 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.cc | 2 | ||||
-rw-r--r-- | src/mem/cache/tags/fa_lru.hh | 2 | ||||
-rw-r--r-- | src/mem/cache/tags/sector_tags.cc | 2 | ||||
-rw-r--r-- | src/mem/cache/tags/sector_tags.hh | 3 |
7 files changed, 18 insertions, 3 deletions
diff --git a/src/mem/cache/base.cc b/src/mem/cache/base.cc index f31fbaf03..36968a18d 100644 --- a/src/mem/cache/base.cc +++ b/src/mem/cache/base.cc @@ -1319,9 +1319,13 @@ BaseCache::allocateBlock(const PacketPtr pkt, PacketList &writebacks) // Get secure bit const bool is_secure = pkt->isSecure(); + // @todo Compress and get compression related data + std::size_t blk_size_bits = blkSize*8; + // Find replacement victim std::vector<CacheBlk*> evict_blks; - CacheBlk *victim = tags->findVictim(addr, is_secure, evict_blks); + CacheBlk *victim = tags->findVictim(addr, is_secure, blk_size_bits, + evict_blks); // It is valid to return nullptr if there is no victim if (!victim) diff --git a/src/mem/cache/tags/base.hh b/src/mem/cache/tags/base.hh index 296837e50..ae9cab87e 100644 --- a/src/mem/cache/tags/base.hh +++ b/src/mem/cache/tags/base.hh @@ -50,6 +50,7 @@ #define __MEM_CACHE_TAGS_BASE_HH__ #include <cassert> +#include <cstdint> #include <functional> #include <string> @@ -276,10 +277,12 @@ class BaseTags : public ClockedObject * * @param addr Address to find a victim for. * @param is_secure True if the target memory space is secure. + * @param size Size, in bits, of new block to allocate. * @param evict_blks Cache blocks to be evicted. * @return Cache block to be replaced. */ virtual CacheBlk* findVictim(Addr addr, const bool is_secure, + const std::size_t size, std::vector<CacheBlk*>& evict_blks) const = 0; /** diff --git a/src/mem/cache/tags/base_set_assoc.hh b/src/mem/cache/tags/base_set_assoc.hh index c39a81335..f58f93951 100644 --- a/src/mem/cache/tags/base_set_assoc.hh +++ b/src/mem/cache/tags/base_set_assoc.hh @@ -48,6 +48,7 @@ #ifndef __MEM_CACHE_TAGS_BASE_SET_ASSOC_HH__ #define __MEM_CACHE_TAGS_BASE_SET_ASSOC_HH__ +#include <cstdint> #include <functional> #include <string> #include <vector> @@ -160,10 +161,12 @@ class BaseSetAssoc : public BaseTags * * @param addr Address to find a victim for. * @param is_secure True if the target memory space is secure. + * @param size Size, in bits, of new block to allocate. * @param evict_blks Cache blocks to be evicted. * @return Cache block to be replaced. */ CacheBlk* findVictim(Addr addr, const bool is_secure, + const std::size_t size, std::vector<CacheBlk*>& evict_blks) const override { // Get possible entries to be victimized diff --git a/src/mem/cache/tags/fa_lru.cc b/src/mem/cache/tags/fa_lru.cc index 4cdac0ac0..0ebef4be7 100644 --- a/src/mem/cache/tags/fa_lru.cc +++ b/src/mem/cache/tags/fa_lru.cc @@ -196,7 +196,7 @@ FALRU::findBlockBySetAndWay(int set, int way) const } CacheBlk* -FALRU::findVictim(Addr addr, const bool is_secure, +FALRU::findVictim(Addr addr, const bool is_secure, const std::size_t size, std::vector<CacheBlk*>& evict_blks) const { // The victim is always stored on the tail for the FALRU diff --git a/src/mem/cache/tags/fa_lru.hh b/src/mem/cache/tags/fa_lru.hh index 346ff60c7..2ca9f4da4 100644 --- a/src/mem/cache/tags/fa_lru.hh +++ b/src/mem/cache/tags/fa_lru.hh @@ -219,10 +219,12 @@ class FALRU : public BaseTags * * @param addr Address to find a victim for. * @param is_secure True if the target memory space is secure. + * @param size Size, in bits, of new block to allocate. * @param evict_blks Cache blocks to be evicted. * @return Cache block to be replaced. */ CacheBlk* findVictim(Addr addr, const bool is_secure, + const std::size_t size, std::vector<CacheBlk*>& evict_blks) const override; /** diff --git a/src/mem/cache/tags/sector_tags.cc b/src/mem/cache/tags/sector_tags.cc index 06093e997..535badb8d 100644 --- a/src/mem/cache/tags/sector_tags.cc +++ b/src/mem/cache/tags/sector_tags.cc @@ -221,7 +221,7 @@ SectorTags::findBlock(Addr addr, bool is_secure) const } CacheBlk* -SectorTags::findVictim(Addr addr, const bool is_secure, +SectorTags::findVictim(Addr addr, const bool is_secure, const std::size_t size, std::vector<CacheBlk*>& evict_blks) const { // Get possible entries to be victimized diff --git a/src/mem/cache/tags/sector_tags.hh b/src/mem/cache/tags/sector_tags.hh index 84c721ef7..13638b4a5 100644 --- a/src/mem/cache/tags/sector_tags.hh +++ b/src/mem/cache/tags/sector_tags.hh @@ -36,6 +36,7 @@ #ifndef __MEM_CACHE_TAGS_SECTOR_TAGS_HH__ #define __MEM_CACHE_TAGS_SECTOR_TAGS_HH__ +#include <cstdint> #include <string> #include <vector> @@ -150,10 +151,12 @@ class SectorTags : public BaseTags * * @param addr Address to find a victim for. * @param is_secure True if the target memory space is secure. + * @param size Size, in bits, of new block to allocate. * @param evict_blks Cache blocks to be evicted. * @return Cache block to be replaced. */ CacheBlk* findVictim(Addr addr, const bool is_secure, + const std::size_t size, std::vector<CacheBlk*>& evict_blks) const override; /** |