gem5 v24.0.0.0
|
A basic compression superblock. More...
#include <super_blk.hh>
Public Member Functions | |
SuperBlk () | |
SuperBlk (const SuperBlk &)=delete | |
SuperBlk & | operator= (const SuperBlk &)=delete |
~SuperBlk () | |
bool | isCompressed (const CompressionBlk *ignored_blk=nullptr) const |
Returns whether the superblock contains compressed blocks or not. | |
bool | canCoAllocate (const std::size_t compressed_size) const |
Checks whether a superblock can co-allocate given compressed data block. | |
void | setBlkSize (const std::size_t blk_size) |
Set block size. | |
uint8_t | calculateCompressionFactor (const std::size_t size) const |
Calculate the compression factor (cf) given a compressed size and the maximum compression ratio. | |
uint8_t | getCompressionFactor () const |
Get the compression factor of this superblock. | |
void | setCompressionFactor (const uint8_t compression_factor) |
Set the compression factor of this superblock. | |
void | invalidate () override |
Invalidate the block. | |
std::string | print () const override |
Print relevant information for this sector block and its sub-blocks. | |
Public Member Functions inherited from gem5::SectorBlk | |
SectorBlk () | |
SectorBlk (const SectorBlk &)=delete | |
SectorBlk & | operator= (const SectorBlk &)=delete |
~SectorBlk () | |
bool | isValid () const override |
Checks that a sector block is valid. | |
uint8_t | getNumValid () const |
Get the number of sub-blocks that have been validated. | |
void | validateSubBlk () |
Increase the number of valid sub-blocks. | |
void | invalidateSubBlk () |
Decrease the number of valid sub-blocks. | |
void | setPosition (const uint32_t set, const uint32_t way) override |
Sets the position of the sub-entries, besides its own. | |
Public Member Functions inherited from gem5::TaggedEntry | |
TaggedEntry () | |
~TaggedEntry ()=default | |
bool | isSecure () const |
Check if this block holds data from the secure memory space. | |
virtual bool | matchTag (Addr tag, bool is_secure) const |
Checks if the given tag information corresponds to this entry's. | |
virtual void | insert (const Addr tag, const bool is_secure) |
Insert the block by assigning it a tag and marking it valid. | |
void | invalidate () override |
Invalidate the block. | |
std::string | print () const override |
Prints relevant information about this entry. | |
bool | matchTag (const Addr tag) const override |
Checks if the given tag information corresponds to this entry's. | |
void | insert (const Addr tag) override |
Insert the block by assigning it a tag and marking it valid. | |
Public Member Functions inherited from gem5::CacheEntry | |
CacheEntry ()=default | |
~CacheEntry ()=default | |
virtual Addr | getTag () const |
Get tag associated to this block. | |
Public Member Functions inherited from gem5::ReplaceableEntry | |
ReplaceableEntry () | |
virtual | ~ReplaceableEntry ()=default |
uint32_t | getSet () const |
Get set number. | |
uint32_t | getWay () const |
Get way number. | |
Protected Attributes | |
std::size_t | blkSize |
Block size, in bytes. | |
uint8_t | compressionFactor |
Superblock's compression factor. | |
Protected Attributes inherited from gem5::ReplaceableEntry | |
uint32_t | _set |
Set to which this entry belongs. | |
uint32_t | _way |
Way (relative position within the set) to which this entry belongs. | |
Additional Inherited Members | |
Public Attributes inherited from gem5::SectorBlk | |
std::vector< SectorSubBlk * > | blks |
List of blocks associated to this sector. | |
Public Attributes inherited from gem5::ReplaceableEntry | |
std::shared_ptr< replacement_policy::ReplacementData > | replacementData |
Replacement data associated to this entry. | |
Protected Member Functions inherited from gem5::TaggedEntry | |
virtual void | setSecure () |
Set secure bit. | |
Protected Member Functions inherited from gem5::CacheEntry | |
virtual void | setTag (Addr _tag) |
Set tag associated to this block. | |
virtual void | setValid () |
Set valid bit. | |
A basic compression superblock.
Contains the tag and a list of blocks associated to this superblock.
Definition at line 170 of file super_blk.hh.
gem5::SuperBlk::SuperBlk | ( | ) |
Definition at line 171 of file super_blk.cc.
|
delete |
|
inline |
Definition at line 187 of file super_blk.hh.
uint8_t gem5::SuperBlk::calculateCompressionFactor | ( | const std::size_t | size | ) | const |
Calculate the compression factor (cf) given a compressed size and the maximum compression ratio.
Therefore cf is: 1 if comp_size > blk_size/2, 2 if comp_size > blk_size/4, 4 if comp_size > blk_size/8, 8 if comp_size > blk_size/16, and so on.
size | The compressed size. |
Definition at line 214 of file super_blk.cc.
References gem5::alignToPowerOfTwo(), gem5::SectorBlk::blks, and blkSize.
Referenced by gem5::CompressionBlk::checkExpansionContraction(), and gem5::CompressionBlk::setSizeBits().
bool gem5::SuperBlk::canCoAllocate | ( | const std::size_t | compressed_size | ) | const |
Checks whether a superblock can co-allocate given compressed data block.
compressed_size | Size, in bits, of new block to allocate. |
Definition at line 197 of file super_blk.cc.
References blkSize, getCompressionFactor(), and gem5::SectorBlk::getNumValid().
Referenced by gem5::CompressedTags::findVictim().
uint8_t gem5::SuperBlk::getCompressionFactor | ( | ) | const |
Get the compression factor of this superblock.
Definition at line 227 of file super_blk.cc.
References compressionFactor.
Referenced by canCoAllocate(), gem5::CompressionBlk::checkExpansionContraction(), and print().
|
overridevirtual |
Invalidate the block.
Its contents are no longer valid.
Reimplemented from gem5::CacheEntry.
Definition at line 177 of file super_blk.cc.
References compressionFactor, and gem5::CacheEntry::invalidate().
bool gem5::SuperBlk::isCompressed | ( | const CompressionBlk * | ignored_blk = nullptr | ) | const |
Returns whether the superblock contains compressed blocks or not.
By default, if not blocks are valid, the superblock is compressible.
ignored_blk | If provided don't consider the given block. |
Definition at line 184 of file super_blk.cc.
References gem5::SectorBlk::blks, and isCompressed().
Referenced by gem5::CompressedTags::findVictim(), isCompressed(), and gem5::CompressionBlk::setSizeBits().
|
overridevirtual |
Print relevant information for this sector block and its sub-blocks.
Reimplemented from gem5::SectorBlk.
Definition at line 244 of file super_blk.cc.
References gem5::csprintf(), getCompressionFactor(), and gem5::SectorBlk::print().
Referenced by gem5::CompressedTags::findVictim().
void gem5::SuperBlk::setBlkSize | ( | const std::size_t | blk_size | ) |
Set block size.
Should be called only once, when initializing blocks.
blk_size | The uncompressed block size. |
Definition at line 207 of file super_blk.cc.
References blkSize.
Referenced by gem5::CompressedTags::tagsInit().
void gem5::SuperBlk::setCompressionFactor | ( | const uint8_t | compression_factor | ) |
Set the compression factor of this superblock.
compression_factor | The new compression factor. |
Definition at line 233 of file super_blk.cc.
References compressionFactor, and gem5::SectorBlk::getNumValid().
Referenced by gem5::CompressionBlk::setSizeBits().
|
protected |
Block size, in bytes.
Definition at line 174 of file super_blk.hh.
Referenced by calculateCompressionFactor(), canCoAllocate(), and setBlkSize().
|
protected |
Superblock's compression factor.
It is aligned to be a power of two, limited by the maximum compression ratio, and calculated as: compressionFactor = uncompressedSize/compressedSize
Definition at line 181 of file super_blk.hh.
Referenced by getCompressionFactor(), invalidate(), and setCompressionFactor().