gem5 v24.0.0.0
|
#include <cache_blk.hh>
Classes | |
class | Lock |
Represents that the indicated thread context has a "lock" on the block, in the LL/SC sense. More... | |
Public Types | |
enum | CoherenceBits : unsigned { WritableBit = 0x02 , ReadableBit = 0x04 , DirtyBit = 0x08 , AllBits = 0x0E } |
Cache block's enum listing the supported coherence bits. More... | |
Public Member Functions | |
CacheBlk () | |
CacheBlk (const CacheBlk &)=delete | |
CacheBlk & | operator= (const CacheBlk &)=delete |
CacheBlk (const CacheBlk &&)=delete | |
virtual CacheBlk & | operator= (CacheBlk &&other) |
Move assignment operator. | |
virtual | ~CacheBlk () |
virtual void | invalidate () override |
Invalidate the block and clear all state. | |
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. | |
std::string | print () const override |
Pretty-print tag, set and way, and interpret state bits to readable form including mapping to a MOESI state. | |
bool | checkWrite (PacketPtr pkt) |
Handle interaction of load-locked operations and stores. | |
virtual void | insert (const Addr tag, const bool is_secure) |
Insert the block by assigning it a tag and marking it valid. | |
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. | |
virtual Addr | getTag () const |
Get tag associated to this block. | |
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. | |
Public Attributes | |
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::ReplacementData > | replacementData |
Replacement data associated to this entry. | |
Protected Member Functions | |
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. | |
virtual void | setValid () |
Set valid bit. | |
Protected Attributes | |
std::list< Lock > | lockList |
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. | |
Private Attributes | |
uint32_t | _taskId = 0 |
Task Id associated with this block. | |
int | _srcRequestorId = 0 |
holds the source requestor ID for this block. | |
uint64_t | _partitionId |
Partition ID of the activity that allocated this block. | |
unsigned | _refCount = 0 |
Number of references to this block since it was brought in. | |
Tick | _tickInserted = 0 |
Tick on which the block was inserted in the cache. | |
bool | _prefetched = 0 |
Whether this block is an unaccessed hardware prefetch. | |
A Basic Cache block.
Contains information regarding its coherence, prefetching status, as well as a pointer to its data.
Definition at line 71 of file cache_blk.hh.
enum gem5::CacheBlk::CoherenceBits : unsigned |
Cache block's enum listing the supported coherence bits.
The valid bit is not defined here because it is part of a TaggedEntry.
Definition at line 78 of file cache_blk.hh.
|
inline |
Definition at line 156 of file cache_blk.hh.
References invalidate().
|
delete |
|
delete |
|
inlinevirtual |
Definition at line 197 of file cache_blk.hh.
|
inline |
Handle interaction of load-locked operations and stores.
Definition at line 420 of file cache_blk.hh.
References clearLoadLocks(), gem5::Packet::isLLSC(), gem5::Packet::isWrite(), gem5::MipsISA::l, lockList, and gem5::Packet::req.
Referenced by gem5::BaseCache::satisfyRequest().
|
inline |
Clear the corresponding coherence bits.
bits | The coherence bits to be cleared. |
Definition at line 234 of file cache_blk.hh.
References coherence.
Referenced by gem5::Cache::handleSnoop(), gem5::BaseCache::handleTimingReqHit(), gem5::BaseCache::handleTimingReqMiss(), invalidate(), gem5::BaseCache::recvTimingResp(), gem5::BaseCache::satisfyRequest(), gem5::Cache::satisfyRequest(), gem5::Cache::serviceMSHRTargets(), gem5::BaseCache::writebackBlk(), gem5::BaseCache::writebackVisitor(), and gem5::BaseCache::writecleanBlk().
|
inline |
Clear the any load lock that intersect the request, and is from a different context.
Definition at line 353 of file cache_blk.hh.
References gem5::MipsISA::l, and lockList.
Referenced by checkWrite().
|
inline |
Clear the prefetching bit.
Either because it was recently used, or due to the block being invalidated.
Definition at line 258 of file cache_blk.hh.
References _prefetched.
Referenced by invalidate(), and gem5::BaseCache::recvTimingReq().
|
inline |
Get the block's age, that is, the number of ticks since its insertion.
Definition at line 308 of file cache_blk.hh.
References _tickInserted, and gem5::curTick().
Referenced by gem5::BaseTags::computeStatsVisitor().
|
inline |
Getter for _partitionId.
Definition at line 294 of file cache_blk.hh.
References _partitionId.
Referenced by gem5::BaseSetAssoc::invalidate(), and gem5::BaseCache::updateCompressionData().
|
inline |
Get the number of references to this block since insertion.
Definition at line 297 of file cache_blk.hh.
References _refCount.
Referenced by gem5::BaseTags::cleanupRefsVisitor(), and gem5::BaseTags::invalidate().
|
inline |
Get the requestor id associated to this block.
Definition at line 291 of file cache_blk.hh.
References _srcRequestorId.
Referenced by gem5::BaseCache::cmpAndSwap(), gem5::BaseCache::hasBeenPrefetched(), gem5::BaseTags::invalidate(), gem5::BaseCache::satisfyRequest(), and gem5::BaseCache::updateBlockData().
|
inline |
Get the task id associated to this block.
Definition at line 288 of file cache_blk.hh.
References _taskId.
Referenced by gem5::Cache::cleanEvictBlk(), gem5::BaseTags::computeStatsVisitor(), gem5::BaseCache::writebackBlk(), gem5::BaseCache::writebackVisitor(), and gem5::BaseCache::writecleanBlk().
|
inline |
Get tick at which block's data will be available for access.
Definition at line 268 of file cache_blk.hh.
References gem5::MaxTick, and whenReady.
Referenced by gem5::BaseCache::calculateAccessLatency().
|
inline |
Get the number of references to this block since insertion.
Definition at line 300 of file cache_blk.hh.
References _refCount.
Referenced by gem5::BaseSetAssoc::accessBlock(), gem5::SectorTags::accessBlock(), and insert().
|
inlineoverridevirtual |
Insert the block by assigning it a tag and marking it valid.
Touches block if it hadn't been touched previously.
tag | The tag value. |
Reimplemented from gem5::CacheEntry.
Definition at line 113 of file tagged_entry.hh.
|
inlinevirtual |
Insert the block by assigning it a tag and marking it valid.
Touches block if it hadn't been touched previously.
tag | The tag value. |
Reimplemented from gem5::TaggedEntry.
Reimplemented in gem5::SectorSubBlk, and gem5::TempCacheBlk.
Definition at line 81 of file tagged_entry.hh.
void gem5::CacheBlk::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.
Resets reference count to 1 (the insertion counts as a reference), and touch block if it hadn't been touched previously. Sets the insertion tick to the current tick. Marks the block valid.
tag | Block address tag. |
is_secure | Whether the block is in secure space or not. |
src_requestor_ID | The source requestor ID. |
task_ID | The new task ID. |
partition_id | The source partition ID. |
Definition at line 50 of file cache_blk.cc.
References increaseRefCount(), insert(), gem5::CacheEntry::isValid(), setPartitionId(), setSrcRequestorId(), setTaskId(), setTickInserted(), and gem5::CacheEntry::tag.
Referenced by insert(), gem5::SectorSubBlk::insert(), gem5::TempCacheBlk::insert(), gem5::BaseTags::insertBlock(), and operator=().
|
inlineoverridevirtual |
Invalidate the block and clear all state.
Reimplemented from gem5::CacheEntry.
Reimplemented in gem5::CompressionBlk, gem5::SectorSubBlk, and gem5::TempCacheBlk.
Definition at line 202 of file cache_blk.hh.
References AllBits, clearCoherenceBits(), clearPrefetched(), gem5::TaggedEntry::invalidate(), gem5::Request::invldRequestorId, lockList, gem5::MaxTick, setPartitionId(), setRefCount(), setSrcRequestorId(), setTaskId(), setWhenReady(), and gem5::context_switch_task_id::Unknown.
Referenced by CacheBlk(), gem5::BaseTags::invalidate(), gem5::SectorSubBlk::invalidate(), and gem5::TempCacheBlk::invalidate().
|
inline |
Checks the given coherence bits are set.
Definition at line 242 of file cache_blk.hh.
References gem5::bits(), coherence, and gem5::CacheEntry::isValid().
Referenced by gem5::BaseCache::access(), gem5::Cache::cleanEvictBlk(), gem5::Cache::createMissPacket(), gem5::Cache::evictBlock(), gem5::NoncoherentCache::evictBlock(), gem5::BaseCache::functionalAccess(), gem5::Cache::handleSnoop(), gem5::BaseCache::handleTimingReqMiss(), gem5::BaseCache::invalidateVisitor(), gem5::BaseCache::isDirty(), gem5::BaseCache::maintainClusivity(), print(), gem5::CacheBlkPrintWrapper::print(), gem5::BaseCache::recvAtomic(), gem5::BaseCache::recvTimingReq(), gem5::BaseCache::recvTimingResp(), gem5::BaseCache::satisfyRequest(), gem5::Cache::satisfyRequest(), gem5::BaseCache::sendMSHRQueuePacket(), gem5::Cache::serviceMSHRTargets(), gem5::BaseCache::writebackBlk(), gem5::BaseCache::writebackVisitor(), and gem5::BaseCache::writecleanBlk().
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 in gem5::CompressionBlk, gem5::FALRUBlk, gem5::SectorSubBlk, and gem5::TempCacheBlk.
Definition at line 173 of file cache_blk.hh.
References gem5::curTick(), insert(), gem5::CacheEntry::isValid(), lockList, setCoherenceBits(), setPartitionId(), setPrefetched(), setRefCount(), setSrcRequestorId(), setTaskId(), and setWhenReady().
Referenced by gem5::CompressionBlk::operator=().
|
inlineoverridevirtual |
Pretty-print tag, set and way, and interpret state bits to readable form including mapping to a MOESI state.
state M O E S I writable 1 0 1 0 0 dirty 1 1 0 0 0 valid 1 1 1 1 0
state writable dirty valid M 1 1 1 O 0 1 1 E 1 0 1 S 0 0 1 I 0 0 0
Note that only one cache ever has a block in Modified or Owned state, i.e., only one cache owns the block, or equivalently has the DirtyBit bit set. However, multiple caches on the same path to memory can have a block in the Exclusive state (despite the name). Exclusive means this cache has the only copy at this level of the hierarchy, i.e., there may be copies in caches above this cache (in various states), but there are no peers that have copies on this branch of the hierarchy, and no caches at or above this level on any other branch have copies either.
Reimplemented from gem5::ReplaceableEntry.
Reimplemented in gem5::CompressionBlk, gem5::FALRUBlk, and gem5::SectorSubBlk.
Definition at line 372 of file cache_blk.hh.
References coherence, gem5::csprintf(), DirtyBit, isSet(), gem5::CacheEntry::isValid(), gem5::TaggedEntry::print(), ReadableBit, gem5::ArmISA::s, state, wasPrefetched(), and WritableBit.
Referenced by gem5::BaseCache::access(), gem5::BaseCache::allocateBlock(), gem5::Cache::handleAtomicReqMiss(), gem5::BaseCache::handleFill(), gem5::Cache::handleSnoop(), gem5::FALRUBlk::print(), gem5::SectorSubBlk::print(), gem5::BaseCache::recvAtomic(), gem5::BaseCache::sendMSHRQueuePacket(), and gem5::BaseCache::updateCompressionData().
|
inline |
Sets the corresponding coherence bits.
bits | The coherence bits to be set. |
Definition at line 223 of file cache_blk.hh.
References gem5::bits(), coherence, and gem5::CacheEntry::isValid().
Referenced by gem5::BaseCache::access(), gem5::NoncoherentCache::access(), gem5::BaseCache::cmpAndSwap(), gem5::BaseCache::handleFill(), operator=(), gem5::BaseCache::recvTimingReq(), gem5::BaseCache::recvTimingResp(), gem5::BaseCache::satisfyRequest(), and gem5::Cache::serviceMSHRTargets().
|
inlineprotected |
Setter for _partitionId.
Definition at line 479 of file cache_blk.hh.
References _partitionId.
Referenced by insert(), invalidate(), and operator=().
|
inline |
Marks this blocks as a recently prefetched block.
Definition at line 261 of file cache_blk.hh.
References _prefetched.
Referenced by operator=(), gem5::Cache::serviceMSHRTargets(), and gem5::NoncoherentCache::serviceMSHRTargets().
|
inlineprotected |
Set the number of references to this block since insertion.
Definition at line 482 of file cache_blk.hh.
References _refCount, and gem5::X86ISA::count.
Referenced by invalidate(), and operator=().
|
inlineprotected |
Set the source requestor id.
Definition at line 475 of file cache_blk.hh.
References _srcRequestorId, and gem5::ArmISA::id.
Referenced by insert(), invalidate(), and operator=().
|
inlineprotected |
Set the task id value.
Definition at line 472 of file cache_blk.hh.
References _taskId.
Referenced by insert(), invalidate(), and operator=().
|
inlineprotected |
Set the current tick as this block's insertion tick.
Definition at line 485 of file cache_blk.hh.
References _tickInserted, and gem5::curTick().
Referenced by insert().
|
inline |
Set tick at which block's data will be available for access.
The new tick must be chronologically sequential with respect to previous accesses.
tick | New data ready tick. |
Definition at line 281 of file cache_blk.hh.
References _tickInserted, and whenReady.
Referenced by gem5::BaseCache::access(), gem5::BaseCache::handleFill(), invalidate(), and operator=().
|
inline |
Track the fact that a local locked was issued to the block.
Invalidate any previous LL to the same address.
Definition at line 335 of file cache_blk.hh.
References gem5::Packet::isLLSC(), gem5::MipsISA::l, lockList, and gem5::Packet::req.
Referenced by gem5::BaseCache::satisfyRequest().
|
inline |
Check if this block was the result of a hardware prefetch, yet to be touched.
Definition at line 252 of file cache_blk.hh.
References _prefetched.
Referenced by gem5::BaseCache::hasBeenPrefetched(), gem5::BaseCache::hasBeenPrefetched(), gem5::BaseCache::invalidateBlock(), print(), gem5::BaseCache::recvTimingReq(), gem5::BaseCache::satisfyRequest(), and gem5::BaseCache::updateBlockData().
|
private |
Partition ID of the activity that allocated this block.
Definition at line 496 of file cache_blk.hh.
Referenced by getPartitionId(), and setPartitionId().
|
private |
Whether this block is an unaccessed hardware prefetch.
Definition at line 508 of file cache_blk.hh.
Referenced by clearPrefetched(), setPrefetched(), and wasPrefetched().
|
private |
Number of references to this block since it was brought in.
Definition at line 499 of file cache_blk.hh.
Referenced by getRefCount(), increaseRefCount(), and setRefCount().
|
private |
holds the source requestor ID for this block.
Definition at line 492 of file cache_blk.hh.
Referenced by getSrcRequestorId(), and setSrcRequestorId().
|
private |
Task Id associated with this block.
Definition at line 489 of file cache_blk.hh.
Referenced by getTaskId(), and setTaskId().
|
private |
Tick on which the block was inserted in the cache.
Its value is only meaningful if the block is valid.
Definition at line 505 of file cache_blk.hh.
Referenced by getAge(), setTickInserted(), and setWhenReady().
|
protected |
The current coherence status of this block.
Definition at line 464 of file cache_blk.hh.
Referenced by clearCoherenceBits(), isSet(), print(), and setCoherenceBits().
uint8_t* gem5::CacheBlk::data = nullptr |
Contains a copy of the data in this block for easy access.
This is used for efficient execution when the data could be actually stored in another format (COW, compressed, sub-blocked, etc). In all cases the data stored here should be kept consistant with the actual data referenced by this block.
Definition at line 104 of file cache_blk.hh.
Referenced by gem5::BaseCache::cmpAndSwap(), gem5::BaseCache::functionalAccess(), gem5::Cache::handleSnoop(), gem5::BaseCache::satisfyRequest(), gem5::BaseSetAssoc::tagsInit(), gem5::CompressedTags::tagsInit(), gem5::FALRU::tagsInit(), gem5::SectorTags::tagsInit(), gem5::TempCacheBlk::TempCacheBlk(), gem5::BaseCache::updateBlockData(), gem5::BaseCache::writebackBlk(), gem5::BaseCache::writebackVisitor(), gem5::BaseCache::writecleanBlk(), and gem5::TempCacheBlk::~TempCacheBlk().
List of thread contexts that have performed a load-locked (LL) on the block since the last store.
Definition at line 153 of file cache_blk.hh.
Referenced by checkWrite(), clearLoadLocks(), invalidate(), operator=(), and trackLoadLocked().
Tick gem5::CacheBlk::whenReady = 0 |
Which curTick() will this block be accessible.
Its value is only meaningful if the block is valid.
Definition at line 110 of file cache_blk.hh.
Referenced by getWhenReady(), and setWhenReady().