49#include "debug/CacheComp.hh"
55#include "params/CompressedTags.hh"
73 unsigned blk_index = 0;
74 for (
unsigned superblock_index = 0; superblock_index <
numSectors;
94 blk = &
blks[blk_index];
119 const std::size_t compressed_size,
121 const uint64_t partition_id=0)
136 SuperBlk* victim_superblock =
nullptr;
137 bool is_co_allocation =
false;
139 for (
const auto& entry : superblock_entries){
141 if (superblock->
matchTag(tag, is_secure) &&
146 victim_superblock = superblock;
147 is_co_allocation =
true;
154 if (victim_superblock ==
nullptr){
158 if (superblock_entries.size() == 0){
163 victim_superblock =
static_cast<SuperBlk*
>(
167 for (
const auto& blk : victim_superblock->
blks){
168 if (blk->isValid()) {
169 evict_blks.push_back(blk);
179 if (is_co_allocation){
183 DPRINTF(CacheComp,
"Co-Allocation: offset %d of %s\n",
offset,
184 victim_superblock->
print());
void setEntry(ReplaceableEntry *entry, const uint64_t index)
Associate a pointer to an entry to its physical counterpart.
virtual std::vector< ReplaceableEntry * > getPossibleEntries(const Addr addr) const =0
Find all possible entries for insertion and replacement of an address.
uint8_t * data
Contains a copy of the data in this block for easy access.
virtual bool isValid() const
Checks if the entry is valid.
A superblock is composed of sub-blocks, and each sub-block has information regarding its superblock a...
std::shared_ptr< replacement_policy::ReplacementData > replacementData
Replacement data associated to this entry.
std::vector< SectorSubBlk * > blks
List of blocks associated to this sector.
A sector is composed of sub-blocks, and each sub-block has information regarding its sector and a poi...
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.
A basic compression superblock.
std::string print() const override
Print relevant information for this sector block and its sub-blocks.
bool isCompressed(const CompressionBlk *ignored_blk=nullptr) const
Returns whether the superblock contains compressed blocks or not.
void setBlkSize(const std::size_t blk_size)
Set block size.
bool canCoAllocate(const std::size_t compressed_size) const
Checks whether a superblock can co-allocate given compressed data block.
virtual bool matchTag(Addr tag, bool is_secure) const
Checks if the given tag information corresponds to this entry's.
void filterByPartition(std::vector< ReplaceableEntry * > &entries, const uint64_t partition_id) const
virtual ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const =0
Find replacement victim among candidates.
virtual std::shared_ptr< ReplacementData > instantiateEntry()=0
Instantiate a replacement data entry.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Declaration of the Packet class.