gem5
|
#include <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 |
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... | |
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... | |
void | trackLoadLocked (PacketPtr pkt) |
Track the fact that a local locked was issued to the block. More... | |
void | clearLoadLocks (RequestPtr req) |
Clear the any load lock that intersect the request, and is from a different context. More... | |
std::string | print () const |
Pretty-print a tag, 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 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 accessable. More... | |
int | set |
The set and way this block belongs to. More... | |
int | way |
bool | isTouched |
whether this block has been touched 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 |
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... | |
A Basic Cache block.
Contains the tag, status, and a pointer to data.
typedef unsigned CacheBlk::State |
|
delete |
|
inline |
Handle interaction of load-locked operations and stores.
Definition at line 332 of file blk.hh.
References clearLoadLocks(), Packet::isLLSC(), Packet::isWrite(), MipsISA::l, lockList, Packet::req, and Request::setExtraData().
Referenced by Cache::satisfyRequest().
|
inline |
Clear the any load lock that intersect the request, and is from a different context.
Definition at line 268 of file blk.hh.
References Request::contextId(), MipsISA::l, and lockList.
Referenced by checkWrite().
|
inline |
Invalidate the block and clear all state.
Definition at line 211 of file blk.hh.
References isTouched, lockList, and status.
Referenced by BaseSetAssoc::BaseSetAssoc(), BaseSetAssoc::insertBlock(), and Cache::invalidateBlock().
|
inline |
Check to see if a block has been written.
Definition at line 222 of file blk.hh.
References BlkDirty, and status.
Referenced by Cache::allocateBlock(), Cache::cleanEvictBlk(), Cache::functionalAccess(), Cache::handleSnoop(), Cache::invalidateVisitor(), Cache::maintainClusivity(), CacheBlkIsDirtyVisitor::operator()(), print(), CacheBlkPrintWrapper::print(), Cache::recvAtomic(), Cache::recvTimingResp(), Cache::satisfyRequest(), Cache::writebackBlk(), and Cache::writebackVisitor().
|
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 blk.hh.
References BlkReadable, BlkValid, and status.
Referenced by Cache::access(), and print().
|
inline |
Check if this block holds data from the secure memory space.
Definition at line 241 of file blk.hh.
References BlkSecure, and status.
Referenced by Cache::allocateBlock(), Cache::cleanEvictBlk(), CacheBlkPrintWrapper::print(), Cache::writebackBlk(), and Cache::writebackVisitor().
|
inline |
Checks that a block is valid.
Definition at line 203 of file blk.hh.
References BlkValid, and status.
Referenced by FALRU::accessBlock(), Cache::allocateBlock(), Cache::cleanEvictBlk(), Cache::createMissPacket(), FALRU::findBlock(), RandomRepl::findVictim(), LRU::findVictim(), FALRU::findVictim(), BaseSetAssoc::findVictim(), Cache::functionalAccess(), Cache::handleFill(), Cache::handleSnoop(), BaseSetAssoc::insertBlock(), BaseSetAssoc::invalidate(), Cache::invalidateVisitor(), Cache::maintainClusivity(), print(), BaseSetAssoc::print(), CacheBlkPrintWrapper::print(), Cache::recvAtomic(), Cache::recvTimingReq(), Cache::recvTimingResp(), Cache::satisfyRequest(), Cache::writebackBlk(), and Cache::writebackVisitor().
|
inline |
Checks the write permissions of this block.
Definition at line 181 of file blk.hh.
References BlkValid, BlkWritable, and status.
Referenced by Cache::access(), Cache::allocateBlock(), Cache::createMissPacket(), Cache::handleSnoop(), print(), CacheBlkPrintWrapper::print(), Cache::recvTimingReq(), Cache::satisfyRequest(), and Cache::writebackBlk().
|
inline |
Pretty-print a tag, 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.
Definition at line 286 of file blk.hh.
References csprintf(), isDirty(), isReadable(), isValid(), isWritable(), ArmISA::s, status, and tag.
Referenced by Cache::access(), Cache::handleFill(), Cache::handleSnoop(), and BaseSetAssoc::print().
|
inline |
Track the fact that a local locked was issued to the block.
Invalidate any previous LL to the same address.
Definition at line 250 of file blk.hh.
References Packet::isLLSC(), MipsISA::l, lockList, and Packet::req.
Referenced by Cache::satisfyRequest().
|
inline |
Check if this block was the result of a hardware prefetch, yet to be touched.
Definition at line 232 of file blk.hh.
References BlkHWPrefetched, and status.
Referenced by Cache::allocateBlock(), and Cache::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 94 of file blk.hh.
Referenced by Cache::access(), BaseSetAssoc::BaseSetAssoc(), Cache::Cache(), Cache::cmpAndSwap(), Cache::functionalAccess(), Cache::handleFill(), Cache::handleSnoop(), Cache::satisfyRequest(), Cache::writebackBlk(), Cache::writebackVisitor(), and Cache::~Cache().
bool CacheBlk::isTouched |
whether this block has been touched
Definition at line 112 of file blk.hh.
Referenced by BaseSetAssoc::BaseSetAssoc(), BaseSetAssoc::insertBlock(), and invalidate().
List of thread contexts that have performed a load-locked (LL) on the block since the last store.
Definition at line 162 of file 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 115 of file blk.hh.
Referenced by BaseSetAssoc::accessBlock(), BaseSetAssoc::cleanupRefs(), and BaseSetAssoc::insertBlock().
int CacheBlk::set |
The set and way this block belongs to.
Definition at line 109 of file blk.hh.
Referenced by LRU::accessBlock(), Cache::allocateBlock(), BaseSetAssoc::BaseSetAssoc(), Cache::cleanEvictBlk(), FALRU::FALRU(), Cache::handleFill(), LRU::invalidate(), Cache::writebackBlk(), and Cache::writebackVisitor().
int CacheBlk::srcMasterId |
holds the source requestor ID for this block.
Definition at line 118 of file blk.hh.
Referenced by BaseSetAssoc::insertBlock(), and BaseSetAssoc::invalidate().
State CacheBlk::status |
The current status of this block.
Definition at line 100 of file blk.hh.
Referenced by Cache::access(), Cache::cmpAndSwap(), Cache::handleFill(), Cache::handleSnoop(), invalidate(), isDirty(), isReadable(), isSecure(), isValid(), isWritable(), print(), Cache::recvAtomic(), Cache::recvTimingReq(), Cache::recvTimingResp(), Cache::satisfyRequest(), wasPrefetched(), Cache::writebackBlk(), and Cache::writebackVisitor().
Addr CacheBlk::tag |
Data block tag value.
Definition at line 86 of file blk.hh.
Referenced by LRU::accessBlock(), FALRU::accessBlock(), Cache::allocateBlock(), BaseSetAssoc::BaseSetAssoc(), Cache::cleanEvictBlk(), FALRU::findBlock(), LRU::findVictim(), FALRU::findVictim(), Cache::handleFill(), BaseSetAssoc::insertBlock(), print(), Cache::writebackBlk(), and Cache::writebackVisitor().
uint32_t CacheBlk::task_id |
Task Id associated with this block.
Definition at line 83 of file blk.hh.
Referenced by Cache::cleanEvictBlk(), BaseSetAssoc::computeStats(), BaseSetAssoc::insertBlock(), BaseSetAssoc::invalidate(), Cache::writebackBlk(), and Cache::writebackVisitor().
Tick CacheBlk::tickInserted |
Definition at line 120 of file blk.hh.
Referenced by Cache::cleanEvictBlk(), BaseSetAssoc::insertBlock(), BaseSetAssoc::invalidate(), and Cache::writebackBlk().
int CacheBlk::way |
Definition at line 109 of file blk.hh.
Referenced by BaseSetAssoc::BaseSetAssoc(), FALRU::FALRU(), and LRU::findVictim().
Tick CacheBlk::whenReady |
Which curTick() will this block be accessable.
Definition at line 103 of file blk.hh.
Referenced by BaseSetAssoc::accessBlock(), FALRU::accessBlock(), BaseSetAssoc::BaseSetAssoc(), and Cache::handleFill().