gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Public Attributes | Protected Attributes | List of all members
CacheBlk Class Reference

A Basic Cache block. More...

#include <blk.hh>

Inheritance diagram for CacheBlk:
FALRUBlk

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
 
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< LocklockList
 List of thread contexts that have performed a load-locked (LL) on the block since the last store. More...
 

Detailed Description

A Basic Cache block.

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

Definition at line 79 of file blk.hh.

Member Typedef Documentation

typedef unsigned CacheBlk::State

block state: OR of CacheBlkStatusBit

Definition at line 97 of file blk.hh.

Constructor & Destructor Documentation

CacheBlk::CacheBlk ( )
inline

Definition at line 166 of file blk.hh.

CacheBlk::CacheBlk ( const CacheBlk )
delete

Member Function Documentation

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 332 of file blk.hh.

References clearLoadLocks(), Packet::isLLSC(), Packet::isWrite(), MipsISA::l, lockList, Packet::req, and Request::setExtraData().

Referenced by Cache::satisfyRequest().

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

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

bool CacheBlk::isDirty ( ) const
inline
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 blk.hh.

References BlkReadable, BlkValid, and status.

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

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 241 of file blk.hh.

References BlkSecure, and status.

Referenced by Cache::allocateBlock(), Cache::cleanEvictBlk(), CacheBlkPrintWrapper::print(), Cache::writebackBlk(), and Cache::writebackVisitor().

bool CacheBlk::isValid ( ) const
inline
bool CacheBlk::isWritable ( ) const
inline

Checks the write permissions of this block.

Returns
True if the block is writable.

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

CacheBlk& CacheBlk::operator= ( const CacheBlk )
delete
std::string CacheBlk::print ( ) const
inline

Pretty-print a tag, 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.

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

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 250 of file blk.hh.

References Packet::isLLSC(), MipsISA::l, lockList, and Packet::req.

Referenced by Cache::satisfyRequest().

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 232 of file blk.hh.

References BlkHWPrefetched, and status.

Referenced by Cache::allocateBlock(), and Cache::recvTimingReq().

Member Data Documentation

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

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

Todo:
Move this into subclasses when we fix CacheTags to use them.

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
Addr CacheBlk::tag
uint32_t CacheBlk::task_id
Tick CacheBlk::tickInserted
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().


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

Generated on Fri Jun 9 2017 13:04:04 for gem5 by doxygen 1.8.6