72 fatal_if(!
p.indexing_policy,
"An indexing policy is required");
76 "Block size must be at least 4 and a power of 2");
78 "# of blocks per sector must be non-zero and a power of 2");
80 "Using cache partitioning policies with sector and/or compressed "
81 "tags is not fully tested.");
92 unsigned blk_index = 0;
93 for (
unsigned sec_blk_index = 0; sec_blk_index <
numSectors;
109 blk = &
blks[blk_index];
148 assert(
stats.tagsInUse.value() >= 0);
165 if (blk !=
nullptr) {
166 stats.dataAccesses += 1;
173 if (blk !=
nullptr) {
220 const bool dest_was_valid =
239 if (!src_sector_blk->
isValid()) {
243 if (dest_was_valid) {
247 assert(
stats.tagsInUse.value() >= 0);
249 }
else if (!dest_was_valid) {
256 if (dest_was_valid) {
275 for (
const auto& sector : entries) {
277 if (blk->match(key)) {
288 const std::size_t
size,
290 const uint64_t partition_id)
302 for (
const auto& sector : sector_entries) {
304 if (sector_blk->
match(key)) {
305 victim_sector = sector_blk;
311 if (victim_sector ==
nullptr){
315 if (sector_entries.size() == 0){
329 if (victim_sector->
match(key)) {
335 for (
const auto& blk : victim_sector->
blks){
336 if (blk->isValid()) {
337 evict_blks.push_back(blk);
343 sectorStats.evictionsReplacement[evict_blks.size()]++;
359 const Addr sec_addr =
369 "Number of blocks evicted due to a replacement")
379 for (
unsigned i = 0;
i <=
tags.numBlocksPerSector; ++
i) {
382 "the eviction of " + std::to_string(
i) +
" blocks");
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
void increaseRefCount()
Get the number of references to this block since insertion.
uint8_t * data
Contains a copy of the data in this block for easy access.
Cycles is a wrapper class for representing cycle counts, i.e.
std::shared_ptr< replacement_policy::ReplacementData > replacementData
Replacement data associated to this entry.
std::vector< SectorSubBlk * > blks
List of blocks associated to this sector.
bool isValid() const override
Checks that a sector block is valid.
A sector is composed of sub-blocks, and each sub-block has information regarding its sector and a poi...
int getSectorOffset() const
Get offset of this sub-block within the sector.
void setSectorBlock(SectorBlk *sector_blk)
Set sector block associated to this block.
void setSectorOffset(const int sector_offset)
Set offset of this sub-block within the sector.
SectorBlk * getSectorBlock() const
Get sector block associated to this block.
virtual bool isValid() const
Checks if the entry is valid.
bool match(const KeyType &key) const
Checks if the given tag information corresponds to this entry's.
TaggedTypes::KeyType KeyType
bool isSecure() const
Check if this block holds data from the secure memory space.
virtual Addr getTag() const
Get tag associated to this block.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
static constexpr std::enable_if_t< std::is_integral_v< T >, int > floorLog2(T x)
static constexpr bool isPowerOf2(const T &n)
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
virtual void regStats()
Callback to set stat parameters.
#define warn_if(cond,...)
Conditional warning macro that checks the supplied condition and only prints a warning if the conditi...
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.