50 #ifndef __MEM_CACHE_BASE_HH__
51 #define __MEM_CACHE_BASE_HH__
62 #include "debug/Cache.hh"
63 #include "debug/CachePort.hh"
70 #include "params/BaseCache.hh"
123 DPRINTF(CachePort,
"Scheduling send event at %llu\n", time);
167 const std::string &_label);
246 virtual bool isDirty()
const = 0;
467 BaseCache(
const BaseCacheParams *
p,
unsigned blk_size);
545 uint8_t flag = 1 << cause;
564 uint8_t flag = 1 << cause;
598 exitSimLoop(
"A cache reached the maximum miss count");
610 #endif //__MEM_CACHE_BASE_HH__
Entry * findMatch(Addr blk_addr, bool is_secure) const
Find the first WriteQueueEntry that matches the provided address.
Stats::Formula demandMshrMissRate
The demand miss rate in the MSHRs.
virtual void regStats()
Register stats for this object.
bool forwardSnoops
Do we forward snoops from mem side port through to cpu side port?
BaseCache(const BaseCacheParams *p, unsigned blk_size)
Stats::Formula overallMisses
Number of misses for all accesses.
bool inService
True if the entry has been sent downstream.
virtual bool allocOnFill(MemCmd cmd) const =0
Determine if we should allocate on a fill or not.
Cycles is a wrapper class for representing cycle counts, i.e.
A Class for maintaining a list of pending and allocated memory requests.
bool isBlocked() const
Returns true if the cache is blocked for accesses.
Stats::Formula demandMissRate
The miss rate of all demand accesses.
const PortID InvalidPortID
WriteQueue writeBuffer
Write/writeback buffer.
MSHR * noTargetMSHR
Pointer to the MSHR that has no targets.
Stats::Formula demandMshrMisses
Demand misses that miss in the MSHRs.
const Cycles lookupLatency
The latency of tag lookup of a cache.
Stats::Scalar unusedPrefetches
The number of times a HW-prefetched block is evicted w/o reference.
Stats::Formula demandAvgMshrMissLatency
The average latency of a demand MSHR miss.
A write queue for all eviction packets, i.e.
Stats::Formula avgMshrMissLatency[MemCmd::NUM_MEM_CMDS]
The average latency of an MSHR miss, per command and thread.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
virtual BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID)
Get a slave port with a given name and index.
Addr getBlockAddr(unsigned int blk_size) const
The QueuedMasterPort combines two queues, a request queue and a snoop response queue, that both share the same port.
System * system
System we are currently operating in.
Stats::Formula demandHits
Number of hits for demand accesses.
const bool isReadOnly
Is this cache read only, for example the instruction cache, or table-walker cache.
CacheSlavePort * cpuSidePort
const AddrRangeList addrRanges
The address range to which the cache responds on the CPU side.
bool inRange(Addr addr) const
Determine if an address is in the ranges covered by this cache.
MSHR * allocateMissBuffer(PacketPtr pkt, Tick time, bool sched_send=true)
A vector of scalar stats.
A queued port is a port that has an infinite queue for outgoing packets and thus decouples the module...
const Cycles dataLatency
The latency of data access of a cache.
virtual void memWriteback()=0
Write back dirty blocks in the cache using functional accesses.
int cmdToIndex() const
Return the index of this command.
Stats::Formula accesses[MemCmd::NUM_MEM_CMDS]
The number of accesses per command and thread.
const Cycles fillLatency
The latency to fill a cache block.
void markInService(WriteQueueEntry *entry)
Mark the given entry as in service.
void schedSendEvent(Tick when)
Schedule a send event if we are not already waiting for a retry.
Declaration of a structure to manage MSHRs.
virtual bool inMissQueue(Addr addr, bool is_secure) const =0
Stats::Formula overallMshrMisses
Total number of misses that miss in the MSHRs.
A BaseSlavePort is a protocol-agnostic slave port, responsible only for the structural connection to ...
Declaration of Statistics objects.
Stats::Formula demandAccesses
The number of demand accesses.
This is a simple scalar statistic, like a counter.
Stats::Vector blocked_cycles
The total number of cycles blocked for each blocked cause.
Stats::Vector blocked_causes
The number of times this cache blocked for each blocked cause.
Stats::Vector hits[MemCmd::NUM_MEM_CMDS]
Number of hits per thread for each type of command.
Stats::Vector mshr_uncacheable_lat[MemCmd::NUM_MEM_CMDS]
Total cycle latency of each MSHR miss, per command and thread.
Stats::Formula overallAvgMshrUncacheableLatency
The average overall latency of an MSHR miss.
void markInService(WriteQueueEntry *entry)
const Cycles responseLatency
The latency of sending reponse to its upper level cache/core on a linefill.
Stats::Formula overallMissLatency
Total number of cycles spent waiting for all misses.
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
Stats::Formula avgMissLatency[MemCmd::NUM_MEM_CMDS]
The average miss latency per command and thread.
A template-policy based cache.
Declaration of the queued port.
Cycles blockedCycle
Stores time the cache blocked for statistics.
Stats::Formula demandAvgMissLatency
The average miss latency for demand misses.
EventWrapper< CacheSlavePort,&CacheSlavePort::processSendRetry > sendRetryEvent
Stats::Formula overallMshrUncacheable
Total number of misses that miss in the MSHRs.
A cache master port is used for the memory-side port of the cache, and in addition to the basic timin...
CacheSlavePort(const std::string &_name, BaseCache *_cache, const std::string &_label)
CacheMasterPort(const std::string &_name, BaseCache *_cache, ReqPacketQueue &_reqQueue, SnoopRespPacketQueue &_snoopRespQueue)
Stats::Formula demandMshrHits
Demand misses that hit in the MSHRs.
Stats::Formula overallAvgMissLatency
The average miss latency for all misses.
const AddrRangeList & getAddrRanges() const
Stats::Vector writebacks
Number of blocks written back per thread.
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.
Stats::Formula overallMshrHits
Total number of misses that hit in the MSHRs.
virtual void memInvalidate()=0
Invalidates all blocks in the cache.
uint64_t Tick
Tick count type.
void incMissCount(PacketPtr pkt)
Stats::Formula demandMisses
Number of misses for demand accesses.
CacheMasterPort * memSidePort
Stats::Formula missRate[MemCmd::NUM_MEM_CMDS]
The miss rate per command and thread.
Miss Status and handling Register.
void markInService(MSHR *mshr, bool pending_modified_resp)
Mark the given MSHR as in service.
const RequestPtr req
A pointer to the original request.
void allocateWriteBuffer(PacketPtr pkt, Tick time)
Stats::Vector missLatency[MemCmd::NUM_MEM_CMDS]
Total number of cycles per thread/command spent waiting for a miss.
Stats::Formula overallMshrMissLatency
Total cycle latency of overall MSHR misses.
virtual bool inCache(Addr addr, bool is_secure) const =0
void setBlocked()
Do not accept any new requests.
Stats::Formula overallMshrUncacheableLatency
Total cycle latency of overall MSHR misses.
uint8_t blocked
Bit vector of the blocking reasons for the access path.
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
void schedMemSideSendEvent(Tick time)
Schedule a send event for the memory-side port.
Stats::Vector mshr_misses[MemCmd::NUM_MEM_CMDS]
Number of misses that miss in the MSHRs, per command and thread.
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
const unsigned blkSize
Block size of this cache.
int64_t Counter
Statistics counter type.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
Stats::Vector mshr_hits[MemCmd::NUM_MEM_CMDS]
Number of misses that hit in the MSHRs per command and thread.
uint64_t order
Increasing order number assigned to each incoming request.
Stats::Formula avgMshrUncacheableLatency[MemCmd::NUM_MEM_CMDS]
The average latency of an MSHR miss, per command and thread.
Stats::Formula avg_blocked
The average number of cycles blocked for each blocked cause.
MasterID maxMasters()
Get the number of masters registered in the system.
MasterID masterId() const
Accesssor for the requestor id.
Stats::Formula mshrMissRate[MemCmd::NUM_MEM_CMDS]
The miss rate in the MSHRs pre command and thread.
Stats::Vector misses[MemCmd::NUM_MEM_CMDS]
Number of misses per thread for each type of command.
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 (...
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...
Stats::Vector mshr_miss_latency[MemCmd::NUM_MEM_CMDS]
Total cycle latency of each MSHR miss, per command and thread.
ReqPacketQueue & reqQueue
Packet queue used to store outgoing requests.
Declaration of the Packet class.
A cache slave port is used for the CPU-side port of the cache, and it is basically a simple timing po...
Stats::Formula overallAvgMshrMissLatency
The average overall latency of an MSHR miss.
void schedSendEvent(Tick time)
Schedule a send of a request packet (from the MSHR).
void setBlocked(BlockedCause cause)
Marks the access path of the cache as blocked for the given cause.
virtual bool isDirty() const =0
Determine if there are any dirty blocks in the cache.
MemCmd cmd
The command field of the packet.
virtual bool isSnooping() const
Memory-side port always snoops.
The MemObject class extends the ClockedObject with accessor functions to get its master and slave por...
A BaseMasterPort is a protocol-agnostic master port, responsible only for the structural connection t...
RespPacketQueue queue
A normal packet queue used to store responses.
Stats::Vector mshr_uncacheable[MemCmd::NUM_MEM_CMDS]
Number of misses that miss in the MSHRs, per command and thread.
BlockedCause
Reasons for caches to be blocked.
MSHRQueueIndex
Indexes to enumerate the MSHR queues.
unsigned getBlockSize() const
Query block size of a cache.
const int numTarget
The number of targets for each MSHR.
const Cycles forwardLatency
This is the forward latency of the cache.
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Stats::Formula overallMshrMissRate
The overall miss rate in the MSHRs.
Counter missCount
The number of misses to trigger an exit event.
Stats::Formula demandMissLatency
Total number of cycles spent waiting for demand misses.
Stats::Formula overallAccesses
The number of overall accesses.
Stats::Formula demandMshrMissLatency
Total cycle latency of demand MSHR misses.
WriteQueueEntry * allocate(Addr blk_addr, unsigned blk_size, PacketPtr pkt, Tick when_ready, Counter order)
Allocates a new WriteQueueEntry for the request and size.
Stats::Formula overallHits
Number of hit for all accesses.
virtual void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
void incHitCount(PacketPtr pkt)
void incAccessDepth() const
Increment/Get the depth at which this request is responded to.
Stats::Formula overallMissRate
The miss rate for all accesses.
void clearBlocked(BlockedCause cause)
Marks the cache as unblocked for the given cause.
MSHRQueue mshrQueue
Miss status registers.
void clearBlocked()
Return to normal operation and accept new requests.