gem5
v20.1.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_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... | |
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... | |
Public Member Functions inherited from 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... | |
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 | srcRequestorId |
holds the source requestor ID for this block. More... | |
Tick | tickInserted |
Tick on which the block was inserted in the cache. More... | |
Public Attributes inherited from ReplaceableEntry | |
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... | |
Protected Attributes inherited from 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... | |
A Basic Cache block.
Contains the tag, status, and a pointer to data.
Definition at line 84 of file cache_blk.hh.
typedef unsigned CacheBlk::State |
block state: OR of CacheBlkStatusBit
Definition at line 102 of file cache_blk.hh.
|
inline |
Definition at line 168 of file cache_blk.hh.
References invalidate().
|
delete |
|
inlinevirtual |
Definition at line 175 of file cache_blk.hh.
|
inline |
Handle interaction of load-locked operations and stores.
Definition at line 393 of file cache_blk.hh.
References clearLoadLocks(), Packet::isLLSC(), Packet::isWrite(), MipsISA::l, lockList, 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 327 of file cache_blk.hh.
References MipsISA::l, and lockList.
Referenced by checkWrite().
|
inline |
Get tick at which block's data will be available for access.
Definition at line 272 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_requestor_ID | The source requestor ID. |
task_ID | The new task ID. |
Reimplemented in SectorSubBlk, and TempCacheBlk.
Definition at line 46 of file cache_blk.cc.
References curTick(), refCount, setSecure(), setValid(), srcRequestorId, status, tag, task_id, and tickInserted.
Referenced by SectorSubBlk::insert(), and BaseTags::insertBlock().
|
inlinevirtual |
Invalidate the block and clear all state.
Reimplemented in TempCacheBlk, and SectorSubBlk.
Definition at line 211 of file cache_blk.hh.
References Request::invldRequestorId, lockList, MaxAddr, MaxTick, refCount, srcRequestorId, status, tag, task_id, ContextSwitchTaskId::Unknown, and whenReady.
Referenced by CacheBlk(), SectorSubBlk::invalidate(), BaseTags::invalidate(), and TempCacheBlk::invalidate().
|
inline |
Check to see if a block has been written.
Definition at line 226 of file cache_blk.hh.
References BlkDirty, and status.
Referenced by Cache::cleanEvictBlk(), NoncoherentCache::evictBlock(), Cache::evictBlock(), BaseCache::functionalAccess(), Cache::handleSnoop(), BaseCache::invalidateVisitor(), BaseCache::isDirty(), BaseCache::maintainClusivity(), print(), CacheBlkPrintWrapper::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 193 of file cache_blk.hh.
References BlkReadable, BlkValid, and status.
Referenced by BaseCache::access(), and print().
|
inline |
Check if this block holds data from the secure memory space.
Definition at line 245 of file cache_blk.hh.
References BlkSecure, and status.
Referenced by Cache::cleanEvictBlk(), BaseTags::findBlock(), FALRU::findBlock(), BaseCache::handleFill(), FALRU::insertBlock(), FALRU::invalidate(), CacheBlkPrintWrapper::print(), BaseCache::writebackBlk(), BaseCache::writebackVisitor(), and BaseCache::writecleanBlk().
|
inline |
Checks that a block is valid.
Definition at line 203 of file cache_blk.hh.
References BlkValid, and status.
Referenced by NoncoherentCache::access(), Cache::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(), CacheBlkPrintWrapper::print(), FALRU::CacheTracking::recordAccess(), BaseCache::recvAtomic(), BaseCache::recvTimingResp(), BaseCache::satisfyRequest(), Cache::serviceMSHRTargets(), setValid(), BaseCache::writebackBlk(), and BaseCache::writebackVisitor().
|
inline |
Checks the write permissions of this block.
Definition at line 181 of file cache_blk.hh.
References BlkValid, BlkWritable, and status.
Referenced by BaseCache::access(), Cache::createMissPacket(), Cache::handleSnoop(), BaseCache::handleTimingReqMiss(), print(), CacheBlkPrintWrapper::print(), BaseCache::recvTimingResp(), Cache::satisfyRequest(), BaseCache::satisfyRequest(), Cache::serviceMSHRTargets(), BaseCache::writebackBlk(), and BaseCache::writecleanBlk().
|
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 346 of file cache_blk.hh.
References csprintf(), isDirty(), isReadable(), isValid(), isWritable(), ReplaceableEntry::print(), ArmISA::s, status, and tag.
Referenced by BaseCache::access(), BaseCache::allocateBlock(), BaseCache::handleFill(), Cache::handleSnoop(), FALRUBlk::print(), SectorSubBlk::print(), BaseCache::recvAtomic(), BaseCache::sendMSHRQueuePacket(), and BaseCache::updateCompressionData().
|
inlinevirtual |
Set secure bit.
Reimplemented in SectorSubBlk.
Definition at line 262 of file cache_blk.hh.
References BlkSecure, and status.
Referenced by insert(), TempCacheBlk::insert(), and SectorSubBlk::setSecure().
|
inlinevirtual |
Set valid bit.
Reimplemented in SectorSubBlk.
Definition at line 253 of file cache_blk.hh.
References BlkValid, isValid(), and status.
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 285 of file cache_blk.hh.
References tickInserted, and whenReady.
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 309 of file cache_blk.hh.
References Packet::isLLSC(), MipsISA::l, lockList, 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 236 of file cache_blk.hh.
References BlkHWPrefetched, and status.
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 99 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 165 of file cache_blk.hh.
Referenced by checkWrite(), clearLoadLocks(), invalidate(), and trackLoadLocked().
unsigned CacheBlk::refCount |
Number of references to this block since it was brought in.
Definition at line 114 of file cache_blk.hh.
Referenced by BaseSetAssoc::accessBlock(), SectorTags::accessBlock(), BaseTags::cleanupRefsVisitor(), insert(), invalidate(), and BaseTags::invalidate().
int CacheBlk::srcRequestorId |
holds the source requestor ID for this block.
Definition at line 117 of file cache_blk.hh.
Referenced by insert(), invalidate(), and BaseTags::invalidate().
State CacheBlk::status |
The current status of this block.
Definition at line 105 of file cache_blk.hh.
Referenced by NoncoherentCache::access(), BaseCache::access(), BaseCache::cmpAndSwap(), Cache::handleAtomicReqMiss(), BaseCache::handleFill(), Cache::handleSnoop(), BaseCache::handleTimingReqMiss(), insert(), TempCacheBlk::insert(), invalidate(), CompressionBlk::isCompressed(), isDirty(), isReadable(), isSecure(), isValid(), isWritable(), print(), BaseCache::recvTimingReq(), BaseCache::recvTimingResp(), Cache::satisfyRequest(), BaseCache::satisfyRequest(), NoncoherentCache::serviceMSHRTargets(), Cache::serviceMSHRTargets(), CompressionBlk::setCompressed(), setSecure(), CompressionBlk::setUncompressed(), setValid(), wasPrefetched(), BaseCache::writebackBlk(), BaseCache::writebackVisitor(), and BaseCache::writecleanBlk().
Addr CacheBlk::tag |
Data block tag value.
Definition at line 91 of file cache_blk.hh.
Referenced by BaseTags::findBlock(), FALRU::findBlock(), SectorSubBlk::insert(), insert(), FALRU::insertBlock(), FALRU::invalidate(), invalidate(), print(), SectorTags::regenerateBlkAddr(), BaseSetAssoc::regenerateBlkAddr(), and FALRU::regenerateBlkAddr().
uint32_t CacheBlk::task_id |
Task Id associated with this block.
Definition at line 88 of file cache_blk.hh.
Referenced by Cache::cleanEvictBlk(), BaseTags::computeStatsVisitor(), insert(), invalidate(), 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 123 of file cache_blk.hh.
Referenced by BaseTags::computeStatsVisitor(), insert(), and setWhenReady().
Tick CacheBlk::whenReady |
Which curTick() will this block be accessible.
Its value is only meaningful if the block is valid.
Definition at line 111 of file cache_blk.hh.
Referenced by getWhenReady(), invalidate(), and setWhenReady().