39 #include "debug/CacheComp.hh" 44 #include "params/CompressedTags.hh" 59 unsigned blk_index = 0;
60 for (
unsigned superblock_index = 0; superblock_index <
numSectors;
64 SuperBlk* superblock = &superBlks[superblock_index];
80 blk = &
blks[blk_index];
105 const std::size_t compressed_size,
115 SuperBlk* victim_superblock =
nullptr;
116 bool is_co_allocation =
false;
118 for (
const auto& entry : superblock_entries){
120 if ((tag == superblock->
getTag()) && superblock->
isValid() &&
121 (is_secure == superblock->
isSecure()) &&
122 !superblock->
blks[offset]->isValid() &&
126 victim_superblock = superblock;
127 is_co_allocation =
true;
134 if (victim_superblock ==
nullptr){
136 victim_superblock =
static_cast<SuperBlk*
>(
140 for (
const auto& blk : victim_superblock->
blks){
141 if (blk->isValid()) {
142 evict_blks.push_back(blk);
152 if (is_co_allocation){
156 DPRINTF(CacheComp,
"Co-Allocation: offset %d with blocks\n", offset);
157 for (
const auto& blk : victim_superblock->
blks){
158 if (blk->isValid()) {
159 DPRINTFR(CacheComp,
"\t[%s]\n", blk->print());
178 const bool is_co_allocatable = superblock->
isCompressed() &&
185 if (is_co_allocatable) {
212 CompressedTagsParams::create()
const SectorBlk * getSectorBlock() const
Get sector block associated to this block.
bool isValid() const
Checks that a block is valid.
virtual std::vector< ReplaceableEntry * > getPossibleEntries(const Addr addr) const =0
Find all possible entries for insertion and replacement of an address.
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 setUncompressed()
Clear compression bit.
virtual ReplaceableEntry * getVictim(const ReplacementCandidates &candidates) const =0
Find replacement victim among candidates.
bool isValid() const
Checks that a sector block is valid.
std::size_t getSizeBits() const
Addr getTag() const
Get tag associated to this block.
bool canCoAllocate(const std::size_t compressed_size) const
Checks whether a superblock can co-allocate given compressed data block.
std::shared_ptr< ReplacementData > replacementData
Replacement data associated to this entry.
A superblock is composed of sub-blocks, and each sub-block has information regarding its superblock a...
void setSectorBlock(SectorBlk *sector_blk)
Set sector block associated to this block.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
virtual std::shared_ptr< ReplacementData > instantiateEntry()=0
Instantiate a replacement data entry.
void setSectorOffset(const int sector_offset)
Set offset of this sub-block within the sector.
void setCompressed()
Set compression bit.
void setEntry(ReplaceableEntry *entry, const uint64_t index)
Associate a pointer to an entry to its physical counterpart.
Declaration of the Packet class.
bool isCompressed(const CompressionBlk *ignored_blk=nullptr) const
Returns whether the superblock contains compressed blocks or not.
bool isSecure() const
Checks that a sector block is secure.
void setBlkSize(const std::size_t blk_size)
Set block size.
A basic compression superblock.
uint8_t * data
Contains a copy of the data in this block for easy access.