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

#include <CacheMemory.hh>

Inheritance diagram for CacheMemory:
SimObject EventManager Serializable Drainable

Public Types

typedef RubyCacheParams Params
 
- Public Types inherited from SimObject
typedef SimObjectParams Params
 

Public Member Functions

 CacheMemory (const Params *p)
 
 ~CacheMemory ()
 
void init ()
 init() is called after all C++ SimObjects have been created and all ports are connected. More...
 
bool tryCacheAccess (Addr address, RubyRequestType type, DataBlock *&data_ptr)
 
bool testCacheAccess (Addr address, RubyRequestType type, DataBlock *&data_ptr)
 
bool isTagPresent (Addr address) const
 
bool cacheAvail (Addr address) const
 
AbstractCacheEntryallocate (Addr address, AbstractCacheEntry *new_entry, bool touch)
 
AbstractCacheEntryallocate (Addr address, AbstractCacheEntry *new_entry)
 
void allocateVoid (Addr address, AbstractCacheEntry *new_entry)
 
void deallocate (Addr address)
 
Addr cacheProbe (Addr address) const
 
AbstractCacheEntrylookup (Addr address)
 
const AbstractCacheEntrylookup (Addr address) const
 
Cycles getTagLatency () const
 
Cycles getDataLatency () const
 
bool isBlockInvalid (int64_t cache_set, int64_t loc)
 
bool isBlockNotBusy (int64_t cache_set, int64_t loc)
 
void recordCacheContents (int cntrl, CacheRecorder *tr) const
 
void setMRU (Addr address)
 
void setMRU (Addr addr, int occupancy)
 
int getReplacementWeight (int64_t set, int64_t loc)
 
void setMRU (const AbstractCacheEntry *e)
 
void setLocked (Addr addr, int context)
 
void clearLocked (Addr addr)
 
bool isLocked (Addr addr, int context)
 
void print (std::ostream &out) const
 
void printData (std::ostream &out) const
 
void regStats ()
 Register statistics for this object. More...
 
bool checkResourceAvailable (CacheResourceType res, Addr addr)
 
void recordRequestType (CacheRequestType requestType, Addr addr)
 
int getCacheSize () const
 
int getCacheAssoc () const
 
int getNumBlocks () const
 
Addr getAddressAtIdx (int idx) const
 
- Public Member Functions inherited from SimObject
const Paramsparams () const
 
 SimObject (const Params *_params)
 
virtual ~SimObject ()
 
virtual const std::string name () const
 
virtual void loadState (CheckpointIn &cp)
 loadState() is called on each SimObject when restoring from a checkpoint. More...
 
virtual void initState ()
 initState() is called on each SimObject when not restoring from a checkpoint. More...
 
virtual void resetStats ()
 Reset statistics associated with this object. More...
 
virtual void regProbePoints ()
 Register probe points for this object. More...
 
virtual void regProbeListeners ()
 Register probe listeners for this object. More...
 
ProbeManagergetProbeManager ()
 Get the probe manager for this object. More...
 
virtual void startup ()
 startup() is the final initialization call before simulation. More...
 
DrainState drain () override
 Provide a default implementation of the drain interface for objects that don't need draining. More...
 
virtual void memWriteback ()
 Write back dirty buffers to memory using functional writes. More...
 
virtual void memInvalidate ()
 Invalidate the contents of memory buffers. More...
 
void serialize (CheckpointOut &cp) const override
 Serialize an object. More...
 
void unserialize (CheckpointIn &cp) override
 Unserialize an object. More...
 
- Public Member Functions inherited from EventManager
 EventManager (EventManager &em)
 
 EventManager (EventManager *em)
 
 EventManager (EventQueue *eq)
 
EventQueueeventQueue () const
 
void schedule (Event &event, Tick when)
 
void deschedule (Event &event)
 
void reschedule (Event &event, Tick when, bool always=false)
 
void schedule (Event *event, Tick when)
 
void deschedule (Event *event)
 
void reschedule (Event *event, Tick when, bool always=false)
 
void wakeupEventQueue (Tick when=(Tick)-1)
 
void setCurTick (Tick newVal)
 
- Public Member Functions inherited from Serializable
 Serializable ()
 
virtual ~Serializable ()
 
void serializeSection (CheckpointOut &cp, const char *name) const
 Serialize an object into a new section. More...
 
void serializeSection (CheckpointOut &cp, const std::string &name) const
 
void unserializeSection (CheckpointIn &cp, const char *name)
 Unserialize an a child object. More...
 
void unserializeSection (CheckpointIn &cp, const std::string &name)
 
- Public Member Functions inherited from Drainable
DrainState drainState () const
 Return the current drain state of an object. More...
 
virtual void notifyFork ()
 Notify a child process of a fork. More...
 

Public Attributes

Stats::Scalar m_demand_hits
 
Stats::Scalar m_demand_misses
 
Stats::Formula m_demand_accesses
 
Stats::Scalar m_sw_prefetches
 
Stats::Scalar m_hw_prefetches
 
Stats::Formula m_prefetches
 
Stats::Vector m_accessModeType
 
Stats::Scalar numDataArrayReads
 
Stats::Scalar numDataArrayWrites
 
Stats::Scalar numTagArrayReads
 
Stats::Scalar numTagArrayWrites
 
Stats::Scalar numTagArrayStalls
 
Stats::Scalar numDataArrayStalls
 

Private Member Functions

int64_t addressToCacheSet (Addr address) const
 
int findTagInSet (int64_t line, Addr tag) const
 
int findTagInSetIgnorePermissions (int64_t cacheSet, Addr tag) const
 
 CacheMemory (const CacheMemory &obj)
 
CacheMemoryoperator= (const CacheMemory &obj)
 

Private Attributes

bool m_is_instruction_only_cache
 
std::unordered_map< Addr, int > m_tag_index
 
std::vector< std::vector
< AbstractCacheEntry * > > 
m_cache
 
AbstractReplacementPolicym_replacementPolicy_ptr
 
BankedArray dataArray
 
BankedArray tagArray
 
int m_cache_size
 
int m_cache_num_sets
 
int m_cache_num_set_bits
 
int m_cache_assoc
 
int m_start_index_bit
 
bool m_resource_stalls
 
int m_block_size
 

Additional Inherited Members

- Static Public Member Functions inherited from SimObject
static void serializeAll (CheckpointOut &cp)
 Serialize all SimObjects in the system. More...
 
static SimObjectfind (const char *name)
 Find the SimObject with the given name and return a pointer to it. More...
 
- Static Public Member Functions inherited from Serializable
static const std::string & currentSection ()
 Get the fully-qualified name of the active section. More...
 
static void serializeAll (const std::string &cpt_dir)
 
static void unserializeGlobals (CheckpointIn &cp)
 
- Static Public Attributes inherited from Serializable
static int ckptCount = 0
 
static int ckptMaxCount = 0
 
static int ckptPrevCount = -1
 
- Protected Member Functions inherited from Drainable
 Drainable ()
 
virtual ~Drainable ()
 
virtual void drainResume ()
 Resume execution after a successful drain. More...
 
void signalDrainDone () const
 Signal that an object is drained. More...
 
- Protected Attributes inherited from SimObject
const SimObjectParams * _params
 Cached copy of the object parameters. More...
 
- Protected Attributes inherited from EventManager
EventQueueeventq
 A pointer to this object's event queue. More...
 

Detailed Description

Definition at line 50 of file CacheMemory.hh.

Member Typedef Documentation

typedef RubyCacheParams CacheMemory::Params

Definition at line 53 of file CacheMemory.hh.

Constructor & Destructor Documentation

CacheMemory::CacheMemory ( const Params p)
CacheMemory::~CacheMemory ( )
CacheMemory::CacheMemory ( const CacheMemory obj)
private

Member Function Documentation

int64_t CacheMemory::addressToCacheSet ( Addr  address) const
private
AbstractCacheEntry * CacheMemory::allocate ( Addr  address,
AbstractCacheEntry new_entry,
bool  touch 
)
AbstractCacheEntry* CacheMemory::allocate ( Addr  address,
AbstractCacheEntry new_entry 
)
inline

Definition at line 79 of file CacheMemory.hh.

References allocate().

void CacheMemory::allocateVoid ( Addr  address,
AbstractCacheEntry new_entry 
)
inline

Definition at line 83 of file CacheMemory.hh.

References allocate().

bool CacheMemory::cacheAvail ( Addr  address) const
Addr CacheMemory::cacheProbe ( Addr  address) const
bool CacheMemory::checkResourceAvailable ( CacheResourceType  res,
Addr  addr 
)
void CacheMemory::clearLocked ( Addr  addr)

Definition at line 467 of file CacheMemory.cc.

References addressToCacheSet(), DPRINTF, findTagInSet(), m_cache, and makeLineAddress().

Referenced by GPUCoalescer::handleLlsc().

void CacheMemory::deallocate ( Addr  address)
int CacheMemory::findTagInSet ( int64_t  line,
Addr  tag 
) const
private
int CacheMemory::findTagInSetIgnorePermissions ( int64_t  cacheSet,
Addr  tag 
) const
private

Definition at line 127 of file CacheMemory.cc.

References m_tag_index, and makeLineAddress().

Addr CacheMemory::getAddressAtIdx ( int  idx) const
int CacheMemory::getCacheAssoc ( ) const
inline

Definition at line 150 of file CacheMemory.hh.

References m_cache_assoc.

int CacheMemory::getCacheSize ( ) const
inline

Definition at line 149 of file CacheMemory.hh.

References m_cache_size.

Cycles CacheMemory::getDataLatency ( ) const
inline

Definition at line 99 of file CacheMemory.hh.

References dataArray, and BankedArray::getLatency().

int CacheMemory::getNumBlocks ( ) const
inline
int CacheMemory::getReplacementWeight ( int64_t  set,
int64_t  loc 
)

Definition at line 379 of file CacheMemory.cc.

References m_cache, m_cache_assoc, and m_cache_num_sets.

Cycles CacheMemory::getTagLatency ( ) const
inline

Definition at line 98 of file CacheMemory.hh.

References BankedArray::getLatency(), and tagArray.

void CacheMemory::init ( )
virtual

init() is called after all C++ SimObjects have been created and all ports are connected.

Initializations that are independent of unserialization but rely on a fully instantiated and connected SimObject graph should be done here.

Reimplemented from SimObject.

Definition at line 75 of file CacheMemory.cc.

References floorLog2(), RubySystem::getBlockSizeBytes(), m_block_size, m_cache, m_cache_assoc, m_cache_num_set_bits, m_cache_num_sets, and m_cache_size.

bool CacheMemory::isBlockInvalid ( int64_t  cache_set,
int64_t  loc 
)

Definition at line 646 of file CacheMemory.cc.

References m_cache.

bool CacheMemory::isBlockNotBusy ( int64_t  cache_set,
int64_t  loc 
)

Definition at line 652 of file CacheMemory.cc.

References m_cache.

bool CacheMemory::isLocked ( Addr  addr,
int  context 
)

Definition at line 478 of file CacheMemory.cc.

References addressToCacheSet(), DPRINTF, findTagInSet(), m_cache, and makeLineAddress().

Referenced by GPUCoalescer::handleLlsc().

bool CacheMemory::isTagPresent ( Addr  address) const
AbstractCacheEntry * CacheMemory::lookup ( Addr  address)
const AbstractCacheEntry * CacheMemory::lookup ( Addr  address) const

Definition at line 333 of file CacheMemory.cc.

References addressToCacheSet(), findTagInSet(), m_cache, and makeLineAddress().

CacheMemory& CacheMemory::operator= ( const CacheMemory obj)
private
void CacheMemory::print ( std::ostream &  out) const

Definition at line 431 of file CacheMemory.cc.

References ArmISA::i, ArmISA::j, m_cache, m_cache_assoc, m_cache_num_sets, and SimObject::name().

Referenced by operator<<().

void CacheMemory::printData ( std::ostream &  out) const

Definition at line 450 of file CacheMemory.cc.

void CacheMemory::recordCacheContents ( int  cntrl,
CacheRecorder tr 
) const
void CacheMemory::recordRequestType ( CacheRequestType  requestType,
Addr  addr 
)
void CacheMemory::regStats ( )
virtual
void CacheMemory::setLocked ( Addr  addr,
int  context 
)

Definition at line 456 of file CacheMemory.cc.

References addressToCacheSet(), DPRINTF, findTagInSet(), m_cache, and makeLineAddress().

Referenced by GPUCoalescer::handleLlsc().

void CacheMemory::setMRU ( Addr  address)
void CacheMemory::setMRU ( Addr  addr,
int  occupancy 
)
void CacheMemory::setMRU ( const AbstractCacheEntry e)
bool CacheMemory::testCacheAccess ( Addr  address,
RubyRequestType  type,
DataBlock *&  data_ptr 
)
bool CacheMemory::tryCacheAccess ( Addr  address,
RubyRequestType  type,
DataBlock *&  data_ptr 
)

Member Data Documentation

BankedArray CacheMemory::dataArray
private

Definition at line 178 of file CacheMemory.hh.

Referenced by checkResourceAvailable(), getDataLatency(), and recordRequestType().

Stats::Vector CacheMemory::m_accessModeType

Definition at line 139 of file CacheMemory.hh.

Referenced by regStats().

int CacheMemory::m_block_size
private

Definition at line 187 of file CacheMemory.hh.

Referenced by CacheMemory(), and init().

std::vector<std::vector<AbstractCacheEntry*> > CacheMemory::m_cache
private
int CacheMemory::m_cache_assoc
private
int CacheMemory::m_cache_num_set_bits
private

Definition at line 183 of file CacheMemory.hh.

Referenced by addressToCacheSet(), and init().

int CacheMemory::m_cache_num_sets
private
int CacheMemory::m_cache_size
private

Definition at line 181 of file CacheMemory.hh.

Referenced by CacheMemory(), getCacheSize(), and init().

Stats::Formula CacheMemory::m_demand_accesses

Definition at line 133 of file CacheMemory.hh.

Referenced by regStats().

Stats::Scalar CacheMemory::m_demand_hits

Definition at line 131 of file CacheMemory.hh.

Referenced by regStats().

Stats::Scalar CacheMemory::m_demand_misses

Definition at line 132 of file CacheMemory.hh.

Referenced by regStats().

Stats::Scalar CacheMemory::m_hw_prefetches

Definition at line 136 of file CacheMemory.hh.

Referenced by regStats().

bool CacheMemory::m_is_instruction_only_cache
private

Definition at line 169 of file CacheMemory.hh.

Referenced by CacheMemory(), and recordCacheContents().

Stats::Formula CacheMemory::m_prefetches

Definition at line 137 of file CacheMemory.hh.

Referenced by regStats().

AbstractReplacementPolicy* CacheMemory::m_replacementPolicy_ptr
private
bool CacheMemory::m_resource_stalls
private

Definition at line 186 of file CacheMemory.hh.

Referenced by CacheMemory(), checkResourceAvailable(), and recordRequestType().

int CacheMemory::m_start_index_bit
private

Definition at line 185 of file CacheMemory.hh.

Referenced by addressToCacheSet(), and CacheMemory().

Stats::Scalar CacheMemory::m_sw_prefetches

Definition at line 135 of file CacheMemory.hh.

Referenced by regStats().

std::unordered_map<Addr, int> CacheMemory::m_tag_index
private

Definition at line 173 of file CacheMemory.hh.

Referenced by allocate(), deallocate(), findTagInSet(), and findTagInSetIgnorePermissions().

Stats::Scalar CacheMemory::numDataArrayReads

Definition at line 141 of file CacheMemory.hh.

Referenced by recordRequestType(), and regStats().

Stats::Scalar CacheMemory::numDataArrayStalls

Definition at line 147 of file CacheMemory.hh.

Referenced by checkResourceAvailable(), and regStats().

Stats::Scalar CacheMemory::numDataArrayWrites

Definition at line 142 of file CacheMemory.hh.

Referenced by recordRequestType(), and regStats().

Stats::Scalar CacheMemory::numTagArrayReads

Definition at line 143 of file CacheMemory.hh.

Referenced by recordRequestType(), and regStats().

Stats::Scalar CacheMemory::numTagArrayStalls

Definition at line 146 of file CacheMemory.hh.

Referenced by checkResourceAvailable(), and regStats().

Stats::Scalar CacheMemory::numTagArrayWrites

Definition at line 144 of file CacheMemory.hh.

Referenced by recordRequestType(), and regStats().

BankedArray CacheMemory::tagArray
private

Definition at line 179 of file CacheMemory.hh.

Referenced by checkResourceAvailable(), getTagLatency(), and recordRequestType().


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

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