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

Private Attributes

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

Additional Inherited Members

- Public Attributes inherited from gem5::CacheBlk
uint8_t * data
 Contains a copy of the data in this block for easy access. More...
 
Tick whenReady
 Which curTick() will this block be accessible. 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::CacheBlk
void setTaskId (const uint32_t task_id)
 Set the task id value. More...
 
void setSrcRequestorId (const uint32_t id)
 Set the source requestor id. More...
 
void setRefCount (const unsigned count)
 Set the number of references to this block since insertion. More...
 
void setTickInserted ()
 Set the current tick as this block's insertion tick. 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...
 
- Protected Attributes inherited from gem5::SectorSubBlk
SectorBlk_sectorBlk
 Sector block associated to this block. More...
 
int _sectorOffset
 The offset of this sub-block in the sector. More...
 
- 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. More...
 
unsigned coherence
 The current coherence status of this block. 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...
 

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 inform sector block.

Reimplemented from gem5::SectorSubBlk.

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

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 Sep 21 2021 12:27:24 for gem5 by doxygen 1.8.17