| 
    gem5
    
   | 
 
#include <CacheMemory.hh>
  
 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 | 
| AbstractCacheEntry * | allocate (Addr address, AbstractCacheEntry *new_entry, bool touch) | 
| AbstractCacheEntry * | allocate (Addr address, AbstractCacheEntry *new_entry) | 
| void | allocateVoid (Addr address, AbstractCacheEntry *new_entry) | 
| void | deallocate (Addr address) | 
| Addr | cacheProbe (Addr address) const | 
| AbstractCacheEntry * | lookup (Addr address) | 
| const AbstractCacheEntry * | lookup (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 Params * | params () 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... | |
| ProbeManager * | getProbeManager () | 
| 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) | |
| EventQueue * | eventQueue () 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... | |
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) | |
| CacheMemory & | operator= (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 | 
| AbstractReplacementPolicy * | m_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 SimObject * | find (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 | |
| EventQueue * | eventq | 
| A pointer to this object's event queue.  More... | |
Definition at line 50 of file CacheMemory.hh.
| typedef RubyCacheParams CacheMemory::Params | 
Definition at line 53 of file CacheMemory.hh.
| CacheMemory::CacheMemory | ( | const Params * | p | ) | 
Definition at line 57 of file CacheMemory.cc.
References m_block_size, m_cache_assoc, m_cache_size, m_is_instruction_only_cache, m_replacementPolicy_ptr, m_resource_stalls, m_start_index_bit, and AbstractReplacementPolicy::setCache().
| CacheMemory::~CacheMemory | ( | ) | 
Definition at line 89 of file CacheMemory.cc.
References ArmISA::i, ArmISA::j, m_cache, m_cache_assoc, m_cache_num_sets, and m_replacementPolicy_ptr.
      
  | 
  private | 
      
  | 
  private | 
Definition at line 102 of file CacheMemory.cc.
References bitSelect(), m_cache_num_set_bits, m_start_index_bit, and makeLineAddress().
Referenced by allocate(), cacheAvail(), cacheProbe(), checkResourceAvailable(), clearLocked(), deallocate(), isLocked(), isTagPresent(), lookup(), recordRequestType(), setLocked(), setMRU(), testCacheAccess(), and tryCacheAccess().
| AbstractCacheEntry * CacheMemory::allocate | ( | Addr | address, | 
| AbstractCacheEntry * | new_entry, | ||
| bool | touch | ||
| ) | 
Definition at line 254 of file CacheMemory.cc.
References addressToCacheSet(), cacheAvail(), curTick(), DPRINTF, ArmISA::i, isTagPresent(), m_cache, m_cache_assoc, m_replacementPolicy_ptr, m_tag_index, makeLineAddress(), panic, AbstractCacheEntry::setSetIndex(), AbstractCacheEntry::setWayIndex(), AbstractReplacementPolicy::touch(), and warn_once.
Referenced by allocate(), and allocateVoid().
      
  | 
  inline | 
Definition at line 79 of file CacheMemory.hh.
References allocate().
      
  | 
  inline | 
Definition at line 83 of file CacheMemory.hh.
References allocate().
| bool CacheMemory::cacheAvail | ( | Addr | address | ) | const | 
Definition at line 232 of file CacheMemory.cc.
References addressToCacheSet(), ArmISA::i, AbstractCacheEntry::m_Address, m_cache, m_cache_assoc, AbstractEntry::m_Permission, and makeLineAddress().
Referenced by allocate(), and cacheProbe().
Definition at line 310 of file CacheMemory.cc.
References addressToCacheSet(), cacheAvail(), AbstractReplacementPolicy::getVictim(), m_cache, m_replacementPolicy_ptr, and makeLineAddress().
| bool CacheMemory::checkResourceAvailable | ( | CacheResourceType | res, | 
| Addr | addr | ||
| ) | 
Definition at line 615 of file CacheMemory.cc.
References addressToCacheSet(), dataArray, DPRINTF, m_resource_stalls, numDataArrayStalls, numTagArrayStalls, tagArray, and BankedArray::tryAccess().
| 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 | ) | 
Definition at line 294 of file CacheMemory.cc.
References addressToCacheSet(), DPRINTF, findTagInSet(), isTagPresent(), m_cache, m_tag_index, and makeLineAddress().
      
  | 
  private | 
Definition at line 112 of file CacheMemory.cc.
References m_cache, m_tag_index, and makeLineAddress().
Referenced by clearLocked(), deallocate(), isLocked(), isTagPresent(), lookup(), setLocked(), setMRU(), testCacheAccess(), and tryCacheAccess().
      
  | 
  private | 
Definition at line 127 of file CacheMemory.cc.
References m_tag_index, and makeLineAddress().
| Addr CacheMemory::getAddressAtIdx | ( | int | idx | ) | const | 
Definition at line 142 of file CacheMemory.cc.
References AbstractCacheEntry::m_Address, m_cache, m_cache_assoc, m_cache_num_sets, and AbstractEntry::m_Permission.
Referenced by VIPERCoalescer::invL1(), VIPERCoalescer::invwbL1(), and VIPERCoalescer::wbL1().
      
  | 
  inline | 
Definition at line 150 of file CacheMemory.hh.
References m_cache_assoc.
      
  | 
  inline | 
Definition at line 149 of file CacheMemory.hh.
References m_cache_size.
      
  | 
  inline | 
Definition at line 99 of file CacheMemory.hh.
References dataArray, and BankedArray::getLatency().
      
  | 
  inline | 
Definition at line 151 of file CacheMemory.hh.
References m_cache_assoc, and m_cache_num_sets.
Referenced by VIPERCoalescer::invL1(), VIPERCoalescer::invwbL1(), and VIPERCoalescer::wbL1().
| 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.
      
  | 
  inline | 
Definition at line 98 of file CacheMemory.hh.
References BankedArray::getLatency(), and tagArray.
      
  | 
  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 | 
Definition at line 213 of file CacheMemory.cc.
References addressToCacheSet(), DPRINTF, findTagInSet(), and makeLineAddress().
Referenced by allocate(), deallocate(), GPUCoalescer::handleLlsc(), and GPUCoalescer::hitCallback().
| AbstractCacheEntry * CacheMemory::lookup | ( | Addr | address | ) | 
Definition at line 322 of file CacheMemory.cc.
References addressToCacheSet(), findTagInSet(), m_cache, and makeLineAddress().
Referenced by Sequencer::handleLlsc(), and Sequencer::invalidateSC().
| const AbstractCacheEntry * CacheMemory::lookup | ( | Addr | address | ) | const | 
Definition at line 333 of file CacheMemory.cc.
References addressToCacheSet(), findTagInSet(), m_cache, and makeLineAddress().
      
  | 
  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 | 
Definition at line 393 of file CacheMemory.cc.
References CacheRecorder::addRecord(), DPRINTF, AbstractReplacementPolicy::getLastAccess(), ArmISA::i, ArmISA::j, M5_VAR_USED, m_cache, m_cache_assoc, m_cache_num_sets, m_is_instruction_only_cache, m_replacementPolicy_ptr, and SimObject::name().
| void CacheMemory::recordRequestType | ( | CacheRequestType | requestType, | 
| Addr | addr | ||
| ) | 
Definition at line 583 of file CacheMemory.cc.
References addressToCacheSet(), dataArray, DPRINTF, m_resource_stalls, numDataArrayReads, numDataArrayWrites, numTagArrayReads, numTagArrayWrites, BankedArray::reserve(), tagArray, and warn.
      
  | 
  virtual | 
Register statistics for this object.
Reimplemented from SimObject.
Definition at line 490 of file CacheMemory.cc.
References Stats::DataWrap< Derived, InfoProxyType >::desc(), Stats::DataWrap< Derived, InfoProxyType >::flags(), ArmISA::i, Stats::VectorBase< Derived, Stor >::init(), m_accessModeType, m_demand_accesses, m_demand_hits, m_demand_misses, m_hw_prefetches, m_prefetches, m_sw_prefetches, SimObject::name(), Stats::DataWrap< Derived, InfoProxyType >::name(), Stats::nozero, numDataArrayReads, numDataArrayStalls, numDataArrayWrites, numTagArrayReads, numTagArrayStalls, numTagArrayWrites, Stats::pdf, SimObject::regStats(), Stats::DataWrapVec< Derived, InfoProxyType >::subname(), and Stats::total.
| 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 | ) | 
Definition at line 344 of file CacheMemory.cc.
References addressToCacheSet(), curTick(), findTagInSet(), m_replacementPolicy_ptr, and AbstractReplacementPolicy::touch().
Referenced by GPUCoalescer::hitCallback().
| void CacheMemory::setMRU | ( | Addr | addr, | 
| int | occupancy | ||
| ) | 
Definition at line 362 of file CacheMemory.cc.
References addressToCacheSet(), curTick(), findTagInSet(), m_replacementPolicy_ptr, and AbstractReplacementPolicy::useOccupancy().
| void CacheMemory::setMRU | ( | const AbstractCacheEntry * | e | ) | 
Definition at line 354 of file CacheMemory.cc.
References curTick(), AbstractCacheEntry::getSetIndex(), AbstractCacheEntry::getWayIndex(), m_replacementPolicy_ptr, and AbstractReplacementPolicy::touch().
Definition at line 189 of file CacheMemory.cc.
References addressToCacheSet(), curTick(), DPRINTF, findTagInSet(), AbstractCacheEntry::getDataBlk(), m_cache, m_replacementPolicy_ptr, makeLineAddress(), and AbstractReplacementPolicy::touch().
Definition at line 162 of file CacheMemory.cc.
References addressToCacheSet(), curTick(), DPRINTF, findTagInSet(), AbstractCacheEntry::getDataBlk(), m_cache, AbstractEntry::m_Permission, m_replacementPolicy_ptr, makeLineAddress(), and AbstractReplacementPolicy::touch().
      
  | 
  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().
      
  | 
  private | 
Definition at line 187 of file CacheMemory.hh.
Referenced by CacheMemory(), and init().
      
  | 
  private | 
Definition at line 174 of file CacheMemory.hh.
Referenced by allocate(), cacheAvail(), cacheProbe(), clearLocked(), deallocate(), findTagInSet(), getAddressAtIdx(), getReplacementWeight(), init(), isBlockInvalid(), isBlockNotBusy(), isLocked(), lookup(), print(), recordCacheContents(), setLocked(), testCacheAccess(), tryCacheAccess(), and ~CacheMemory().
      
  | 
  private | 
Definition at line 184 of file CacheMemory.hh.
Referenced by allocate(), cacheAvail(), CacheMemory(), getAddressAtIdx(), getCacheAssoc(), getNumBlocks(), getReplacementWeight(), init(), print(), recordCacheContents(), and ~CacheMemory().
      
  | 
  private | 
Definition at line 183 of file CacheMemory.hh.
Referenced by addressToCacheSet(), and init().
      
  | 
  private | 
Definition at line 182 of file CacheMemory.hh.
Referenced by getAddressAtIdx(), getNumBlocks(), getReplacementWeight(), init(), print(), recordCacheContents(), and ~CacheMemory().
      
  | 
  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().
      
  | 
  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().
      
  | 
  private | 
Definition at line 176 of file CacheMemory.hh.
Referenced by allocate(), CacheMemory(), cacheProbe(), recordCacheContents(), setMRU(), testCacheAccess(), tryCacheAccess(), and ~CacheMemory().
      
  | 
  private | 
Definition at line 186 of file CacheMemory.hh.
Referenced by CacheMemory(), checkResourceAvailable(), and recordRequestType().
      
  | 
  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().
      
  | 
  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().
      
  | 
  private | 
Definition at line 179 of file CacheMemory.hh.
Referenced by checkResourceAvailable(), getTagLatency(), and recordRequestType().