gem5
v21.0.1.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. More... | |
bool | canCoAllocate (const std::size_t compressed_size) const |
Checks whether a superblock can co-allocate given compressed data block. More... | |
void | setBlkSize (const std::size_t blk_size) |
Set block size. More... | |
uint8_t | calculateCompressionFactor (const std::size_t size) const |
Calculate the compression factor (cf) given a compressed size and the maximum compression ratio. More... | |
uint8_t | getCompressionFactor () const |
Get the compression factor of this superblock. More... | |
void | setCompressionFactor (const uint8_t compression_factor) |
Set the compression factor of this superblock. More... | |
void | invalidate () override |
Invalidate the block. More... | |
std::string | print () const override |
Print relevant information for this sector block and its sub-blocks. More... | |
![]() | |
SectorBlk () | |
SectorBlk (const SectorBlk &)=delete | |
SectorBlk & | operator= (const SectorBlk &)=delete |
~SectorBlk () | |
bool | isValid () const override |
Checks that a sector block is valid. More... | |
uint8_t | getNumValid () const |
Get the number of sub-blocks that have been validated. More... | |
void | validateSubBlk () |
Increase the number of valid sub-blocks. More... | |
void | invalidateSubBlk () |
Decrease the number of valid sub-blocks. More... | |
void | setPosition (const uint32_t set, const uint32_t way) override |
Sets the position of the sub-entries, besides its own. More... | |
![]() | |
TaggedEntry () | |
~TaggedEntry ()=default | |
bool | isSecure () const |
Check if this block holds data from the secure memory space. More... | |
virtual Addr | getTag () const |
Get tag associated to this block. More... | |
virtual bool | matchTag (Addr tag, bool is_secure) const |
Checks if the given tag information corresponds to this entry's. More... | |
virtual void | insert (const Addr tag, const bool is_secure) |
Insert the block by assigning it a tag and marking it valid. More... | |
std::string | print () const override |
Prints relevant information about this entry. More... | |
![]() | |
ReplaceableEntry ()=default | |
virtual | ~ReplaceableEntry ()=default |
uint32_t | getSet () const |
Get set number. More... | |
uint32_t | getWay () const |
Get way number. More... | |
Protected Attributes | |
std::size_t | blkSize |
Block size, in bytes. More... | |
uint8_t | compressionFactor |
Superblock's compression factor. More... | |
![]() | |
uint32_t | _set |
Set to which this entry belongs. More... | |
uint32_t | _way |
Way (relative position within the set) to which this entry belongs. More... | |
Additional Inherited Members | |
![]() | |
std::vector< SectorSubBlk * > | blks |
List of blocks associated to this sector. More... | |
![]() | |
std::shared_ptr< ReplacementPolicy::ReplacementData > | replacementData |
Replacement data associated to this entry. More... | |
![]() | |
virtual void | setTag (Addr tag) |
Set tag associated to this block. More... | |
virtual void | setSecure () |
Set secure bit. More... | |
virtual void | setValid () |
Set valid bit. More... | |
A basic compression superblock.
Contains the tag and a list of blocks associated to this superblock.
Definition at line 167 of file super_blk.hh.
SuperBlk::SuperBlk | ( | ) |
Definition at line 168 of file super_blk.cc.
|
delete |
|
inline |
Definition at line 184 of file super_blk.hh.
uint8_t 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 211 of file super_blk.cc.
References alignToPowerOfTwo(), SectorBlk::blks, and blkSize.
Referenced by CompressionBlk::checkExpansionContraction(), and CompressionBlk::setSizeBits().
bool 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 194 of file super_blk.cc.
References blkSize, getCompressionFactor(), and SectorBlk::getNumValid().
Referenced by CompressedTags::findVictim().
uint8_t SuperBlk::getCompressionFactor | ( | ) | const |
Get the compression factor of this superblock.
Definition at line 224 of file super_blk.cc.
References compressionFactor.
Referenced by canCoAllocate(), CompressionBlk::checkExpansionContraction(), and print().
|
overridevirtual |
Invalidate the block.
Its contents are no longer valid.
Reimplemented from TaggedEntry.
Definition at line 174 of file super_blk.cc.
References compressionFactor, and TaggedEntry::invalidate().
bool 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 181 of file super_blk.cc.
References SectorBlk::blks.
Referenced by CompressedTags::findVictim(), and CompressionBlk::setSizeBits().
|
overridevirtual |
Print relevant information for this sector block and its sub-blocks.
Reimplemented from SectorBlk.
Definition at line 241 of file super_blk.cc.
References csprintf(), getCompressionFactor(), and SectorBlk::print().
Referenced by CompressedTags::findVictim().
void 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 204 of file super_blk.cc.
References blkSize.
Referenced by CompressedTags::tagsInit().
void SuperBlk::setCompressionFactor | ( | const uint8_t | compression_factor | ) |
Set the compression factor of this superblock.
compression_factor | The new compression factor. |
Definition at line 230 of file super_blk.cc.
References compressionFactor, and SectorBlk::getNumValid().
Referenced by CompressionBlk::setSizeBits().
|
protected |
Block size, in bytes.
Definition at line 171 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 178 of file super_blk.hh.
Referenced by getCompressionFactor(), invalidate(), and setCompressionFactor().