gem5  v20.1.0.0
Classes | Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
CacheBlk Class Reference

A Basic Cache block. More...

#include <cache_blk.hh>

Inheritance diagram for CacheBlk:
ReplaceableEntry FALRUBlk SectorSubBlk TempCacheBlk CompressionBlk

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
 
CacheBlkoperator= (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< ReplacementDatareplacementData
 Replacement data associated to this entry. More...
 

Protected Attributes

std::list< LocklockList
 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...
 

Detailed Description

A Basic Cache block.

Contains the tag, status, and a pointer to data.

Definition at line 84 of file cache_blk.hh.

Member Typedef Documentation

◆ State

typedef unsigned CacheBlk::State

block state: OR of CacheBlkStatusBit

Definition at line 102 of file cache_blk.hh.

Constructor & Destructor Documentation

◆ CacheBlk() [1/2]

CacheBlk::CacheBlk ( )
inline

Definition at line 168 of file cache_blk.hh.

References invalidate().

◆ CacheBlk() [2/2]

CacheBlk::CacheBlk ( const CacheBlk )
delete

◆ ~CacheBlk()

virtual CacheBlk::~CacheBlk ( )
inlinevirtual

Definition at line 175 of file cache_blk.hh.

Member Function Documentation

◆ checkWrite()

bool CacheBlk::checkWrite ( PacketPtr  pkt)
inline

Handle interaction of load-locked operations and stores.

Returns
True if write should proceed, false otherwise. Returns false only in the case of a failed store conditional.

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().

◆ clearLoadLocks()

void CacheBlk::clearLoadLocks ( const RequestPtr req)
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().

◆ getWhenReady()

Tick CacheBlk::getWhenReady ( ) const
inline

Get tick at which block's data will be available for access.

Returns
Data ready tick.

Definition at line 272 of file cache_blk.hh.

References MaxTick, and whenReady.

Referenced by BaseCache::calculateAccessLatency().

◆ insert()

void CacheBlk::insert ( const Addr  tag,
const bool  is_secure,
const int  src_requestor_ID,
const uint32_t  task_ID 
)
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.

Parameters
tagBlock address tag.
is_secureWhether the block is in secure space or not.
src_requestor_IDThe source requestor ID.
task_IDThe 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().

◆ invalidate()

virtual void CacheBlk::invalidate ( )
inlinevirtual

◆ isDirty()

bool CacheBlk::isDirty ( ) const
inline

◆ isReadable()

bool CacheBlk::isReadable ( ) const
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.

Returns
True if the block is readable.

Definition at line 193 of file cache_blk.hh.

References BlkReadable, BlkValid, and status.

Referenced by BaseCache::access(), and print().

◆ isSecure()

bool CacheBlk::isSecure ( ) const
inline

Check if this block holds data from the secure memory space.

Returns
True if the 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().

◆ isValid()

bool CacheBlk::isValid ( ) const
inline

◆ isWritable()

bool CacheBlk::isWritable ( ) const
inline

◆ operator=()

CacheBlk& CacheBlk::operator= ( const CacheBlk )
delete

◆ print()

std::string CacheBlk::print ( ) const
inlineoverridevirtual

Pretty-print tag, set and way, and interpret state bits to readable form including mapping to a MOESI state.

Returns
string with basic state information

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().

◆ setSecure()

virtual void CacheBlk::setSecure ( )
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().

◆ setValid()

virtual void CacheBlk::setValid ( )
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().

◆ setWhenReady()

void CacheBlk::setWhenReady ( const Tick  tick)
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.

Parameters
tickNew data ready tick.

Definition at line 285 of file cache_blk.hh.

References tickInserted, and whenReady.

Referenced by BaseCache::access(), and BaseCache::handleFill().

◆ trackLoadLocked()

void CacheBlk::trackLoadLocked ( PacketPtr  pkt)
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().

◆ wasPrefetched()

bool CacheBlk::wasPrefetched ( ) const
inline

Check if this block was the result of a hardware prefetch, yet to be touched.

Returns
True if the block was a hardware prefetch, unaccesed.

Definition at line 236 of file cache_blk.hh.

References BlkHWPrefetched, and status.

Referenced by BaseCache::hasBeenPrefetched(), BaseCache::invalidateBlock(), and BaseCache::recvTimingReq().

Member Data Documentation

◆ data

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().

◆ lockList

std::list<Lock> CacheBlk::lockList
protected

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().

◆ refCount

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().

◆ srcRequestorId

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().

◆ status

State CacheBlk::status

◆ tag

Addr CacheBlk::tag

◆ task_id

uint32_t CacheBlk::task_id

◆ tickInserted

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().

◆ whenReady

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().


The documentation for this class was generated from the following files:

Generated on Wed Sep 30 2020 14:02:22 for gem5 by doxygen 1.8.17