Go to the documentation of this file.
46 #ifndef __MEM_CACHE_BASE_HH__
47 #define __MEM_CACHE_BASE_HH__
57 #include "debug/Cache.hh"
58 #include "debug/CachePort.hh"
59 #include "enums/Clusivity.hh"
70 #include "params/WriteAllocator.hh"
84 struct BaseCacheParams;
133 DPRINTF(CachePort,
"Scheduling send event at %llu\n", time);
171 const std::string &
label) :
193 DPRINTF(CachePort,
"Waiting for snoop response to be "
233 const std::string &_label);
260 const std::string &_label);
304 const std::string &_label);
406 return clusivity == Enums::mostly_incl ||
433 const Cycles lookup_lat)
const;
444 const Cycles lookup_lat)
const;
480 Tick request_time) = 0;
494 Tick forward_time,
Tick request_time);
617 bool is_whole_line_write)
const = 0;
694 bool deferred_response =
false,
695 bool pending_downgrade =
false);
979 return *
cmd[
p->cmdToIndex()];
1077 BaseCache(
const BaseCacheParams *
p,
unsigned blk_size);
1080 void init()
override;
1162 uint8_t flag = 1 << cause;
1181 uint8_t flag = 1 << cause;
1224 pkt->
req->incAccessDepth();
1228 exitSimLoop(
"A cache reached the maximum miss count");
1419 #endif //__MEM_CACHE_BASE_HH__
Stats::Formula demandMissLatency
Total number of cycles spent waiting for demand misses.
void setBlocked(BlockedCause cause)
Marks the access path of the cache as blocked for the given cause.
ProbePointArg< PacketPtr > * ppFill
To probe when a cache fill occurs.
TempCacheBlk * tempBlock
Temporary cache block for occasional transitory use.
RespPacketQueue queue
A normal packet queue used to store responses.
void clearBlocked(BlockedCause cause)
Marks the cache as unblocked for the given cause.
WriteQueue writeBuffer
Write/writeback buffer.
void maintainClusivity(bool from_cache, CacheBlk *blk)
Maintain the clusivity of this cache by potentially invalidating a block.
SnoopRespPacketQueue _snoopRespQueue
const uint32_t coalesceLimit
Limits for when to switch between the different write modes.
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.
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...
virtual void sendDeferredPacket()
Override the normal sendDeferredPacket and do not only consider the transmit list (used for responses...
EventFunctionWrapper sendRetryEvent
virtual void functionalAccess(PacketPtr pkt, bool from_cpu_side)
Performs the access specified by the request.
Stats::Formula avgMissLatency
The average miss latency per command and thread.
Stats::Formula demandMshrMissLatency
Total cycle latency of demand MSHR misses.
Stats::Formula overallMshrUncacheableLatency
Total cycle latency of overall MSHR misses.
const bool sequentialAccess
Whether tags and data are accessed sequentially.
WriteAllocator(const WriteAllocatorParams *p)
Stats::Formula overallAvgMissLatency
The average miss latency for all misses.
CacheBlk * handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks, bool allocate)
Handle a fill operation caused by a received packet.
void schedMemSideSendEvent(Tick time)
Schedule a send event for the memory-side port.
virtual Tick recvAtomic(PacketPtr pkt) override
Receive an atomic request packet from the peer.
void cmpAndSwap(CacheBlk *blk, PacketPtr pkt)
Handle doing the Compare and Swap function for SPARC.
void clearBlocked()
Return to normal operation and accept new requests.
PacketPtr writebackBlk(CacheBlk *blk)
Create a writeback request for the given block.
A cache request port is used for the memory-side port of the cache, and in addition to the basic timi...
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
Stats::Formula overallMissLatency
Total number of cycles spent waiting for all misses.
const PortID InvalidPortID
System * system
System we are currently operating in.
virtual void serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt, CacheBlk *blk)=0
Service non-deferred MSHR targets using the received response.
const uint32_t delayThreshold
The number of times the allocator will delay an WriteReq MSHR.
virtual void recvTimingSnoopResp(PacketPtr pkt)=0
Handle a snoop response.
virtual bool recvTimingReq(PacketPtr pkt) override
Receive a timing request from the peer.
Tick nextQueueReadyTime() const
Find next request ready time from among possible sources.
MSHRQueueIndex
Indexes to enumerate the MSHR queues.
const unsigned blkSize
Block size of this cache.
ProbePointArg generates a point for the class of Arg.
MSHR * noTargetMSHR
Pointer to the MSHR that has no targets.
Stats::Vector missLatency
Total number of cycles per thread/command spent waiting for a miss.
bool hasBeenPrefetched(Addr addr, bool is_secure) const
uint64_t Tick
Tick count type.
Stats::Formula overallMshrMisses
Total number of misses that miss in the MSHRs.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
QueueEntry * getNextQueueEntry()
Return the next queue entry to service, either a pending miss from the MSHR queue,...
Counter missCount
The number of misses to trigger an exit event.
Override the default behaviour of sendDeferredPacket to enable the memory-side cache port to also sen...
void schedSendEvent(Tick when)
Schedule a send event if we are not already waiting for a retry.
RequestPtr req
A pointer to the original request.
EventFunctionWrapper writebackTempBlockAtomicEvent
An event to writeback the tempBlock after recvAtomic finishes.
SnoopRespPacketQueue & snoopRespQueue
virtual void handleTimingReqHit(PacketPtr pkt, CacheBlk *blk, Tick request_time)
virtual void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
Addr nextAddr
Address to match writes against to detect streams.
Stats::Formula overallMshrUncacheable
Total number of misses that miss in the MSHRs.
Cycles blockedCycle
Stores time the cache blocked for statistics.
Base cache compressor interface.
CacheBlk * allocateBlock(const PacketPtr pkt, PacketList &writebacks)
Allocate a new block and perform any necessary writebacks.
const AddrRangeList addrRanges
The address range to which the cache responds on the CPU side.
const Enums::Clusivity clusivity
Clusivity with respect to the upstream cache, determining if we fill into both this cache and the cac...
A vector of scalar stats.
WriteQueueEntry * allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt, Tick when_ready, Counter order)
Allocates a new WriteQueueEntry for the request and size.
void regStatsFromParent()
Callback to register stats from parent CacheStats::regStats().
const int numTarget
The number of targets for each MSHR.
MemSidePort(const std::string &_name, BaseCache *_cache, const std::string &_label)
void invalidateVisitor(CacheBlk &blk)
Cache block visitor that invalidates all blocks in the cache.
const Cycles forwardLatency
This is the forward latency of the cache.
bool coalesce() const
Checks if the cache is coalescing writes.
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
ProbePointArg< PacketPtr > * ppMiss
To probe when a cache miss occurs.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Stats::Scalar unusedPrefetches
The number of times a HW-prefetched block is evicted w/o reference.
Stats::Scalar replacements
Number of replacements of valid blocks.
bool coalesce() const
Should writes be coalesced? This is true if the mode is set to NO_ALLOCATE.
CacheRequestPort(const std::string &_name, BaseCache *_cache, ReqPacketQueue &_reqQueue, SnoopRespPacketQueue &_snoopRespQueue)
void setBlocked()
Do not accept any new requests.
This is a simple scalar statistic, like a counter.
Stats::Formula demandHits
Number of hits for demand accesses.
int64_t Counter
Statistics counter type.
Prefetcher::Base * prefetcher
Prefetcher.
Stats::Vector writebacks
Number of blocks written back per thread.
Stats::Formula overallMshrHits
Total number of misses that hit in the MSHRs.
void incMissCount(PacketPtr pkt)
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void allocateWriteBuffer(PacketPtr pkt, Tick time)
MSHRQueue mshrQueue
Miss status registers.
CacheResponsePort(const std::string &_name, BaseCache *_cache, const std::string &_label)
Addr regenerateBlkAddr(CacheBlk *blk)
Regenerate block address using tags.
Stats::Formula overallAvgMshrMissLatency
The average overall latency of an MSHR miss.
The QueuedRequestPort combines two queues, a request queue and a snoop response queue,...
bool delay(Addr blk_addr)
Access whether we need to delay the current write.
bool allocOnFill(MemCmd cmd) const
Determine whether we should allocate on a fill or not.
Stats::Formula overallHits
Number of hit for all accesses.
BaseCache::CacheStats stats
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...
Addr getBlockAddr(unsigned int blk_size) const
uint32_t byteCount
Bytes written contiguously.
uint8_t blocked
Bit vector of the blocking reasons for the access path.
Stats::Formula overallAccesses
The number of overall accesses.
void invalidateBlock(CacheBlk *blk)
Invalidate a cache block.
std::unordered_map< Addr, Counter > delayCtr
Keep track of the number of times the allocator has delayed an WriteReq MSHR.
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 recomp...
void serialize(CheckpointOut &cp) const override
Serialize the state of the caches.
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Stats::Vector mshr_uncacheable_lat
Total cycle latency of each MSHR miss, per command and thread.
void handleUncacheableWriteResp(PacketPtr pkt)
Handling the special case of uncacheable write responses to make recvTimingResp less cluttered.
Stats::Vector blocked_causes
The number of times this cache blocked for each blocked cause.
Ports are used to interface objects to each other.
virtual void recvTimingReq(PacketPtr pkt)
Performs the access specified by the request.
Stats::Vector misses
Number of misses per thread for each type of command.
CacheCmdStats(BaseCache &c, const std::string &name)
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
virtual Cycles handleAtomicReqMiss(PacketPtr pkt, CacheBlk *&blk, PacketList &writebacks)=0
Handle a request in atomic mode that missed in this cache.
bool inMissQueue(Addr addr, bool is_secure) const
const Cycles fillLatency
The latency to fill a cache block.
bool forwardSnoops
Do we forward snoops from mem side port through to cpu side port?
void regProbePoints() override
Registers probes.
BaseCache(const BaseCacheParams *p, unsigned blk_size)
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
void exitSimLoop(const std::string &message, int exit_code, Tick when, Tick repeat, bool serialize)
Schedule an event to exit the simulation loop (returning to Python) at the end of the current cycle (...
virtual Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
PacketPtr writecleanBlk(CacheBlk *blk, Request::Flags dest, PacketId id)
Create a writeclean request for the given block.
virtual bool access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat, PacketList &writebacks)
Does all the processing necessary to perform the provided request.
const bool isReadOnly
Is this cache read only, for example the instruction cache, or table-walker cache.
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
virtual bool sendMSHRQueuePacket(MSHR *mshr)
Take an MSHR, turn it into a suitable downstream packet, and send it out.
bool isBlocked() const
Returns true if the cache is blocked for accesses.
unsigned getBlockSize() const
Query block size of a cache.
virtual void doWritebacksAtomic(PacketList &writebacks)=0
Send writebacks down the memory hierarchy in atomic mode.
Entry * findMatch(Addr blk_addr, bool is_secure, bool ignore_uncacheable=true) const
Find the first entry that matches the provided address.
Stats::Formula overallMissRate
The miss rate for all accesses.
void writebackVisitor(CacheBlk &blk)
Cache block visitor that writes back dirty cache blocks using functional writes.
virtual AddrRangeList getAddrRanges() const override
Get a list of the non-overlapping address ranges the owner is responsible for.
const Cycles lookupLatency
The latency of tag lookup of a cache.
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Stats::Formula avg_blocked
The average number of cycles blocked for each blocked cause.
MSHR * allocateMissBuffer(PacketPtr pkt, Tick time, bool sched_send=true)
Stats::Formula missRate
The miss rate per command and thread.
Cycles calculateTagOnlyLatency(const uint32_t delay, const Cycles lookup_lat) const
Calculate latency of accesses that only touch the tag array.
Stats::Formula overallMshrMissRate
The overall miss rate in the MSHRs.
Stats::Formula avgMshrMissLatency
The average latency of an MSHR miss, per command and thread.
bool checkConflictingSnoop(const PacketPtr pkt)
Check if there is a conflicting snoop response about to be send out, and if so simply stall any reque...
void markInService(WriteQueueEntry *entry)
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
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.
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 b...
const AddrRangeList & getAddrRanges() const
bool wasPrefetched() const
Check if this block was the result of a hardware prefetch, yet to be touched.
Stats::Vector blocked_cycles
The total number of cycles blocked for each blocked cause.
MSHR * allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt, Tick when_ready, Counter order, bool alloc_on_fill)
Allocates a new MSHR for the request and size.
CacheReqPacketQueue(BaseCache &cache, RequestPort &port, SnoopRespPacketQueue &snoop_resp_queue, const std::string &label)
Compressor::Base * compressor
Compression method being used.
virtual void doWritebacks(PacketList &writebacks, Tick forward_time)=0
Insert writebacks into the write buffer.
Stats::Vector hits
Number of hits per thread for each type of command.
A write queue for all eviction packets, i.e.
const bool writebackClean
Determine if clean lines should be written back or not.
virtual const std::string name() const
MemCmd cmd
The command field of the packet.
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
BaseTags * tags
Tag and data Storage.
bool inService
True if the entry has been sent downstream.
virtual M5_NODISCARD PacketPtr evictBlock(CacheBlk *blk)=0
Evict a cache block.
Stats::Vector mshr_misses
Number of misses that miss in the MSHRs, per command and thread.
Stats::Formula demandAvgMissLatency
The average miss latency for demand misses.
Stats::Formula demandMshrHits
Demand misses that hit in the MSHRs.
bool sendWriteQueuePacket(WriteQueueEntry *wq_entry)
Similar to sendMSHR, but for a write-queue entry instead.
void resetDelay(Addr blk_addr)
Clear delay counter for the input block.
Stats::Formula demandMshrMisses
Demand misses that miss in the MSHRs.
RequestorID maxRequestors()
Get the number of requestors registered in the system.
Stats::Formula demandMissRate
The miss rate of all demand accesses.
Stats::Scalar dataExpansions
Number of data expansions.
virtual void handleTimingReqMiss(PacketPtr pkt, CacheBlk *blk, Tick forward_time, Tick request_time)=0
virtual bool recvTimingSnoopResp(PacketPtr pkt) override
Receive a timing snoop response from the peer.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
WriteAllocator *const writeAllocator
The writeAllocator drive optimizations for streaming writes.
Stats::Formula overallMisses
Number of misses for all accesses.
void reset()
Reset the write allocator state, meaning that it allocates for writes and has not recorded any inform...
Stats::Formula avgMshrUncacheableLatency
The average latency of an MSHR miss, per command and thread.
Stats::Formula demandMisses
Number of misses for demand accesses.
bool allocate() const
Should writes allocate?
Stats::Formula overallMshrMissLatency
Total cycle latency of overall MSHR misses.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
const Cycles dataLatency
The latency of data access of a cache.
Cycles is a wrapper class for representing cycle counts, i.e.
virtual bool isSnooping() const
Memory-side port always snoops.
bool handleEvictions(std::vector< CacheBlk * > &evict_blks, PacketList &writebacks)
Try to evict the given blocks.
Stats::Vector mshr_miss_latency
Total cycle latency of each MSHR miss, per command and thread.
Stats::Formula mshrMissRate
The miss rate in the MSHRs pre command and thread.
void markInService(WriteQueueEntry *entry)
Mark the given entry as in service.
bool isDirty() const
Determine if there are any dirty blocks in the cache.
std::ostream CheckpointOut
ReqPacketQueue & reqQueue
Packet queue used to store outgoing requests.
std::vector< std::unique_ptr< CacheCmdStats > > cmd
Per-command statistics.
A queue entry base class, to be used by both the MSHRs and write-queue entries.
const std::string label
Label to use for print request packets label stack.
Stats::Vector mshr_uncacheable
Number of misses that miss in the MSHRs, per command and thread.
Tick deferredPacketReadyTime() const
Get the next packet ready time.
void writebackTempBlockAtomic()
Send the outstanding tempBlock writeback.
void updateMode(Addr write_addr, unsigned write_size, Addr blk_addr)
Update the write mode based on the current write packet.
bool checkConflict(const PacketPtr pkt, const int blk_size) const
Check if a packet corresponding to the same address exists in the queue.
Stats::Vector mshr_hits
Number of misses that hit in the MSHRs per command and thread.
virtual Tick recvAtomicSnoop(PacketPtr pkt)=0
Snoop for the provided request in the cache and return the estimated time taken.
const Cycles responseLatency
The latency of sending reponse to its upper level cache/core on a linefill.
The CPU-side port extends the base cache response port with access functions for functional,...
BlockedCause
Reasons for caches to be blocked.
virtual void memWriteback() override
Write back dirty blocks in the cache using functional accesses.
void schedSendEvent(Tick time)
Schedule a send of a request packet (from the MSHR).
void incHitCount(PacketPtr pkt)
virtual void recvTimingResp(PacketPtr pkt)
Handles a response (cache line fill/write ack) from the bus.
Special instance of CacheBlk for use with tempBlk that deals with its block address regeneration.
WriteMode
The current mode for write coalescing and allocation, either normal operation (ALLOCATE),...
A coherent cache that can be arranged in flexible topologies.
virtual bool tryTiming(PacketPtr pkt) override
Availability request from the peer.
virtual void recvTimingSnoopReq(PacketPtr pkt)=0
Snoops bus transactions to maintain coherence.
virtual Tick recvAtomic(PacketPtr pkt)
Performs the access specified by the request.
Stats::Formula accesses
The number of accesses per command and thread.
bool inCache(Addr addr, bool is_secure) const
const uint32_t noAllocateLimit
void regStats() override
Callback to set stat parameters.
Stats::Formula demandAccesses
The number of demand accesses.
A Class for maintaining a list of pending and allocated memory requests.
PacketPtr tempBlockWriteback
Writebacks from the tempBlock, resulting on the response path in atomic mode, must happen after the c...
Stats::Formula overallAvgMshrUncacheableLatency
The average overall latency of an MSHR miss.
CacheCmdStats & cmdStats(const PacketPtr p)
virtual void memInvalidate() override
Invalidates all blocks in the cache.
CpuSidePort(const std::string &_name, BaseCache *_cache, const std::string &_label)
bool inRange(Addr addr) const
Determine if an address is in the ranges covered by this cache.
virtual void recvFunctional(PacketPtr pkt) override
Receive a functional request packet from the peer.
ProbePointArg< PacketPtr > * ppHit
To probe when a cache hit occurs.
void markInService(MSHR *mshr, bool pending_modified_resp)
Mark the given MSHR as in service.
Stats::Formula demandMshrMissRate
The demand miss rate in the MSHRs.
virtual void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
CacheReqPacketQueue _reqQueue
The cache-specific queue.
The write allocator inspects write packets and detects streaming patterns.
A cache response port is used for the CPU-side port of the cache, and it is basically a simple timing...
The memory-side port extends the base cache request port with access functions for functional,...
Miss Status and handling Register.
uint64_t order
Increasing order number assigned to each incoming request.
Stats::Formula demandAvgMshrMissLatency
The average latency of a demand MSHR miss.
Abstract superclass for simulation objects.
Generated on Wed Sep 30 2020 14:02:07 for gem5 by doxygen 1.8.17