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