gem5
v20.1.0.0
|
A basic cache interface. More...
#include <base.hh>
Classes | |
struct | CacheCmdStats |
class | CacheReqPacketQueue |
Override the default behaviour of sendDeferredPacket to enable the memory-side cache port to also send requests based on the current MSHR status. More... | |
class | CacheRequestPort |
A cache request port is used for the memory-side port of the cache, and in addition to the basic timing port that only sends response packets through a transmit list, it also offers the ability to schedule and send request packets (requests & writebacks). More... | |
class | CacheResponsePort |
A cache response port is used for the CPU-side port of the cache, and it is basically a simple timing port that uses a transmit list for responses to the CPU (or connected requestor). More... | |
struct | CacheStats |
class | CpuSidePort |
The CPU-side port extends the base cache response port with access functions for functional, atomic and timing requests. More... | |
class | MemSidePort |
The memory-side port extends the base cache request port with access functions for functional, atomic and timing snoops. More... | |
Public Types | |
enum | BlockedCause { Blocked_NoMSHRs = MSHRQueue_MSHRs, Blocked_NoWBBuffers = MSHRQueue_WriteBuffer, Blocked_NoTargets, NUM_BLOCKED_CAUSES } |
Reasons for caches to be blocked. More... | |
Public Types inherited from ClockedObject | |
typedef ClockedObjectParams | Params |
Parameters of ClockedObject. More... | |
Public Types inherited from SimObject | |
typedef SimObjectParams | Params |
Public Member Functions | |
void | regProbePoints () override |
Registers probes. More... | |
BaseCache (const BaseCacheParams *p, unsigned blk_size) | |
~BaseCache () | |
void | init () override |
init() is called after all C++ SimObjects have been created and all ports are connected. More... | |
Port & | getPort (const std::string &if_name, PortID idx=InvalidPortID) override |
Get a port with a given name and index. More... | |
unsigned | getBlockSize () const |
Query block size of a cache. More... | |
const AddrRangeList & | getAddrRanges () const |
MSHR * | allocateMissBuffer (PacketPtr pkt, Tick time, bool sched_send=true) |
void | allocateWriteBuffer (PacketPtr pkt, Tick time) |
bool | isBlocked () const |
Returns true if the cache is blocked for accesses. More... | |
void | setBlocked (BlockedCause cause) |
Marks the access path of the cache as blocked for the given cause. More... | |
void | clearBlocked (BlockedCause cause) |
Marks the cache as unblocked for the given cause. More... | |
void | schedMemSideSendEvent (Tick time) |
Schedule a send event for the memory-side port. More... | |
bool | inCache (Addr addr, bool is_secure) const |
bool | hasBeenPrefetched (Addr addr, bool is_secure) const |
bool | inMissQueue (Addr addr, bool is_secure) const |
void | incMissCount (PacketPtr pkt) |
void | incHitCount (PacketPtr pkt) |
bool | coalesce () const |
Checks if the cache is coalescing writes. More... | |
void | writebackVisitor (CacheBlk &blk) |
Cache block visitor that writes back dirty cache blocks using functional writes. More... | |
void | invalidateVisitor (CacheBlk &blk) |
Cache block visitor that invalidates all blocks in the cache. More... | |
virtual bool | sendMSHRQueuePacket (MSHR *mshr) |
Take an MSHR, turn it into a suitable downstream packet, and send it out. More... | |
bool | sendWriteQueuePacket (WriteQueueEntry *wq_entry) |
Similar to sendMSHR, but for a write-queue entry instead. More... | |
void | serialize (CheckpointOut &cp) const override |
Serialize the state of the caches. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
Public Member Functions inherited from ClockedObject | |
ClockedObject (const ClockedObjectParams *p) | |
const Params * | params () const |
void | serialize (CheckpointOut &cp) const override |
Serialize an object. More... | |
void | unserialize (CheckpointIn &cp) override |
Unserialize an object. More... | |
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 | 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... | |
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 | |
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) |
This function is not needed by the usual gem5 event loop but may be necessary in derived EventQueues which host gem5 on other schedulers. More... | |
void | setCurTick (Tick newVal) |
EventManager (EventManager &em) | |
Event manger manages events in the event queue. More... | |
EventManager (EventManager *em) | |
EventManager (EventQueue *eq) | |
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 Member Functions inherited from Stats::Group | |
Group (Group *parent, const char *name=nullptr) | |
Construct a new statistics group. More... | |
virtual | ~Group () |
virtual void | regStats () |
Callback to set stat parameters. More... | |
virtual void | resetStats () |
Callback to reset stats. More... | |
virtual void | preDumpStats () |
Callback before stats are dumped. More... | |
void | addStat (Stats::Info *info) |
Register a stat with this group. More... | |
const std::map< std::string, Group * > & | getStatGroups () const |
Get all child groups associated with this object. More... | |
const std::vector< Info * > & | getStats () const |
Get all stats associated with this object. More... | |
void | addStatGroup (const char *name, Group *block) |
Add a stat block as a child of this block. More... | |
const Info * | resolveStat (std::string name) const |
Resolve a stat by its name within this group. More... | |
Group ()=delete | |
Group (const Group &)=delete | |
Group & | operator= (const Group &)=delete |
Public Member Functions inherited from Clocked | |
void | updateClockPeriod () |
Update the tick to the current tick. More... | |
Tick | clockEdge (Cycles cycles=Cycles(0)) const |
Determine the tick when a cycle begins, by default the current one, but the argument also enables the caller to determine a future cycle. More... | |
Cycles | curCycle () const |
Determine the current cycle, corresponding to a tick aligned to a clock edge. More... | |
Tick | nextCycle () const |
Based on the clock of the object, determine the start tick of the first cycle that is at least one cycle in the future. More... | |
uint64_t | frequency () const |
Tick | clockPeriod () const |
double | voltage () const |
Cycles | ticksToCycles (Tick t) const |
Tick | cyclesToTicks (Cycles c) const |
Public Attributes | |
System * | system |
System we are currently operating in. More... | |
BaseCache::CacheStats | stats |
Public Attributes inherited from ClockedObject | |
PowerState * | powerState |
Protected Types | |
enum | MSHRQueueIndex { MSHRQueue_MSHRs, MSHRQueue_WriteBuffer } |
Indexes to enumerate the MSHR queues. More... | |
Protected Member Functions | |
void | markInService (MSHR *mshr, bool pending_modified_resp) |
Mark a request as in service (sent downstream in the memory system), effectively making this MSHR the ordering point. More... | |
void | markInService (WriteQueueEntry *entry) |
bool | allocOnFill (MemCmd cmd) const |
Determine whether we should allocate on a fill or not. More... | |
Addr | regenerateBlkAddr (CacheBlk *blk) |
Regenerate block address using tags. More... | |
Cycles | calculateTagOnlyLatency (const uint32_t delay, const Cycles lookup_lat) const |
Calculate latency of accesses that only touch the tag array. More... | |
Cycles | calculateAccessLatency (const CacheBlk *blk, const uint32_t delay, const Cycles lookup_lat) const |
Calculate access latency in ticks given a tag lookup latency, and whether access was a hit or miss. More... | |
virtual bool | access (PacketPtr pkt, CacheBlk *&blk, Cycles &lat, PacketList &writebacks) |
Does all the processing necessary to perform the provided request. More... | |
virtual void | handleTimingReqHit (PacketPtr pkt, CacheBlk *blk, Tick request_time) |
virtual void | handleTimingReqMiss (PacketPtr pkt, CacheBlk *blk, Tick forward_time, Tick request_time)=0 |
void | handleTimingReqMiss (PacketPtr pkt, MSHR *mshr, CacheBlk *blk, Tick forward_time, Tick request_time) |
virtual void | recvTimingReq (PacketPtr pkt) |
Performs the access specified by the request. More... | |
void | handleUncacheableWriteResp (PacketPtr pkt) |
Handling the special case of uncacheable write responses to make recvTimingResp less cluttered. More... | |
virtual void | serviceMSHRTargets (MSHR *mshr, const PacketPtr pkt, CacheBlk *blk)=0 |
Service non-deferred MSHR targets using the received response. More... | |
virtual void | recvTimingResp (PacketPtr pkt) |
Handles a response (cache line fill/write ack) from the bus. More... | |
virtual void | recvTimingSnoopReq (PacketPtr pkt)=0 |
Snoops bus transactions to maintain coherence. More... | |
virtual void | recvTimingSnoopResp (PacketPtr pkt)=0 |
Handle a snoop response. More... | |
virtual Cycles | handleAtomicReqMiss (PacketPtr pkt, CacheBlk *&blk, PacketList &writebacks)=0 |
Handle a request in atomic mode that missed in this cache. More... | |
virtual Tick | recvAtomic (PacketPtr pkt) |
Performs the access specified by the request. More... | |
virtual Tick | recvAtomicSnoop (PacketPtr pkt)=0 |
Snoop for the provided request in the cache and return the estimated time taken. More... | |
virtual void | functionalAccess (PacketPtr pkt, bool from_cpu_side) |
Performs the access specified by the request. More... | |
void | cmpAndSwap (CacheBlk *blk, PacketPtr pkt) |
Handle doing the Compare and Swap function for SPARC. More... | |
QueueEntry * | getNextQueueEntry () |
Return the next queue entry to service, either a pending miss from the MSHR queue, a buffered write from the write buffer, or something from the prefetcher. More... | |
virtual void | doWritebacks (PacketList &writebacks, Tick forward_time)=0 |
Insert writebacks into the write buffer. More... | |
virtual void | doWritebacksAtomic (PacketList &writebacks)=0 |
Send writebacks down the memory hierarchy in atomic mode. More... | |
virtual PacketPtr | createMissPacket (PacketPtr cpu_pkt, CacheBlk *blk, bool needs_writable, bool is_whole_line_write) const =0 |
Create an appropriate downstream bus request packet. More... | |
void | writebackTempBlockAtomic () |
Send the outstanding tempBlock writeback. More... | |
bool | updateCompressionData (CacheBlk *blk, const uint64_t *data, PacketList &writebacks) |
When a block is overwriten, its compression information must be updated, and it may need to be recompressed. More... | |
virtual void | satisfyRequest (PacketPtr pkt, CacheBlk *blk, bool deferred_response=false, bool pending_downgrade=false) |
Perform any necessary updates to the block and perform any data exchange between the packet and the block. More... | |
void | maintainClusivity (bool from_cache, CacheBlk *blk) |
Maintain the clusivity of this cache by potentially invalidating a block. More... | |
bool | handleEvictions (std::vector< CacheBlk * > &evict_blks, PacketList &writebacks) |
Try to evict the given blocks. More... | |
CacheBlk * | handleFill (PacketPtr pkt, CacheBlk *blk, PacketList &writebacks, bool allocate) |
Handle a fill operation caused by a received packet. More... | |
CacheBlk * | allocateBlock (const PacketPtr pkt, PacketList &writebacks) |
Allocate a new block and perform any necessary writebacks. More... | |
virtual M5_NODISCARD PacketPtr | evictBlock (CacheBlk *blk)=0 |
Evict a cache block. More... | |
void | evictBlock (CacheBlk *blk, PacketList &writebacks) |
Evict a cache block. More... | |
void | invalidateBlock (CacheBlk *blk) |
Invalidate a cache block. More... | |
PacketPtr | writebackBlk (CacheBlk *blk) |
Create a writeback request for the given block. More... | |
PacketPtr | writecleanBlk (CacheBlk *blk, Request::Flags dest, PacketId id) |
Create a writeclean request for the given block. More... | |
virtual void | memWriteback () override |
Write back dirty blocks in the cache using functional accesses. More... | |
virtual void | memInvalidate () override |
Invalidates all blocks in the cache. More... | |
bool | isDirty () const |
Determine if there are any dirty blocks in the cache. More... | |
bool | inRange (Addr addr) const |
Determine if an address is in the ranges covered by this cache. More... | |
Tick | nextQueueReadyTime () const |
Find next request ready time from among possible sources. More... | |
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 Member Functions inherited from Clocked | |
Clocked (ClockDomain &clk_domain) | |
Create a clocked object and set the clock domain based on the parameters. More... | |
Clocked (Clocked &)=delete | |
Clocked & | operator= (Clocked &)=delete |
virtual | ~Clocked () |
Virtual destructor due to inheritance. More... | |
void | resetClock () const |
Reset the object's clock using the current global tick value. More... | |
virtual void | clockPeriodUpdated () |
A hook subclasses can implement so they can do any extra work that's needed when the clock rate is changed. More... | |
Protected Attributes | |
CpuSidePort | cpuSidePort |
MemSidePort | memSidePort |
MSHRQueue | mshrQueue |
Miss status registers. More... | |
WriteQueue | writeBuffer |
Write/writeback buffer. More... | |
BaseTags * | tags |
Tag and data Storage. More... | |
Compressor::Base * | compressor |
Compression method being used. More... | |
Prefetcher::Base * | prefetcher |
Prefetcher. More... | |
ProbePointArg< PacketPtr > * | ppHit |
To probe when a cache hit occurs. More... | |
ProbePointArg< PacketPtr > * | ppMiss |
To probe when a cache miss occurs. More... | |
ProbePointArg< PacketPtr > * | ppFill |
To probe when a cache fill occurs. More... | |
WriteAllocator *const | writeAllocator |
The writeAllocator drive optimizations for streaming writes. More... | |
TempCacheBlk * | tempBlock |
Temporary cache block for occasional transitory use. More... | |
std::unique_ptr< Packet > | pendingDelete |
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent call. More... | |
const bool | writebackClean |
Determine if clean lines should be written back or not. More... | |
PacketPtr | tempBlockWriteback |
Writebacks from the tempBlock, resulting on the response path in atomic mode, must happen after the call to recvAtomic has finished (for the right ordering of the packets). More... | |
EventFunctionWrapper | writebackTempBlockAtomicEvent |
An event to writeback the tempBlock after recvAtomic finishes. More... | |
const unsigned | blkSize |
Block size of this cache. More... | |
const Cycles | lookupLatency |
The latency of tag lookup of a cache. More... | |
const Cycles | dataLatency |
The latency of data access of a cache. More... | |
const Cycles | forwardLatency |
This is the forward latency of the cache. More... | |
const Cycles | fillLatency |
The latency to fill a cache block. More... | |
const Cycles | responseLatency |
The latency of sending reponse to its upper level cache/core on a linefill. More... | |
const bool | sequentialAccess |
Whether tags and data are accessed sequentially. More... | |
const int | numTarget |
The number of targets for each MSHR. More... | |
bool | forwardSnoops |
Do we forward snoops from mem side port through to cpu side port? More... | |
const Enums::Clusivity | clusivity |
Clusivity with respect to the upstream cache, determining if we fill into both this cache and the cache above on a miss. More... | |
const bool | isReadOnly |
Is this cache read only, for example the instruction cache, or table-walker cache. More... | |
uint8_t | blocked |
Bit vector of the blocking reasons for the access path. More... | |
uint64_t | order |
Increasing order number assigned to each incoming request. More... | |
Cycles | blockedCycle |
Stores time the cache blocked for statistics. More... | |
MSHR * | noTargetMSHR |
Pointer to the MSHR that has no targets. More... | |
Counter | missCount |
The number of misses to trigger an exit event. More... | |
const AddrRangeList | addrRanges |
The address range to which the cache responds on the CPU side. 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... | |
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 () |
Gets the fully-qualified name of the active section. More... | |
static void | serializeAll (const std::string &cpt_dir) |
Serializes all the SimObjects. More... | |
static void | unserializeGlobals (CheckpointIn &cp) |
A basic cache interface.
Implements some common functions for speed.
|
protected |
BaseCache::BaseCache | ( | const BaseCacheParams * | p, |
unsigned | blk_size | ||
) |
Definition at line 76 of file base.cc.
References writebackTempBlockAtomic().
|
protectedvirtual |
Does all the processing necessary to perform the provided request.
pkt | The memory request to perform. |
blk | The cache block to be updated. |
lat | The latency of the access. |
writebacks | List for any writebacks that need to be performed. |
Reimplemented in Cache, and NoncoherentCache.
Definition at line 1030 of file base.cc.
References BaseTags::accessBlock(), allocateBlock(), BlkDirty, BlkReadable, blkSize, BlkWritable, calculateAccessLatency(), calculateTagOnlyLatency(), chatty_assert, MemCmd::CleanEvict, Packet::clearBlockCached(), Clocked::clockEdge(), Packet::cmd, compressor, Clocked::cyclesToTicks(), CacheBlk::data, DPRINTF, fillLatency, Queue< Entry >::findMatch(), Packet::fromCache(), Packet::getAddr(), Packet::getConstPtr(), Compressor::Base::getDecompressionLatency(), WriteQueueEntry::getNumTargets(), Packet::getSize(), WriteQueueEntry::getTarget(), Packet::hasSharers(), Packet::headerDelay, incHitCount(), incMissCount(), invalidateBlock(), Packet::isCleanEviction(), Packet::isEviction(), Packet::isLLSC(), Packet::isRead(), CacheBlk::isReadable(), isReadOnly, Packet::isRequest(), Packet::isSecure(), CacheBlk::isWritable(), Packet::isWrite(), Packet::isWriteback(), maintainClusivity(), markInService(), mshrQueue, SimObject::name(), Packet::needsResponse(), Packet::needsWritable(), Packet::payloadDelay, QueueEntry::Target::pkt, CacheBlk::print(), Packet::print(), Packet::req, satisfyRequest(), CacheBlk::setWhenReady(), CacheBlk::status, tags, updateCompressionData(), MemCmd::WritebackClean, MemCmd::WritebackDirty, writeBuffer, MemCmd::WriteClean, Packet::writeDataToBlock(), and Packet::writeThrough().
Referenced by NoncoherentCache::access(), Cache::access(), recvAtomic(), and recvTimingReq().
|
protected |
Allocate a new block and perform any necessary writebacks.
Find a victim block and if necessary prepare writebacks for any existing data. May return nullptr if there are no replaceable blocks. If a replaceable block is found, it inserts the new block in its place. The new block, however, is not set as valid yet.
pkt | Packet holding the address to update |
writebacks | A list of writeback packets for the evicted blocks |
Definition at line 1403 of file base.cc.
References addr, blkSize, Compressor::Base::compress(), compressor, DPRINTF, BaseTags::findVictim(), Packet::getAddr(), Packet::getConstPtr(), handleEvictions(), Packet::hasData(), BaseTags::insertBlock(), Packet::isSecure(), CacheBlk::print(), Compressor::Base::setDecompressionLatency(), Compressor::Base::setSizeBits(), and tags.
Referenced by access(), and handleFill().
Definition at line 1097 of file base.hh.
References MSHRQueue::allocate(), allocOnFill(), blkSize, Packet::cmd, Packet::getBlockAddr(), Queue< Entry >::isFull(), mshrQueue, MSHRQueue_MSHRs, order, schedMemSideSendEvent(), and setBlocked().
Referenced by getNextQueueEntry(), Cache::handleTimingReqMiss(), and handleTimingReqMiss().
Definition at line 1115 of file base.hh.
References WriteQueue::allocate(), blkSize, MemCmd::CleanEvict, Packet::cmd, compressor, DPRINTF, Queue< Entry >::findMatch(), Packet::getBlockAddr(), QueueEntry::inService, Queue< Entry >::isFull(), Packet::isSecure(), Packet::isWrite(), MSHRQueue_WriteBuffer, order, Packet::payloadDelay, Packet::print(), schedMemSideSendEvent(), setBlocked(), and writeBuffer.
Referenced by NoncoherentCache::doWritebacks(), Cache::doWritebacks(), Cache::handleTimingReqMiss(), and handleTimingReqMiss().
|
inlineprotected |
Determine whether we should allocate on a fill or not.
If this cache is mostly inclusive with regards to the upstream cache(s) we always allocate (for any non-forwarded and cacheable requests). In the case of a mostly exclusive cache, we allocate on fill if the packet did not come from a cache, thus if we: are dealing with a whole-line write (the latter behaves much like a writeback), the original target packet came from a non-caching source, or if we are performing a prefetch or LLSC.
cmd | Command of the incoming requesting packet |
Definition at line 404 of file base.hh.
References clusivity, MemCmd::isLLSC(), MemCmd::isPrefetch(), MemCmd::ReadReq, MemCmd::WriteLineReq, and MemCmd::WriteReq.
Referenced by allocateMissBuffer(), NoncoherentCache::handleAtomicReqMiss(), Cache::handleAtomicReqMiss(), and handleTimingReqMiss().
|
protected |
Calculate access latency in ticks given a tag lookup latency, and whether access was a hit or miss.
blk | The cache block that was accessed. |
delay | The delay until the packet's metadata is present. |
lookup_lat | Latency of the respective tag lookup. |
Definition at line 996 of file base.cc.
References calculateTagOnlyLatency(), curTick(), dataLatency, CacheBlk::getWhenReady(), sequentialAccess, Clocked::tick, and Clocked::ticksToCycles().
Referenced by access().
|
protected |
Calculate latency of accesses that only touch the tag array.
delay | The delay until the packet's metadata is present. |
lookup_lat | Latency of the respective tag lookup. |
Definition at line 987 of file base.cc.
References Clocked::ticksToCycles().
Referenced by access(), and calculateAccessLatency().
|
inline |
Marks the cache as unblocked for the given cause.
This also clears the blocked flags in the appropriate interfaces.
cause | The newly unblocked cause. |
Definition at line 1179 of file base.hh.
References blocked, BaseCache::CacheStats::blocked_cycles, blockedCycle, BaseCache::CacheResponsePort::clearBlocked(), cpuSidePort, Clocked::curCycle(), DPRINTF, and stats.
Referenced by markInService(), recvTimingResp(), and Cache::sendMSHRQueuePacket().
Handle doing the Compare and Swap function for SPARC.
Definition at line 677 of file base.cc.
References BlkDirty, blkSize, CacheBlk::data, Packet::getOffset(), Packet::getSize(), Packet::isRequest(), ArmISA::offset, panic, Packet::req, Packet::setData(), CacheBlk::status, and Packet::writeData().
Referenced by satisfyRequest().
bool BaseCache::coalesce | ( | ) | const |
Checks if the cache is coalescing writes.
Definition at line 1598 of file base.cc.
References WriteAllocator::coalesce(), and writeAllocator.
Referenced by Prefetcher::Base::probeNotify().
|
protectedpure virtual |
Create an appropriate downstream bus request packet.
Creates a new packet with the request to be send to the memory below, or nullptr if the current request in cpu_pkt should just be forwarded on.
cpu_pkt | The miss packet that needs to be satisfied. |
blk | The referenced block, can be nullptr. |
needs_writable | Indicates that the block must be writable even if the request in cpu_pkt doesn't indicate that. |
is_whole_line_write | True if there are writes for the whole line |
Implemented in Cache, and NoncoherentCache.
Referenced by sendMSHRQueuePacket().
|
protectedpure virtual |
Insert writebacks into the write buffer.
Implemented in Cache, and NoncoherentCache.
Referenced by recvTimingReq(), recvTimingResp(), and sendMSHRQueuePacket().
|
protectedpure virtual |
Send writebacks down the memory hierarchy in atomic mode.
Implemented in Cache, and NoncoherentCache.
Referenced by recvAtomic(), and writebackTempBlockAtomic().
|
protectedpure virtual |
Evict a cache block.
Performs a writeback if necesssary and invalidates the block
blk | Block to invalidate |
Implemented in Cache, and NoncoherentCache.
Referenced by Cache::access(), evictBlock(), handleEvictions(), recvAtomic(), and recvTimingResp().
|
protected |
Evict a cache block.
Performs a writeback if necesssary and invalidates the block
blk | Block to invalidate |
writebacks | Return a list of packets with writebacks |
Definition at line 1477 of file base.cc.
References evictBlock().
|
protectedvirtual |
Performs the access specified by the request.
pkt | The request to perform. |
fromCpuSide | from the CPU side port or the memory side port |
Reimplemented in NoncoherentCache.
Definition at line 620 of file base.cc.
References blkSize, cpuSidePort, CacheBlk::data, DPRINTF, BaseTags::findBlock(), Queue< Entry >::findMatch(), Packet::getAddr(), Packet::getBlockAddr(), QueueEntry::inService, CacheBlk::isDirty(), MSHR::isPendingModified(), Packet::isSecure(), ResponsePort::isSnooping(), CacheBlk::isValid(), Packet::makeResponse(), memSidePort, mshrQueue, SimObject::name(), Packet::popLabel(), Packet::print(), Packet::pushLabel(), RequestPort::sendFunctional(), ResponsePort::sendFunctionalSnoop(), tags, QueuedResponsePort::trySatisfyFunctional(), QueuedRequestPort::trySatisfyFunctional(), Queue< Entry >::trySatisfyFunctional(), Packet::trySatisfyFunctional(), and writeBuffer.
Referenced by NoncoherentCache::functionalAccess().
|
inline |
Definition at line 1095 of file base.hh.
References addrRanges.
|
inline |
Query block size of a cache.
Definition at line 1090 of file base.hh.
References blkSize.
Referenced by Prefetcher::Base::setCache().
|
protected |
Return the next queue entry to service, either a pending miss from the MSHR queue, a buffered write from the write buffer, or something from the prefetcher.
This function is responsible for prioritizing among those sources on the fly.
Definition at line 717 of file base.cc.
References allocateMissBuffer(), blkSize, MSHRQueue::canPrefetch(), BaseCache::CacheStats::cmdStats(), curTick(), BaseTags::findBlock(), Queue< Entry >::findMatch(), Queue< Entry >::findPending(), Packet::getBlockAddr(), Queue< Entry >::getNext(), Prefetcher::Base::getPacket(), isBlocked(), Queue< Entry >::isFull(), Packet::isSecure(), System::maxRequestors(), BaseCache::CacheCmdStats::mshr_misses, mshrQueue, QueueEntry::order, prefetcher, Packet::req, stats, system, tags, and writeBuffer.
|
overridevirtual |
Get a port with a given name and index.
This is used at binding time and returns a reference to a protocol-agnostic port.
gem5 has a request and response port interface. All memory objects are connected together via ports. These ports provide a rigid interface between these memory objects. These ports implement three different memory system modes: timing, atomic, and functional. The most important mode is the timing mode and here timing mode is used for conducting cycle-level timing experiments. The other modes are only used in special circumstances and should not be used to conduct cycle-level timing experiments. The other modes are only used in special circumstances. These ports allow SimObjects to communicate with each other.
if_name | Port name |
idx | Index in the case of a VectorPort |
Reimplemented from SimObject.
Definition at line 188 of file base.cc.
References cpuSidePort, SimObject::getPort(), and memSidePort.
|
protectedpure virtual |
Handle a request in atomic mode that missed in this cache.
Creates a downstream request, sends it to the memory below and handles the response. As we are in atomic mode all operations are performed immediately.
pkt | The packet with the requests |
blk | The referenced block |
writebacks | A list with packets for any performed writebacks |
Implemented in Cache, and NoncoherentCache.
Referenced by recvAtomic().
|
protected |
Try to evict the given blocks.
If any of them is a transient eviction, that is, the block is present in the MSHR queue all evictions are cancelled since handling such cases has not been implemented.
evict_blks | Blocks marked for eviction. |
writebacks | List for any writebacks that need to be performed. |
Definition at line 795 of file base.cc.
References evictBlock(), Queue< Entry >::findMatch(), MSHR::isCleaning(), mshrQueue, MSHR::needsWritable(), regenerateBlkAddr(), BaseCache::CacheStats::replacements, and stats.
Referenced by allocateBlock(), and updateCompressionData().
|
protected |
Handle a fill operation caused by a received packet.
Populates a cache block and handles all outstanding requests for the satisfied fill request. This version takes two memory requests. One contains the fill data, the other is an optional target to satisfy. Note that the reason we return a list of writebacks rather than inserting them directly in the write buffer is that this function is called by both atomic and timing-mode accesses, and in atomic mode we don't mess with the write buffer (we just perform the writebacks atomically once the original request is complete).
pkt | The memory request with the fill data. |
blk | The cache block if it already exists. |
writebacks | List for any writebacks that need to be performed. |
allocate | Whether to allocate a block or use the temp block |
Definition at line 1306 of file base.cc.
References addr, allocateBlock(), BlkDirty, BlkReadable, blkSize, BlkWritable, Packet::cacheResponding(), chatty_assert, Clocked::clockEdge(), Packet::cmd, CacheBlk::data, DPRINTF, fillLatency, Queue< Entry >::findMatch(), Packet::getAddr(), Packet::getBlockAddr(), Packet::getSize(), Packet::hasData(), Packet::hasSharers(), Packet::headerDelay, TempCacheBlk::insert(), MemCmd::InvalidateResp, Packet::isRead(), isReadOnly, Packet::isResponse(), CacheBlk::isSecure(), Packet::isSecure(), CacheBlk::isValid(), SimObject::name(), Packet::payloadDelay, CacheBlk::print(), regenerateBlkAddr(), CacheBlk::setWhenReady(), CacheBlk::status, tempBlock, writeBuffer, and Packet::writeDataToBlock().
Referenced by NoncoherentCache::handleAtomicReqMiss(), Cache::handleAtomicReqMiss(), and recvTimingResp().
|
protectedvirtual |
Reimplemented in Cache.
Definition at line 211 of file base.cc.
References cpuSidePort, DPRINTF, Packet::headerDelay, Packet::makeTimingResponse(), Packet::needsResponse(), Packet::payloadDelay, pendingDelete, Packet::print(), and QueuedResponsePort::schedTimingResp().
Referenced by Cache::handleTimingReqHit(), and recvTimingReq().
|
protectedpure virtual |
Implemented in Cache, and NoncoherentCache.
Referenced by NoncoherentCache::handleTimingReqMiss(), Cache::handleTimingReqMiss(), and recvTimingReq().
|
protected |
MSHR hit
Definition at line 239 of file base.cc.
References allocateMissBuffer(), MSHR::allocateTarget(), allocateWriteBuffer(), allocOnFill(), BlkReadable, blkSize, Blocked_NoTargets, MemCmd::CleanEvict, Packet::cmd, BaseCache::CacheStats::cmdStats(), DPRINTF, Packet::getAddr(), Packet::getBlockAddr(), MSHR::getNumTargets(), Packet::getSize(), Packet::isEviction(), CacheBlk::isValid(), CacheBlk::isWritable(), Packet::isWrite(), Packet::isWriteback(), System::maxRequestors(), BaseCache::CacheCmdStats::mshr_hits, BaseCache::CacheCmdStats::mshr_misses, Packet::needsWritable(), noTargetMSHR, numTarget, order, pendingDelete, Packet::print(), Packet::req, setBlocked(), stats, CacheBlk::status, system, WriteAllocator::updateMode(), writeAllocator, and MemCmd::WriteClean.
|
protected |
Handling the special case of uncacheable write responses to make recvTimingResp less cluttered.
Definition at line 390 of file base.cc.
References Clocked::clockEdge(), cpuSidePort, Packet::headerDelay, Packet::payloadDelay, responseLatency, and QueuedResponsePort::schedTimingResp().
Referenced by recvTimingResp().
|
inline |
Definition at line 1207 of file base.hh.
References addr, BaseTags::findBlock(), tags, and CacheBlk::wasPrefetched().
Referenced by Prefetcher::Base::hasBeenPrefetched().
|
inline |
Definition at line 1203 of file base.hh.
References addr, BaseTags::findBlock(), and tags.
Referenced by Prefetcher::Base::inCache().
|
inline |
Definition at line 1231 of file base.hh.
References BaseCache::CacheStats::cmdStats(), BaseCache::CacheCmdStats::hits, System::maxRequestors(), Packet::req, stats, and system.
Referenced by access().
|
inline |
Definition at line 1220 of file base.hh.
References BaseCache::CacheStats::cmdStats(), exitSimLoop(), System::maxRequestors(), missCount, BaseCache::CacheCmdStats::misses, Packet::req, stats, and system.
Referenced by access().
|
overridevirtual |
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 179 of file base.cc.
References cpuSidePort, fatal, forwardSnoops, Port::isConnected(), ResponsePort::isSnooping(), memSidePort, SimObject::name(), and ResponsePort::sendRangeChange().
|
inline |
Definition at line 1216 of file base.hh.
References addr, Queue< Entry >::findMatch(), and mshrQueue.
Referenced by Prefetcher::Base::inMissQueue().
|
protected |
Determine if an address is in the ranges covered by this cache.
This is useful to filter snoops.
addr | Address to check against |
Definition at line 200 of file base.cc.
References addr, addrRanges, and MipsISA::r.
Referenced by Cache::recvAtomicSnoop(), and Cache::recvTimingSnoopReq().
|
protected |
Invalidate a cache block.
blk | Block to invalidate |
Definition at line 1460 of file base.cc.
References BaseTags::invalidate(), TempCacheBlk::invalidate(), stats, tags, tempBlock, BaseCache::CacheStats::unusedPrefetches, and CacheBlk::wasPrefetched().
Referenced by access(), NoncoherentCache::evictBlock(), Cache::evictBlock(), Cache::handleAtomicReqMiss(), Cache::handleSnoop(), invalidateVisitor(), maintainClusivity(), satisfyRequest(), and Cache::serviceMSHRTargets().
void BaseCache::invalidateVisitor | ( | CacheBlk & | blk | ) |
Cache block visitor that invalidates all blocks in the cache.
@warn Dirty cache lines will not be written back to memory.
Definition at line 1627 of file base.cc.
References invalidateBlock(), CacheBlk::isDirty(), CacheBlk::isValid(), and warn_once.
Referenced by memInvalidate().
|
inline |
Returns true if the cache is blocked for accesses.
Definition at line 1150 of file base.hh.
References blocked.
Referenced by getNextQueueEntry(), nextQueueReadyTime(), and recvTimingResp().
|
protected |
Determine if there are any dirty blocks in the cache.
Definition at line 1592 of file base.cc.
References BaseTags::anyBlk(), CacheBlk::isDirty(), and tags.
Referenced by serialize().
|
protected |
Maintain the clusivity of this cache by potentially invalidating a block.
This method works in conjunction with satisfyRequest, but is separate to allow us to handle all MSHR targets before potentially dropping a block.
from_cache | Whether we have dealt with a packet from a cache |
blk | The block that should potentially be dropped |
Definition at line 1294 of file base.cc.
References clusivity, invalidateBlock(), CacheBlk::isDirty(), and CacheBlk::isValid().
Referenced by access(), NoncoherentCache::handleAtomicReqMiss(), Cache::handleAtomicReqMiss(), and Cache::serviceMSHRTargets().
|
inlineprotected |
Mark a request as in service (sent downstream in the memory system), effectively making this MSHR the ordering point.
Definition at line 371 of file base.hh.
References Blocked_NoMSHRs, clearBlocked(), Queue< Entry >::isFull(), MSHRQueue::markInService(), and mshrQueue.
Referenced by access(), Cache::recvTimingSnoopReq(), Cache::sendMSHRQueuePacket(), sendMSHRQueuePacket(), and sendWriteQueuePacket().
|
inlineprotected |
Definition at line 381 of file base.hh.
References Blocked_NoWBBuffers, clearBlocked(), Queue< Entry >::isFull(), WriteQueue::markInService(), and writeBuffer.
|
overrideprotectedvirtual |
Invalidates all blocks in the cache.
@warn Dirty cache lines will not be written back to memory. Make sure to call functionalWriteback() first if you want the to write them to memory.
Reimplemented from SimObject.
Definition at line 1586 of file base.cc.
References BaseTags::forEachBlk(), invalidateVisitor(), and tags.
|
overrideprotectedvirtual |
Write back dirty blocks in the cache using functional accesses.
Reimplemented from SimObject.
Definition at line 1580 of file base.cc.
References BaseTags::forEachBlk(), tags, and writebackVisitor().
|
protected |
Find next request ready time from among possible sources.
Definition at line 1640 of file base.cc.
References MSHRQueue::canPrefetch(), isBlocked(), mshrQueue, Prefetcher::Base::nextPrefetchReadyTime(), Queue< Entry >::nextReadyTime(), prefetcher, and writeBuffer.
Performs the access specified by the request.
pkt | The request to perform. |
Reimplemented in Cache, and NoncoherentCache.
Definition at line 540 of file base.cc.
References access(), Clocked::clockPeriod(), curTick(), doWritebacksAtomic(), DPRINTF, evictBlock(), handleAtomicReqMiss(), Packet::id, Packet::isClean(), CacheBlk::isDirty(), CacheBlk::isValid(), lookupLatency, Packet::makeAtomicResponse(), Packet::needsResponse(), CacheBlk::print(), Packet::print(), Packet::req, EventManager::schedule(), Packet::setSatisfied(), tempBlock, tempBlockWriteback, writebackTempBlockAtomic(), writebackTempBlockAtomicEvent, and writecleanBlk().
Referenced by NoncoherentCache::recvAtomic(), and Cache::recvAtomic().
Snoop for the provided request in the cache and return the estimated time taken.
pkt | The memory request to snoop |
Implemented in Cache, and NoncoherentCache.
|
protectedvirtual |
Performs the access specified by the request.
pkt | The request to perform. |
Reimplemented in Cache, and NoncoherentCache.
Definition at line 334 of file base.cc.
References access(), BlkHWPrefetched, Clocked::clockEdge(), doWritebacks(), forwardLatency, handleTimingReqHit(), handleTimingReqMiss(), Packet::headerDelay, MaxTick, Prefetcher::Base::nextPrefetchReadyTime(), Packet::payloadDelay, ppHit, ppMiss, prefetcher, schedMemSideSendEvent(), CacheBlk::status, and CacheBlk::wasPrefetched().
Referenced by NoncoherentCache::recvTimingReq(), and Cache::recvTimingReq().
|
protectedvirtual |
Handles a response (cache line fill/write ack) from the bus.
pkt | The response packet |
Reimplemented in NoncoherentCache.
Definition at line 402 of file base.cc.
References WriteAllocator::allocate(), MSHR::allocOnFill(), BlkReadable, Blocked_NoMSHRs, Blocked_NoTargets, MSHRQueue::canPrefetch(), clearBlocked(), Clocked::clockEdge(), Packet::cmd, BaseCache::CacheStats::cmdStats(), curTick(), Queue< Entry >::deallocate(), doWritebacks(), DPRINTF, evictBlock(), BaseTags::findBlock(), forwardLatency, Packet::getAddr(), MSHR::getTarget(), handleFill(), handleUncacheableWriteResp(), MemCmd::HardPFResp, Packet::headerDelay, isBlocked(), Packet::isClean(), Packet::isError(), MSHR::isForward, Queue< Entry >::isFull(), Packet::isInvalidate(), Packet::isRead(), Packet::isResponse(), Packet::isSecure(), CacheBlk::isValid(), CacheBlk::isWritable(), Packet::isWrite(), MSHRQueue::markPending(), System::maxRequestors(), MaxTick, BaseCache::CacheCmdStats::mshr_miss_latency, BaseCache::CacheCmdStats::mshr_uncacheable_lat, mshrQueue, SimObject::name(), Prefetcher::Base::nextPrefetchReadyTime(), noTargetMSHR, panic_if, Packet::payloadDelay, QueueEntry::Target::pkt, Packet::popSenderState(), ppFill, prefetcher, Packet::print(), MSHR::promoteDeferredTargets(), MSHR::promoteReadable(), MSHR::promoteWritable(), QueueEntry::Target::recvTime, Packet::req, schedMemSideSendEvent(), serviceMSHRTargets(), stats, CacheBlk::status, system, tags, tempBlock, MemCmd::UpgradeResp, MSHR::wasWholeLineWrite, and writeAllocator.
Referenced by NoncoherentCache::recvTimingResp(), and Cache::recvTimingSnoopResp().
|
protectedpure virtual |
Snoops bus transactions to maintain coherence.
pkt | The current bus transaction. |
Implemented in Cache, and NoncoherentCache.
|
protectedpure virtual |
Handle a snoop response.
pkt | Snoop response packet |
Implemented in Cache, and NoncoherentCache.
Regenerate block address using tags.
Block address regeneration depends on whether we're using a temporary block or not.
blk | The block to regenerate address. |
Definition at line 169 of file base.cc.
References TempCacheBlk::getAddr(), BaseTags::regenerateBlkAddr(), tags, and tempBlock.
Referenced by Cache::cleanEvictBlk(), handleEvictions(), handleFill(), writebackBlk(), writebackVisitor(), and writecleanBlk().
|
overridevirtual |
|
protectedvirtual |
Perform any necessary updates to the block and perform any data exchange between the packet and the block.
The flags of the packet are also set accordingly.
pkt | Request packet from upstream that hit a block |
blk | Cache block that the packet hit |
deferred_response | Whether this request originally missed |
pending_downgrade | Whether the writable flag is to be removed |
Reimplemented in Cache, and NoncoherentCache.
Definition at line 904 of file base.cc.
References BlkDirty, blkSize, CacheBlk::checkWrite(), Packet::cmd, cmpAndSwap(), CacheBlk::data, DPRINTF, BaseTags::extractBlkOffset(), Packet::getAddr(), Packet::getAtomicOp(), Packet::getOffset(), Packet::getSize(), Packet::hasRespData(), Packet::hasSharers(), invalidateBlock(), Packet::isAtomicOp(), Packet::isClean(), CacheBlk::isDirty(), Packet::isInvalidate(), Packet::isLLSC(), Packet::isRead(), Packet::isRequest(), Packet::isUpgrade(), CacheBlk::isValid(), CacheBlk::isWritable(), Packet::isWrite(), ArmISA::offset, Packet::print(), Packet::setCacheResponding(), Packet::setData(), Packet::setDataFromBlock(), CacheBlk::status, MemCmd::SwapReq, tags, CacheBlk::trackLoadLocked(), and Packet::writeDataToBlock().
Referenced by access(), NoncoherentCache::satisfyRequest(), and Cache::satisfyRequest().
|
inline |
Schedule a send event for the memory-side port.
If already scheduled, this may reschedule the event at an earlier time. When the specified time is reached, the port is free to send either a response, a request, or a prefetch request.
time | The time when to attempt sending a packet. |
Definition at line 1198 of file base.hh.
References memSidePort, and BaseCache::CacheRequestPort::schedSendEvent().
Referenced by allocateMissBuffer(), allocateWriteBuffer(), recvTimingReq(), and recvTimingResp().
|
virtual |
Take an MSHR, turn it into a suitable downstream packet, and send it out.
This construct allows a queue entry to choose a suitable approach based on its type.
mshr | The MSHR to turn into a packet and send |
Reimplemented in Cache.
Definition at line 1657 of file base.cc.
References QueueEntry::blkAddr, blkSize, Packet::cacheResponding(), Clocked::clockPeriod(), WriteAllocator::coalesce(), createMissPacket(), MSHRQueue::delay(), WriteAllocator::delay(), doWritebacks(), DPRINTF, BaseTags::findBlock(), Packet::getSize(), MSHR::getTarget(), Packet::hasSharers(), Packet::id, Packet::isClean(), CacheBlk::isDirty(), MSHR::isForward, QueueEntry::isSecure, MSHR::isWholeLineWrite(), Packet::isWrite(), markInService(), memSidePort, mshrQueue, MSHR::needsWritable(), QueueEntry::Target::pkt, CacheBlk::print(), Packet::print(), Packet::pushSenderState(), Packet::req, WriteAllocator::reset(), WriteAllocator::resetDelay(), RequestPort::sendTimingReq(), Packet::setSatisfied(), tags, writeAllocator, and writecleanBlk().
Referenced by Cache::sendMSHRQueuePacket(), and MSHR::sendPacket().
bool BaseCache::sendWriteQueuePacket | ( | WriteQueueEntry * | wq_entry | ) |
Similar to sendMSHR, but for a write-queue entry instead.
Create the packet, and send it, and if successful also mark the entry in service.
wq_entry | The write-queue entry to turn into a packet and send |
Definition at line 1760 of file base.cc.
References DPRINTF, WriteQueueEntry::getTarget(), markInService(), memSidePort, QueueEntry::Target::pkt, Packet::print(), and RequestPort::sendTimingReq().
Referenced by WriteQueueEntry::sendPacket().
|
overridevirtual |
Serialize the state of the caches.
We currently don't support checkpointing cache state, so this panics.
Implements Serializable.
Definition at line 1784 of file base.cc.
References isDirty(), SERIALIZE_SCALAR, and warn.
|
protectedpure virtual |
Service non-deferred MSHR targets using the received response.
Iterates through the list of targets that can be serviced with the current response.
mshr | The MSHR that corresponds to the reponse |
pkt | The response packet |
blk | The reference block |
Implemented in Cache, and NoncoherentCache.
Referenced by recvTimingResp().
|
inline |
Marks the access path of the cache as blocked for the given cause.
This also sets the blocked flag in the response interface.
cause | The reason for the cache blocking. |
Definition at line 1160 of file base.hh.
References blocked, BaseCache::CacheStats::blocked_causes, blockedCycle, cpuSidePort, Clocked::curCycle(), DPRINTF, BaseCache::CacheResponsePort::setBlocked(), and stats.
Referenced by allocateMissBuffer(), allocateWriteBuffer(), and handleTimingReqMiss().
|
overridevirtual |
Unserialize an object.
Read an object's state from the current checkpoint section.
cp | Checkpoint state |
Implements Serializable.
Definition at line 1804 of file base.cc.
References fatal, and UNSERIALIZE_SCALAR.
|
protected |
When a block is overwriten, its compression information must be updated, and it may need to be recompressed.
If the compression size changes, the block may either become smaller, in which case there is no side effect, or bigger (data expansion; fat write), in which case the block might not fit in its current location anymore. If that happens, there are usually two options to be taken:
This implementation uses the first approach.
Notice that this is only called for writebacks, which means that L1 caches (which see regular Writes), do not support compression.
blk | The block to be overwriten. |
data | A pointer to the data to be compressed (blk's new data). |
writebacks | List for any writebacks that need to be performed. |
Definition at line 832 of file base.cc.
References SectorBlk::blks, SuperBlk::canCoAllocate(), Compressor::Base::compress(), compressor, data, BaseCache::CacheStats::dataExpansions, DPRINTF, SectorSubBlk::getSectorBlock(), CompressionBlk::getSizeBits(), handleEvictions(), CompressionBlk::isCompressed(), SuperBlk::isCompressed(), CacheBlk::print(), CompressionBlk::setCompressed(), CompressionBlk::setDecompressionLatency(), CompressionBlk::setSizeBits(), CompressionBlk::setUncompressed(), stats, and tempBlock.
Referenced by access().
Create a writeback request for the given block.
blk | The block to writeback. |
Definition at line 1486 of file base.cc.
References Packet::allocate(), BlkDirty, blkSize, BlkWritable, chatty_assert, compressor, CacheBlk::data, DPRINTF, Compressor::Base::getDecompressionLatency(), CacheBlk::isDirty(), isReadOnly, CacheBlk::isSecure(), CacheBlk::isValid(), CacheBlk::isWritable(), Packet::payloadDelay, Packet::print(), regenerateBlkAddr(), Request::SECURE, Packet::setDataFromBlock(), Packet::setHasSharers(), stats, CacheBlk::status, CacheBlk::task_id, Request::wbRequestorId, MemCmd::WritebackClean, writebackClean, MemCmd::WritebackDirty, and BaseCache::CacheStats::writebacks.
Referenced by NoncoherentCache::evictBlock(), and Cache::evictBlock().
|
inlineprotected |
Send the outstanding tempBlock writeback.
To be called after recvAtomic finishes in cases where the block we filled is in fact the tempBlock, and now needs to be written back.
Definition at line 642 of file base.hh.
References doWritebacksAtomic(), and tempBlockWriteback.
Referenced by BaseCache(), and recvAtomic().
void BaseCache::writebackVisitor | ( | CacheBlk & | blk | ) |
Cache block visitor that writes back dirty cache blocks using functional writes.
Definition at line 1604 of file base.cc.
References BlkDirty, blkSize, CacheBlk::data, Packet::dataStatic(), Request::funcRequestorId, CacheBlk::isDirty(), CacheBlk::isSecure(), CacheBlk::isValid(), memSidePort, regenerateBlkAddr(), Request::SECURE, RequestPort::sendFunctional(), CacheBlk::status, CacheBlk::task_id, and MemCmd::WriteReq.
Referenced by memWriteback().
|
protected |
Create a writeclean request for the given block.
Creates a request that writes the block to the cache below without evicting the block from the current cache.
blk | The block to write clean. |
dest | The destination of the write clean operation. |
id | Use the given packet id for the write clean operation. |
Definition at line 1534 of file base.cc.
References Packet::allocate(), BlkDirty, blkSize, BlkWritable, compressor, CacheBlk::data, DPRINTF, Compressor::Base::getDecompressionLatency(), CacheBlk::isDirty(), CacheBlk::isSecure(), CacheBlk::isWritable(), Packet::payloadDelay, Packet::print(), regenerateBlkAddr(), Request::SECURE, Packet::setDataFromBlock(), Packet::setHasSharers(), Packet::setWriteThrough(), CacheBlk::status, CacheBlk::task_id, Request::wbRequestorId, and MemCmd::WriteClean.
Referenced by Cache::handleSnoop(), recvAtomic(), and sendMSHRQueuePacket().
|
protected |
The address range to which the cache responds on the CPU side.
Normally this is all possible memory addresses.
Definition at line 917 of file base.hh.
Referenced by getAddrRanges(), and inRange().
|
protected |
Block size of this cache.
Definition at line 839 of file base.hh.
Referenced by access(), allocateBlock(), allocateMissBuffer(), allocateWriteBuffer(), BaseCache::CacheReqPacketQueue::checkConflictingSnoop(), Cache::cleanEvictBlk(), cmpAndSwap(), NoncoherentCache::createMissPacket(), Cache::createMissPacket(), Cache::doTimingSupplyResponse(), functionalAccess(), getBlockSize(), getNextQueueEntry(), NoncoherentCache::handleAtomicReqMiss(), Cache::handleAtomicReqMiss(), handleFill(), Cache::handleSnoop(), NoncoherentCache::handleTimingReqMiss(), Cache::handleTimingReqMiss(), handleTimingReqMiss(), Cache::promoteWholeLineWrites(), Cache::recvTimingSnoopReq(), Cache::satisfyRequest(), satisfyRequest(), sendMSHRQueuePacket(), NoncoherentCache::serviceMSHRTargets(), Cache::serviceMSHRTargets(), writebackBlk(), writebackVisitor(), and writecleanBlk().
|
protected |
Bit vector of the blocking reasons for the access path.
Definition at line 900 of file base.hh.
Referenced by BaseCache::CacheResponsePort::clearBlocked(), clearBlocked(), isBlocked(), setBlocked(), and BaseCache::CpuSidePort::tryTiming().
|
protected |
Stores time the cache blocked for statistics.
Definition at line 906 of file base.hh.
Referenced by clearBlocked(), and setBlocked().
|
protected |
Clusivity with respect to the upstream cache, determining if we fill into both this cache and the cache above on a miss.
Note that we currently do not support strict clusivity policies.
Definition at line 886 of file base.hh.
Referenced by allocOnFill(), Cache::createMissPacket(), and maintainClusivity().
|
protected |
Compression method being used.
Definition at line 323 of file base.hh.
Referenced by access(), allocateBlock(), allocateWriteBuffer(), Cache::handleSnoop(), updateCompressionData(), writebackBlk(), and writecleanBlk().
|
protected |
Definition at line 308 of file base.hh.
Referenced by clearBlocked(), functionalAccess(), getPort(), Cache::handleSnoop(), handleTimingReqHit(), Cache::handleTimingReqMiss(), handleUncacheableWriteResp(), init(), Cache::isCachedAbove(), Cache::sendMSHRQueuePacket(), NoncoherentCache::serviceMSHRTargets(), Cache::serviceMSHRTargets(), and setBlocked().
|
protected |
The latency of data access of a cache.
It occurs when there is an access to the cache.
Definition at line 851 of file base.hh.
Referenced by calculateAccessLatency().
|
protected |
The latency to fill a cache block.
Definition at line 861 of file base.hh.
Referenced by access(), and handleFill().
|
protected |
This is the forward latency of the cache.
It occurs when there is a cache miss and a request is forwarded downstream, in particular an outbound miss.
Definition at line 858 of file base.hh.
Referenced by Cache::doTimingSupplyResponse(), Cache::handleSnoop(), recvTimingReq(), recvTimingResp(), and Cache::recvTimingSnoopResp().
|
protected |
Do we forward snoops from mem side port through to cpu side port?
Definition at line 879 of file base.hh.
Referenced by Cache::handleSnoop(), init(), Cache::isCachedAbove(), and Cache::sendMSHRQueuePacket().
|
protected |
Is this cache read only, for example the instruction cache, or table-walker cache.
A cache that is read only should never see any writes, and should never get any dirty data (and hence never have to do any writebacks).
Definition at line 894 of file base.hh.
Referenced by Cache::access(), access(), Cache::createMissPacket(), handleFill(), Cache::handleSnoop(), Cache::serviceMSHRTargets(), and writebackBlk().
|
protected |
The latency of tag lookup of a cache.
It occurs when there is an access to the cache.
Definition at line 845 of file base.hh.
Referenced by Cache::access(), recvAtomic(), Cache::recvAtomicSnoop(), and Cache::recvTimingSnoopReq().
|
protected |
Definition at line 309 of file base.hh.
Referenced by Cache::doTimingSupplyResponse(), NoncoherentCache::doWritebacksAtomic(), Cache::doWritebacksAtomic(), functionalAccess(), getPort(), NoncoherentCache::handleAtomicReqMiss(), Cache::handleAtomicReqMiss(), init(), Cache::recvAtomic(), Cache::recvTimingReq(), Cache::recvTimingSnoopResp(), schedMemSideSendEvent(), sendMSHRQueuePacket(), sendWriteQueuePacket(), and writebackVisitor().
|
protected |
The number of misses to trigger an exit event.
Definition at line 912 of file base.hh.
Referenced by incMissCount().
|
protected |
Miss status registers.
Definition at line 314 of file base.hh.
Referenced by access(), allocateMissBuffer(), functionalAccess(), getNextQueueEntry(), handleEvictions(), NoncoherentCache::handleTimingReqMiss(), Cache::handleTimingReqMiss(), inMissQueue(), markInService(), nextQueueReadyTime(), recvTimingResp(), Cache::recvTimingSnoopReq(), Cache::sendMSHRQueuePacket(), and sendMSHRQueuePacket().
|
protected |
Pointer to the MSHR that has no targets.
Definition at line 909 of file base.hh.
Referenced by handleTimingReqMiss(), and recvTimingResp().
|
protected |
The number of targets for each MSHR.
Definition at line 876 of file base.hh.
Referenced by handleTimingReqMiss(), and Cache::recvTimingSnoopReq().
|
protected |
Increasing order number assigned to each incoming request.
Definition at line 903 of file base.hh.
Referenced by allocateMissBuffer(), allocateWriteBuffer(), handleTimingReqMiss(), and Cache::recvTimingSnoopReq().
|
protected |
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent call.
Definition at line 365 of file base.hh.
Referenced by handleTimingReqHit(), handleTimingReqMiss(), and Cache::recvTimingReq().
|
protected |
To probe when a cache fill occurs.
Definition at line 335 of file base.hh.
Referenced by recvTimingResp(), and regProbePoints().
|
protected |
To probe when a cache hit occurs.
Definition at line 329 of file base.hh.
Referenced by recvTimingReq(), and regProbePoints().
|
protected |
To probe when a cache miss occurs.
Definition at line 332 of file base.hh.
Referenced by recvTimingReq(), and regProbePoints().
|
protected |
Definition at line 326 of file base.hh.
Referenced by getNextQueueEntry(), nextQueueReadyTime(), recvTimingReq(), and recvTimingResp().
|
protected |
The latency of sending reponse to its upper level cache/core on a linefill.
The responseLatency parameter captures this latency.
Definition at line 868 of file base.hh.
Referenced by handleUncacheableWriteResp(), NoncoherentCache::serviceMSHRTargets(), and Cache::serviceMSHRTargets().
|
protected |
Whether tags and data are accessed sequentially.
Definition at line 873 of file base.hh.
Referenced by calculateAccessLatency().
BaseCache::CacheStats BaseCache::stats |
Referenced by clearBlocked(), getNextQueueEntry(), handleEvictions(), Cache::handleTimingReqMiss(), handleTimingReqMiss(), incHitCount(), incMissCount(), invalidateBlock(), recvTimingResp(), NoncoherentCache::serviceMSHRTargets(), Cache::serviceMSHRTargets(), setBlocked(), updateCompressionData(), and writebackBlk().
System* BaseCache::system |
System we are currently operating in.
Definition at line 921 of file base.hh.
Referenced by getNextQueueEntry(), handleTimingReqMiss(), incHitCount(), incMissCount(), Prefetcher::Queued::insert(), recvTimingResp(), BaseCache::CacheStats::regStats(), BaseCache::CacheCmdStats::regStatsFromParent(), NoncoherentCache::serviceMSHRTargets(), and Cache::serviceMSHRTargets().
|
protected |
Tag and data Storage.
Definition at line 320 of file base.hh.
Referenced by Cache::access(), access(), allocateBlock(), functionalAccess(), getNextQueueEntry(), hasBeenPrefetched(), inCache(), invalidateBlock(), isDirty(), memInvalidate(), memWriteback(), Cache::recvAtomicSnoop(), Cache::recvTimingReq(), recvTimingResp(), Cache::recvTimingSnoopReq(), regenerateBlkAddr(), satisfyRequest(), Cache::sendMSHRQueuePacket(), and sendMSHRQueuePacket().
|
protected |
Temporary cache block for occasional transitory use.
We use the tempBlock to fill when allocation fails (e.g., when there is an outstanding request that accesses the victim block) or when we want to avoid allocation (e.g., exclusive caches)
Definition at line 359 of file base.hh.
Referenced by handleFill(), invalidateBlock(), recvAtomic(), recvTimingResp(), regenerateBlkAddr(), updateCompressionData(), and ~BaseCache().
|
protected |
Writebacks from the tempBlock, resulting on the response path in atomic mode, must happen after the call to recvAtomic has finished (for the right ordering of the packets).
We therefore need to hold on to the packets, and have a method and an event to send them.
Definition at line 635 of file base.hh.
Referenced by recvAtomic(), and writebackTempBlockAtomic().
|
protected |
The writeAllocator drive optimizations for streaming writes.
It first determines whether a WriteReq MSHR should be delayed, thus ensuring that we wait longer in cases when we are write coalescing and allowing all the bytes of the line to be written before the MSHR packet is sent downstream. This works in unison with the tracking in the MSHR to check if the entire line is written. The write mode also affects the behaviour on filling any whole-line writes. Normally the cache allocates the line when receiving the InvalidateResp, but after seeing enough consecutive lines we switch to using the tempBlock, and thus end up not allocating the line, and instead turning the whole-line write into a writeback straight away.
Definition at line 351 of file base.hh.
Referenced by coalesce(), Cache::handleAtomicReqMiss(), handleTimingReqMiss(), recvTimingResp(), and sendMSHRQueuePacket().
|
protected |
Determine if clean lines should be written back or not.
In cases where a downstream cache is mostly inclusive we likely want it to act as a victim cache also for lines that have not been modified. Hence, we cannot simply drop the line (or send a clean evict), but rather need to send the actual data.
Definition at line 626 of file base.hh.
Referenced by Cache::cleanEvictBlk(), Cache::doWritebacks(), NoncoherentCache::evictBlock(), Cache::evictBlock(), and writebackBlk().
|
protected |
An event to writeback the tempBlock after recvAtomic finishes.
To avoid other calls to recvAtomic getting in between, we create this event with a higher priority.
Definition at line 654 of file base.hh.
Referenced by recvAtomic().
|
protected |
Write/writeback buffer.
Definition at line 317 of file base.hh.
Referenced by access(), allocateWriteBuffer(), functionalAccess(), getNextQueueEntry(), handleFill(), markInService(), nextQueueReadyTime(), and Cache::recvTimingSnoopReq().