gem5 v24.0.0.0
Loading...
Searching...
No Matches
gem5::SuperBlk Class Reference

A basic compression superblock. More...

#include <super_blk.hh>

Inheritance diagram for gem5::SuperBlk:
gem5::SectorBlk gem5::TaggedEntry gem5::CacheEntry gem5::ReplaceableEntry

Public Member Functions

 SuperBlk ()
 
 SuperBlk (const SuperBlk &)=delete
 
SuperBlkoperator= (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
 
SectorBlkoperator= (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::ReplacementDatareplacementData
 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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ SuperBlk() [1/2]

gem5::SuperBlk::SuperBlk ( )

Definition at line 171 of file super_blk.cc.

◆ SuperBlk() [2/2]

gem5::SuperBlk::SuperBlk ( const SuperBlk & )
delete

◆ ~SuperBlk()

gem5::SuperBlk::~SuperBlk ( )
inline

Definition at line 187 of file super_blk.hh.

Member Function Documentation

◆ calculateCompressionFactor()

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.

Parameters
sizeThe compressed size.
Returns
Compression factor corresponding to the 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().

◆ canCoAllocate()

bool gem5::SuperBlk::canCoAllocate ( const std::size_t compressed_size) const

Checks whether a superblock can co-allocate given compressed data block.

Parameters
compressed_sizeSize, in bits, of new block to allocate.
Returns
True if block can be co-allocated in superblock.

Definition at line 197 of file super_blk.cc.

References blkSize, getCompressionFactor(), and gem5::SectorBlk::getNumValid().

Referenced by gem5::CompressedTags::findVictim().

◆ getCompressionFactor()

uint8_t gem5::SuperBlk::getCompressionFactor ( ) const

Get the compression factor of this superblock.

Returns
The compression factor.

Definition at line 227 of file super_blk.cc.

References compressionFactor.

Referenced by canCoAllocate(), gem5::CompressionBlk::checkExpansionContraction(), and print().

◆ invalidate()

void gem5::SuperBlk::invalidate ( )
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().

◆ isCompressed()

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.

Parameters
ignored_blkIf provided don't consider the given block.
Returns
The compressibility state of the superblock.

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().

◆ operator=()

SuperBlk & gem5::SuperBlk::operator= ( const SuperBlk & )
delete

◆ print()

std::string gem5::SuperBlk::print ( ) const
overridevirtual

Print relevant information for this sector block and its sub-blocks.

Returns
A string with the contents of the sector block.

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().

◆ setBlkSize()

void gem5::SuperBlk::setBlkSize ( const std::size_t blk_size)

Set block size.

Should be called only once, when initializing blocks.

Parameters
blk_sizeThe uncompressed block size.

Definition at line 207 of file super_blk.cc.

References blkSize.

Referenced by gem5::CompressedTags::tagsInit().

◆ setCompressionFactor()

void gem5::SuperBlk::setCompressionFactor ( const uint8_t compression_factor)

Set the compression factor of this superblock.

Parameters
compression_factorThe new compression factor.

Definition at line 233 of file super_blk.cc.

References compressionFactor, and gem5::SectorBlk::getNumValid().

Referenced by gem5::CompressionBlk::setSizeBits().

Member Data Documentation

◆ blkSize

std::size_t gem5::SuperBlk::blkSize
protected

Block size, in bytes.

Definition at line 174 of file super_blk.hh.

Referenced by calculateCompressionFactor(), canCoAllocate(), and setBlkSize().

◆ compressionFactor

uint8_t gem5::SuperBlk::compressionFactor
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().


The documentation for this class was generated from the following files:

Generated on Tue Jun 18 2024 16:24:15 for gem5 by doxygen 1.11.0