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

A superblock is composed of sub-blocks, and each sub-block has information regarding its superblock and a pointer to its superblock tag. More...

#include <super_blk.hh>

Inheritance diagram for gem5::CompressionBlk:
gem5::SectorSubBlk gem5::CacheBlk gem5::TaggedEntry gem5::CacheEntry gem5::ReplaceableEntry

Public Types

enum  OverwriteType : int { DATA_CONTRACTION = -1 , UNCHANGED = 0 , DATA_EXPANSION = 1 }
 When an overwrite happens, the data size may change an not fit in its current container any longer. More...
 
- Public Types inherited from gem5::CacheBlk
enum  CoherenceBits : unsigned { WritableBit = 0x02 , ReadableBit = 0x04 , DirtyBit = 0x08 , AllBits = 0x0E }
 Cache block's enum listing the supported coherence bits. More...
 

Public Member Functions

 CompressionBlk ()
 
 CompressionBlk (const CompressionBlk &)=delete
 
CompressionBlkoperator= (const CompressionBlk &)=delete
 
 CompressionBlk (CompressionBlk &&)=delete
 
CompressionBlkoperator= (CompressionBlk &&other)
 Move assignment operator.
 
CacheBlkoperator= (CacheBlk &&other) override
 Move assignment operator.
 
 ~CompressionBlk ()=default
 
bool isCompressed () const
 Check if this block holds compressed data.
 
void setCompressed ()
 Set compression bit.
 
void setUncompressed ()
 Clear compression bit.
 
std::size_t getSizeBits () const
 
void setSizeBits (const std::size_t size)
 Set size, in bits, of this compressed block's data.
 
Cycles getDecompressionLatency () const
 Get number of cycles needed to decompress this block.
 
void setDecompressionLatency (const Cycles lat)
 Set number of cycles needed to decompress this block.
 
void invalidate () override
 Invalidate the block and clear all state.
 
OverwriteType checkExpansionContraction (const std::size_t size) const
 Determines if changing the size of the block will cause a data expansion (new size is bigger) or contraction (new size is smaller).
 
std::string print () const override
 Pretty-print sector offset and other CacheBlk information.
 
- Public Member Functions inherited from gem5::SectorSubBlk
 SectorSubBlk ()
 
 SectorSubBlk (const SectorSubBlk &)=delete
 
SectorSubBlkoperator= (const SectorSubBlk &)=delete
 
 SectorSubBlk (SectorSubBlk &&)=delete
 
SectorSubBlkoperator= (SectorSubBlk &&other)=default
 Move assignment operator.
 
 ~SectorSubBlk ()=default
 
void setSectorBlock (SectorBlk *sector_blk)
 Set sector block associated to this block.
 
SectorBlkgetSectorBlock () const
 Get sector block associated to this block.
 
void setSectorOffset (const int sector_offset)
 Set offset of this sub-block within the sector.
 
int getSectorOffset () const
 Get offset of this sub-block within the sector.
 
Addr getTag () const override
 Get tag associated to this block.
 
void setValid () override
 Set valid bit and inform sector block.
 
void insert (const Addr tag, const bool is_secure) override
 Insert the block by assigning it a tag and marking it valid.
 
void invalidate () override
 Invalidate the block and inform sector block.
 
std::string print () const override
 Pretty-print sector offset and other CacheBlk information.
 
CacheBlkoperator= (const CacheBlk &)=delete
 
virtual CacheBlkoperator= (CacheBlk &&other)
 Move assignment operator.
 
- Public Member Functions inherited from gem5::CacheBlk
 CacheBlk ()
 
 CacheBlk (const CacheBlk &)=delete
 
CacheBlkoperator= (const CacheBlk &)=delete
 
 CacheBlk (const CacheBlk &&)=delete
 
virtual ~CacheBlk ()
 
void setCoherenceBits (unsigned bits)
 Sets the corresponding coherence bits.
 
void clearCoherenceBits (unsigned bits)
 Clear the corresponding coherence bits.
 
bool isSet (unsigned bits) const
 Checks the given coherence bits are set.
 
bool wasPrefetched () const
 Check if this block was the result of a hardware prefetch, yet to be touched.
 
void clearPrefetched ()
 Clear the prefetching bit.
 
void setPrefetched ()
 Marks this blocks as a recently prefetched block.
 
Tick getWhenReady () const
 Get tick at which block's data will be available for access.
 
void setWhenReady (const Tick tick)
 Set tick at which block's data will be available for access.
 
uint32_t getTaskId () const
 Get the task id associated to this block.
 
uint32_t getSrcRequestorId () const
 Get the requestor id associated to this block.
 
uint64_t getPartitionId () const
 Getter for _partitionId.
 
unsigned getRefCount () const
 Get the number of references to this block since insertion.
 
void increaseRefCount ()
 Get the number of references to this block since insertion.
 
Tick getAge () const
 Get the block's age, that is, the number of ticks since its insertion.
 
void insert (const Addr tag, const bool is_secure, const int src_requestor_ID, const uint32_t task_ID, const uint64_t partition_id)
 Set member variables when a block insertion occurs.
 
void trackLoadLocked (PacketPtr pkt)
 Track the fact that a local locked was issued to the block.
 
void clearLoadLocks (const RequestPtr &req)
 Clear the any load lock that intersect the request, and is from a different context.
 
bool checkWrite (PacketPtr pkt)
 Handle interaction of load-locked operations and stores.
 
void insert (const Addr tag) override
 Insert the block by assigning it a tag and marking it valid.
 
- 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.
 
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 bool isValid () const
 Checks if the entry is valid.
 
- Public Member Functions inherited from gem5::ReplaceableEntry
 ReplaceableEntry ()
 
virtual ~ReplaceableEntry ()=default
 
virtual void setPosition (const uint32_t set, const uint32_t way)
 Set both the set and way.
 
uint32_t getSet () const
 Get set number.
 
uint32_t getWay () const
 Get way number.
 

Private Attributes

std::size_t _size
 Set size, in bits, of this compressed block's data.
 
Cycles _decompressionLatency
 Number of cycles needed to decompress this block.
 
bool _compressed
 Compression bit.
 

Additional Inherited Members

- Public Attributes inherited from gem5::CacheBlk
uint8_t * data = nullptr
 Contains a copy of the data in this block for easy access.
 
Tick whenReady = 0
 Which curTick() will this block be accessible.
 
- Public Attributes inherited from gem5::ReplaceableEntry
std::shared_ptr< replacement_policy::ReplacementDatareplacementData
 Replacement data associated to this entry.
 
- Protected Member Functions inherited from gem5::CacheBlk
void setTaskId (const uint32_t task_id)
 Set the task id value.
 
void setSrcRequestorId (const uint32_t id)
 Set the source requestor id.
 
void setPartitionId (const uint64_t partitionId)
 Setter for _partitionId.
 
void setRefCount (const unsigned count)
 Set the number of references to this block since insertion.
 
void setTickInserted ()
 Set the current tick as this block's insertion tick.
 
- 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.
 
- Protected Attributes inherited from gem5::SectorSubBlk
SectorBlk_sectorBlk
 Sector block associated to this block.
 
int _sectorOffset
 The offset of this sub-block in the sector.
 
- Protected Attributes inherited from gem5::CacheBlk
std::list< LocklockList
 List of thread contexts that have performed a load-locked (LL) on the block since the last store.
 
unsigned coherence
 The current coherence status of this block.
 
- 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.
 

Detailed Description

A superblock is composed of sub-blocks, and each sub-block has information regarding its superblock and a pointer to its superblock tag.

A superblock can be seen as a variation of a sector block, and therefore we use a sector nomenclature.

Definition at line 51 of file super_blk.hh.

Member Enumeration Documentation

◆ OverwriteType

When an overwrite happens, the data size may change an not fit in its current container any longer.

This enum declared which kind of size change happened in this situation.

Enumerator
DATA_CONTRACTION 

New data contents are considered smaller than previous contents.

UNCHANGED 

New and old contents are considered of similar sizes.

DATA_EXPANSION 

New data contents are considered larger than previous contents.

Definition at line 74 of file super_blk.hh.

Constructor & Destructor Documentation

◆ CompressionBlk() [1/3]

gem5::CompressionBlk::CompressionBlk ( )

Definition at line 45 of file super_blk.cc.

◆ CompressionBlk() [2/3]

gem5::CompressionBlk::CompressionBlk ( const CompressionBlk & )
delete

◆ CompressionBlk() [3/3]

gem5::CompressionBlk::CompressionBlk ( CompressionBlk && )
delete

◆ ~CompressionBlk()

gem5::CompressionBlk::~CompressionBlk ( )
default

Member Function Documentation

◆ checkExpansionContraction()

CompressionBlk::OverwriteType gem5::CompressionBlk::checkExpansionContraction ( const std::size_t size) const

Determines if changing the size of the block will cause a data expansion (new size is bigger) or contraction (new size is smaller).

Sizes are not necessarily compared at at bit granularities (e.g., 20 bits is considered equal to 23 bits when blocks use 32-bit spaces as minimum allocation units).

Parameters
sizeThe new compressed size.
Returns
Type of size change.
See also
OverwriteType.

Definition at line 148 of file super_blk.cc.

References gem5::SuperBlk::calculateCompressionFactor(), DATA_CONTRACTION, DATA_EXPANSION, gem5::SuperBlk::getCompressionFactor(), gem5::SectorSubBlk::getSectorBlock(), and UNCHANGED.

Referenced by gem5::BaseCache::updateCompressionData().

◆ getDecompressionLatency()

Cycles gem5::CompressionBlk::getDecompressionLatency ( ) const

Get number of cycles needed to decompress this block.

Returns
Decompression latency.

Definition at line 129 of file super_blk.cc.

References _decompressionLatency.

Referenced by gem5::compression::Base::getDecompressionLatency(), and print().

◆ getSizeBits()

std::size_t gem5::CompressionBlk::getSizeBits ( ) const

Definition at line 93 of file super_blk.cc.

References _size.

Referenced by print(), and gem5::BaseCache::updateCompressionData().

◆ invalidate()

void gem5::CompressionBlk::invalidate ( )
overridevirtual

Invalidate the block and clear all state.

Reimplemented from gem5::CacheBlk.

Definition at line 141 of file super_blk.cc.

References gem5::SectorSubBlk::invalidate(), and setUncompressed().

◆ isCompressed()

bool gem5::CompressionBlk::isCompressed ( ) const

Check if this block holds compressed data.

Returns
True if the block holds compressed data.

Definition at line 75 of file super_blk.cc.

References _compressed.

Referenced by gem5::compression::Base::getDecompressionLatency(), and print().

◆ operator=() [1/3]

CacheBlk & gem5::CompressionBlk::operator= ( CacheBlk && other)
overridevirtual

Move assignment operator.

This should only be used to move an existing valid entry into an invalid one, not to create a new entry. In the end the valid entry will become invalid, and the invalid, valid. All location related variables will remain the same, that is, an entry cannot move its data, just its metadata contents.

Reimplemented from gem5::CacheBlk.

Definition at line 51 of file super_blk.cc.

References operator=().

◆ operator=() [2/3]

CompressionBlk & gem5::CompressionBlk::operator= ( CompressionBlk && other)

Move assignment operator.

This should only be used to move an existing valid entry into an invalid one, not to create a new entry. In the end the valid entry will become invalid, and the invalid, valid. All location related variables will remain the same.

Definition at line 58 of file super_blk.cc.

References gem5::CacheBlk::operator=(), setCompressed(), setDecompressionLatency(), and setUncompressed().

◆ operator=() [3/3]

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

Referenced by operator=().

◆ print()

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

Pretty-print sector offset and other CacheBlk information.

Returns
string with basic state information

Reimplemented from gem5::CacheBlk.

Definition at line 164 of file super_blk.cc.

References gem5::csprintf(), getDecompressionLatency(), getSizeBits(), isCompressed(), and gem5::SectorSubBlk::print().

Referenced by gem5::compression::Base::getDecompressionLatency().

◆ setCompressed()

void gem5::CompressionBlk::setCompressed ( )

Set compression bit.

Definition at line 81 of file super_blk.cc.

References _compressed.

Referenced by operator=(), and setSizeBits().

◆ setDecompressionLatency()

void gem5::CompressionBlk::setDecompressionLatency ( const Cycles lat)

Set number of cycles needed to decompress this block.

Parameters
Decompressionlatency.

Definition at line 135 of file super_blk.cc.

References _decompressionLatency.

Referenced by operator=(), and gem5::BaseCache::updateCompressionData().

◆ setSizeBits()

void gem5::CompressionBlk::setSizeBits ( const std::size_t size)

◆ setUncompressed()

void gem5::CompressionBlk::setUncompressed ( )

Clear compression bit.

Definition at line 87 of file super_blk.cc.

References _compressed.

Referenced by invalidate(), operator=(), and setSizeBits().

Member Data Documentation

◆ _compressed

bool gem5::CompressionBlk::_compressed
private

Compression bit.

Definition at line 66 of file super_blk.hh.

Referenced by isCompressed(), setCompressed(), and setUncompressed().

◆ _decompressionLatency

Cycles gem5::CompressionBlk::_decompressionLatency
private

Number of cycles needed to decompress this block.

We store it to avoid doing decompressions.

Definition at line 63 of file super_blk.hh.

Referenced by getDecompressionLatency(), and setDecompressionLatency().

◆ _size

std::size_t gem5::CompressionBlk::_size
private

Set size, in bits, of this compressed block's data.

Definition at line 57 of file super_blk.hh.

Referenced by getSizeBits(), and setSizeBits().


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

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