gem5
v19.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 | |
typedef unsigned | State |
block state: OR of CacheBlkStatusBit More... | |
Public Member Functions | |
CacheBlk () | |
CacheBlk (const CacheBlk &)=delete | |
CacheBlk & | operator= (const CacheBlk &)=delete |
virtual | ~CacheBlk () |
bool | isWritable () const |
Checks the write permissions of this block. More... | |
bool | isReadable () const |
Checks the read permissions of this block. More... | |
bool | isValid () const |
Checks that a block is valid. More... | |
virtual void | invalidate () |
Invalidate the block and clear all state. More... | |
bool | isDirty () const |
Check to see if a block has been written. More... | |
bool | wasPrefetched () const |
Check if this block was the result of a hardware prefetch, yet to be touched. More... | |
bool | isSecure () const |
Check if this block holds data from the secure memory space. More... | |
virtual void | setValid () |
Set valid bit. More... | |
virtual void | setSecure () |
Set secure bit. 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... | |
virtual void | insert (const Addr tag, const bool is_secure, const int src_master_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... | |
std::string | print () const override |
Pretty-print tag, set and way, and interpret state bits to readable form including mapping to a MOESI state. More... | |
bool | checkWrite (PacketPtr pkt) |
Handle interaction of load-locked operations and stores. More... | |
![]() | |
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... | |
Public Attributes | |
uint32_t | task_id |
Task Id associated with this block. More... | |
Addr | tag |
Data block tag value. More... | |
uint8_t * | data |
Contains a copy of the data in this block for easy access. More... | |
State | status |
The current status of this block. More... | |
Tick | whenReady |
Which curTick() will this block be accessible. More... | |
unsigned | refCount |
Number of references to this block since it was brought in. More... | |
int | srcMasterId |
holds the source requestor ID for this block. More... | |
Tick | tickInserted |
Tick on which the block was inserted in the cache. More... | |
![]() | |
std::shared_ptr< ReplacementData > | replacementData |
Replacement data associated to this entry. More... | |
Protected Attributes | |
std::list< Lock > | lockList |
List of thread contexts that have performed a load-locked (LL) on the block since the last store. More... | |
![]() | |
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... | |
A Basic Cache block.
Contains the tag, status, and a pointer to data.
Definition at line 87 of file cache_blk.hh.
typedef unsigned CacheBlk::State |
block state: OR of CacheBlkStatusBit
Definition at line 105 of file cache_blk.hh.
|
inline |
Definition at line 171 of file cache_blk.hh.
References invalidate(), and operator=().
|
delete |
|
inlinevirtual |
Definition at line 178 of file cache_blk.hh.
|
inline |
Handle interaction of load-locked operations and stores.
Definition at line 396 of file cache_blk.hh.
References clearLoadLocks(), Packet::isLLSC(), Packet::isWrite(), MipsISA::l, and Packet::req.
Referenced by BaseCache::satisfyRequest().
|
inline |
Clear the any load lock that intersect the request, and is from a different context.
Definition at line 330 of file cache_blk.hh.
References MipsISA::l.
Referenced by checkWrite().
|
inline |
Get tick at which block's data will be available for access.
Definition at line 275 of file cache_blk.hh.
References MaxTick, and whenReady.
Referenced by BaseCache::calculateAccessLatency().
|
virtual |
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_master_ID | The source requestor ID. |
task_ID | The new task ID. |
Reimplemented in TempCacheBlk, and SectorSubBlk.
Definition at line 46 of file cache_blk.cc.
References curTick(), refCount, setSecure(), setValid(), srcMasterId, status, tag, task_id, and tickInserted.
Referenced by SectorSubBlk::insert(), BaseTags::insertBlock(), and setWhenReady().
|
inlinevirtual |
Invalidate the block and clear all state.
Reimplemented in TempCacheBlk, and SectorSubBlk.
Definition at line 214 of file cache_blk.hh.
References Request::invldMasterId, MaxAddr, MaxTick, and ContextSwitchTaskId::Unknown.
Referenced by CacheBlk(), SectorSubBlk::invalidate(), BaseTags::invalidate(), and TempCacheBlk::invalidate().
|
inline |
Check to see if a block has been written.
Definition at line 229 of file cache_blk.hh.
References BlkDirty.
Referenced by Cache::cleanEvictBlk(), NoncoherentCache::evictBlock(), Cache::evictBlock(), BaseCache::functionalAccess(), Cache::handleSnoop(), BaseCache::invalidateVisitor(), BaseCache::isDirty(), BaseCache::maintainClusivity(), print(), BaseCache::recvAtomic(), Cache::satisfyRequest(), BaseCache::satisfyRequest(), BaseCache::sendMSHRQueuePacket(), BaseCache::writebackBlk(), BaseCache::writebackVisitor(), and BaseCache::writecleanBlk().
|
inline |
Checks the read permissions of this block.
Note that a block can be valid but not readable if there is an outstanding write upgrade miss.
Definition at line 196 of file cache_blk.hh.
References BlkReadable, and BlkValid.
Referenced by BaseCache::access(), and print().
|
inline |
Check if this block holds data from the secure memory space.
Definition at line 248 of file cache_blk.hh.
References BlkSecure.
Referenced by Cache::cleanEvictBlk(), BaseTags::findBlock(), FALRU::findBlock(), BaseCache::handleFill(), FALRU::insertBlock(), FALRU::invalidate(), BaseCache::writebackBlk(), BaseCache::writebackVisitor(), BaseCache::writecleanBlk(), and SectorBlk::~SectorBlk().
|
inline |
Checks that a block is valid.
Definition at line 206 of file cache_blk.hh.
References BlkValid.
Referenced by NoncoherentCache::access(), FALRU::accessBlock(), Cache::cleanEvictBlk(), BaseTags::cleanupRefsVisitor(), BaseTags::computeStatsVisitor(), NoncoherentCache::createMissPacket(), Cache::createMissPacket(), BaseTags::findBlock(), FALRU::findBlock(), CompressedTags::findVictim(), SectorTags::findVictim(), BaseCache::functionalAccess(), Cache::handleAtomicReqMiss(), BaseCache::handleFill(), Cache::handleSnoop(), NoncoherentCache::handleTimingReqMiss(), Cache::handleTimingReqMiss(), BaseCache::handleTimingReqMiss(), BaseTags::insertBlock(), BaseTags::invalidate(), BaseCache::invalidateVisitor(), BaseCache::maintainClusivity(), print(), FALRU::CacheTracking::recordAccess(), BaseCache::recvAtomic(), BaseCache::recvTimingResp(), BaseCache::satisfyRequest(), Cache::serviceMSHRTargets(), setValid(), BaseCache::writebackBlk(), BaseCache::writebackVisitor(), and SectorBlk::~SectorBlk().
|
inline |
Checks the write permissions of this block.
Definition at line 184 of file cache_blk.hh.
References BlkValid, and BlkWritable.
Referenced by BaseCache::access(), Cache::createMissPacket(), Cache::handleSnoop(), BaseCache::handleTimingReqMiss(), print(), Cache::satisfyRequest(), BaseCache::satisfyRequest(), Cache::serviceMSHRTargets(), BaseCache::writebackBlk(), and BaseCache::writecleanBlk().
Referenced by CacheBlk(), and TempCacheBlk::TempCacheBlk().
|
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 BlkDirty 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 ReplaceableEntry.
Reimplemented in SectorSubBlk, CompressionBlk, and FALRUBlk.
Definition at line 349 of file cache_blk.hh.
References csprintf(), isDirty(), isReadable(), isValid(), isWritable(), ReplaceableEntry::print(), and ArmISA::s.
Referenced by BaseCache::access(), BaseCache::allocateBlock(), BaseCache::handleFill(), Cache::handleSnoop(), FALRUBlk::print(), SectorSubBlk::print(), BaseCache::recvAtomic(), BaseCache::sendMSHRQueuePacket(), BaseCache::updateCompressionData(), and CacheBlkPrintWrapper::~CacheBlkPrintWrapper().
|
inlinevirtual |
Set secure bit.
Reimplemented in SectorSubBlk.
Definition at line 265 of file cache_blk.hh.
References BlkSecure.
Referenced by insert(), TempCacheBlk::insert(), and SectorSubBlk::setSecure().
|
inlinevirtual |
Set valid bit.
Reimplemented in SectorSubBlk.
Definition at line 256 of file cache_blk.hh.
References BlkValid, and isValid().
Referenced by insert(), TempCacheBlk::insert(), and SectorSubBlk::setValid().
|
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 288 of file cache_blk.hh.
References insert().
Referenced by BaseCache::access(), and BaseCache::handleFill().
|
inline |
Track the fact that a local locked was issued to the block.
Invalidate any previous LL to the same address.
Definition at line 312 of file cache_blk.hh.
References Packet::isLLSC(), MipsISA::l, and Packet::req.
Referenced by BaseCache::satisfyRequest().
|
inline |
Check if this block was the result of a hardware prefetch, yet to be touched.
Definition at line 239 of file cache_blk.hh.
References BlkHWPrefetched.
Referenced by BaseCache::hasBeenPrefetched(), BaseCache::invalidateBlock(), and BaseCache::recvTimingReq().
uint8_t* CacheBlk::data |
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 102 of file cache_blk.hh.
Referenced by BaseCache::access(), BaseCache::cmpAndSwap(), BaseCache::functionalAccess(), BaseCache::handleFill(), Cache::handleSnoop(), BaseCache::satisfyRequest(), CompressedTags::tagsInit(), BaseSetAssoc::tagsInit(), SectorTags::tagsInit(), FALRU::tagsInit(), TempCacheBlk::TempCacheBlk(), BaseCache::writebackBlk(), BaseCache::writebackVisitor(), BaseCache::writecleanBlk(), and TempCacheBlk::~TempCacheBlk().
List of thread contexts that have performed a load-locked (LL) on the block since the last store.
Definition at line 168 of file cache_blk.hh.
unsigned CacheBlk::refCount |
Number of references to this block since it was brought in.
Definition at line 117 of file cache_blk.hh.
Referenced by BaseSetAssoc::accessBlock(), SectorTags::accessBlock(), BaseTags::cleanupRefsVisitor(), insert(), and BaseTags::invalidate().
int CacheBlk::srcMasterId |
holds the source requestor ID for this block.
Definition at line 120 of file cache_blk.hh.
Referenced by insert(), and BaseTags::invalidate().
State CacheBlk::status |
The current status of this block.
Definition at line 108 of file cache_blk.hh.
Referenced by NoncoherentCache::access(), BaseCache::access(), BaseCache::cmpAndSwap(), Cache::handleAtomicReqMiss(), BaseCache::handleFill(), Cache::handleSnoop(), BaseCache::handleTimingReqMiss(), insert(), TempCacheBlk::insert(), CompressionBlk::isCompressed(), BaseCache::recvTimingReq(), Cache::satisfyRequest(), BaseCache::satisfyRequest(), NoncoherentCache::serviceMSHRTargets(), Cache::serviceMSHRTargets(), CompressionBlk::setCompressed(), CompressionBlk::setUncompressed(), BaseCache::writebackBlk(), BaseCache::writebackVisitor(), and BaseCache::writecleanBlk().
Addr CacheBlk::tag |
Data block tag value.
Definition at line 94 of file cache_blk.hh.
Referenced by BaseTags::findBlock(), FALRU::findBlock(), SectorSubBlk::insert(), insert(), FALRU::insertBlock(), FALRU::invalidate(), SectorTags::regenerateBlkAddr(), BaseSetAssoc::regenerateBlkAddr(), FALRU::regenerateBlkAddr(), SectorBlk::~SectorBlk(), and SectorSubBlk::~SectorSubBlk().
uint32_t CacheBlk::task_id |
Task Id associated with this block.
Definition at line 91 of file cache_blk.hh.
Referenced by Cache::cleanEvictBlk(), BaseTags::computeStatsVisitor(), insert(), BaseCache::writebackBlk(), BaseCache::writebackVisitor(), and BaseCache::writecleanBlk().
Tick CacheBlk::tickInserted |
Tick on which the block was inserted in the cache.
Its value is only meaningful if the block is valid.
Definition at line 126 of file cache_blk.hh.
Referenced by BaseTags::computeStatsVisitor(), and insert().
Tick CacheBlk::whenReady |
Which curTick() will this block be accessible.
Its value is only meaningful if the block is valid.
Definition at line 114 of file cache_blk.hh.
Referenced by getWhenReady().