gem5  v21.1.0.2
Public Member Functions | Protected Attributes | List of all members
gem5::SuperBlk Class Reference

A basic compression superblock. More...

#include <super_blk.hh>

Inheritance diagram for gem5::SuperBlk:
gem5::SectorBlk gem5::TaggedEntry 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. 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...
 
- 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. 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...
 
- Public Member Functions inherited from gem5::TaggedEntry
 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...
 
- Public Member Functions inherited from gem5::ReplaceableEntry
 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...
 
- Protected Attributes inherited from gem5::ReplaceableEntry
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

- Public Attributes inherited from gem5::SectorBlk
std::vector< SectorSubBlk * > blks
 List of blocks associated to this sector. More...
 
- Public Attributes inherited from gem5::ReplaceableEntry
std::shared_ptr< replacement_policy::ReplacementDatareplacementData
 Replacement data associated to this entry. More...
 
- Protected Member Functions inherited from gem5::TaggedEntry
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...
 

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::TaggedEntry.

Definition at line 177 of file super_blk.cc.

References compressionFactor, and gem5::TaggedEntry::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.

Referenced by gem5::CompressedTags::findVictim(), 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 Sep 21 2021 12:28:14 for gem5 by doxygen 1.8.17