50 #include "debug/Cache.hh"
51 #include "debug/Drain.hh"
63 const std::string &_label)
65 blocked(false), mustSendRetry(false), sendRetryEvent(this)
72 mshrQueue(
"MSHRs", p->mshrs, 0, p->demand_mshr_reserve),
73 writeBuffer(
"write buffer", p->write_buffers, p->mshrs),
87 addrRanges(p->addr_ranges.begin(), p->addr_ranges.end()),
104 DPRINTF(CachePort,
"Port is blocking new requests\n");
110 DPRINTF(CachePort,
"Port descheduled retry\n");
119 DPRINTF(CachePort,
"Port is accepting new requests\n");
123 owner.schedule(sendRetryEvent,
curTick() + 1);
130 DPRINTF(CachePort,
"Port is sending retry\n");
133 mustSendRetry =
false;
141 fatal(
"Cache ports on %s are not connected\n",
name());
149 if (if_name ==
"mem_side") {
159 if (if_name ==
"cpu_side") {
170 if (
r.contains(addr)) {
182 using namespace Stats;
187 const string &cstr = cmd.
toString();
191 .
name(
name() +
"." + cstr +
"_hits")
192 .desc(
"number of " + cstr +
" hits")
203 #define SUM_DEMAND(s) \
204 (s[MemCmd::ReadReq] + s[MemCmd::WriteReq] + s[MemCmd::WriteLineReq] + \
205 s[MemCmd::ReadExReq] + s[MemCmd::ReadCleanReq] + s[MemCmd::ReadSharedReq])
208 #define SUM_NON_DEMAND(s) \
209 (s[MemCmd::SoftPFReq] + s[MemCmd::HardPFReq])
213 .
desc(
"number of demand (read+write) hits")
223 .
desc(
"number of overall hits")
234 const string &cstr = cmd.
toString();
238 .
name(
name() +
"." + cstr +
"_misses")
239 .desc(
"number of " + cstr +
" misses")
249 .
desc(
"number of demand (read+write) misses")
259 .
desc(
"number of overall misses")
270 const string &cstr = cmd.
toString();
274 .
name(
name() +
"." + cstr +
"_miss_latency")
275 .desc(
"number of " + cstr +
" miss cycles")
284 .
name(
name() +
".demand_miss_latency")
285 .
desc(
"number of demand (read+write) miss cycles")
294 .
name(
name() +
".overall_miss_latency")
295 .
desc(
"number of overall miss cycles")
306 const string &cstr = cmd.
toString();
309 .
name(
name() +
"." + cstr +
"_accesses")
310 .
desc(
"number of " + cstr +
" accesses(hits+misses)")
322 .
desc(
"number of demand (read+write) accesses")
332 .
desc(
"number of overall (read+write) accesses")
343 const string &cstr = cmd.
toString();
346 .
name(
name() +
"." + cstr +
"_miss_rate")
347 .
desc(
"miss rate for " + cstr +
" accesses")
359 .
desc(
"miss rate for demand accesses")
368 .
name(
name() +
".overall_miss_rate")
369 .
desc(
"miss rate for overall accesses")
380 const string &cstr = cmd.
toString();
383 .
name(
name() +
"." + cstr +
"_avg_miss_latency")
384 .
desc(
"average " + cstr +
" miss latency")
396 .
name(
name() +
".demand_avg_miss_latency")
397 .
desc(
"average overall miss latency")
406 .
name(
name() +
".overall_avg_miss_latency")
407 .
desc(
"average overall miss latency")
418 .
desc(
"number of cycles access was blocked")
427 .
desc(
"number of cycles access was blocked")
433 .
name(
name() +
".avg_blocked_cycles")
434 .
desc(
"average number of cycles each access was blocked")
442 .
name(
name() +
".unused_prefetches")
443 .
desc(
"number of HardPF blocks evicted w/o reference")
450 .desc(
"number of writebacks")
461 const string &cstr = cmd.
toString();
465 .
name(
name() +
"." + cstr +
"_mshr_hits")
466 .desc(
"number of " + cstr +
" MSHR hits")
476 .
desc(
"number of demand (read+write) MSHR hits")
485 .
name(
name() +
".overall_mshr_hits")
486 .
desc(
"number of overall MSHR hits")
497 const string &cstr = cmd.
toString();
501 .
name(
name() +
"." + cstr +
"_mshr_misses")
502 .desc(
"number of " + cstr +
" MSHR misses")
511 .
name(
name() +
".demand_mshr_misses")
512 .
desc(
"number of demand (read+write) MSHR misses")
521 .
name(
name() +
".overall_mshr_misses")
522 .
desc(
"number of overall MSHR misses")
533 const string &cstr = cmd.
toString();
537 .
name(
name() +
"." + cstr +
"_mshr_miss_latency")
538 .desc(
"number of " + cstr +
" MSHR miss cycles")
547 .
name(
name() +
".demand_mshr_miss_latency")
548 .
desc(
"number of demand (read+write) MSHR miss cycles")
557 .
name(
name() +
".overall_mshr_miss_latency")
558 .
desc(
"number of overall MSHR miss cycles")
570 const string &cstr = cmd.
toString();
574 .
name(
name() +
"." + cstr +
"_mshr_uncacheable")
575 .desc(
"number of " + cstr +
" MSHR uncacheable")
584 .
name(
name() +
".overall_mshr_uncacheable_misses")
585 .
desc(
"number of overall MSHR uncacheable misses")
597 const string &cstr = cmd.
toString();
601 .
name(
name() +
"." + cstr +
"_mshr_uncacheable_latency")
602 .desc(
"number of " + cstr +
" MSHR uncacheable cycles")
612 .
name(
name() +
".overall_mshr_uncacheable_latency")
613 .
desc(
"number of overall MSHR uncacheable cycles")
627 const string &cstr = cmd.
toString();
629 mshrAccesses[access_idx]
630 .name(
name() +
"." + cstr +
"_mshr_accesses")
631 .desc(
"number of " + cstr +
" mshr accesses(hits+misses)")
634 mshrAccesses[access_idx] =
640 .
name(
name() +
".demand_mshr_accesses")
641 .
desc(
"number of demand (read+write) mshr accesses")
647 .
name(
name() +
".overall_mshr_accesses")
648 .
desc(
"number of overall (read+write) mshr accesses")
658 const string &cstr = cmd.
toString();
661 .
name(
name() +
"." + cstr +
"_mshr_miss_rate")
662 .
desc(
"mshr miss rate for " + cstr +
" accesses")
674 .
name(
name() +
".demand_mshr_miss_rate")
675 .
desc(
"mshr miss rate for demand accesses")
684 .
name(
name() +
".overall_mshr_miss_rate")
685 .
desc(
"mshr miss rate for overall accesses")
696 const string &cstr = cmd.
toString();
699 .
name(
name() +
"." + cstr +
"_avg_mshr_miss_latency")
700 .
desc(
"average " + cstr +
" mshr miss latency")
713 .
name(
name() +
".demand_avg_mshr_miss_latency")
714 .
desc(
"average overall mshr miss latency")
723 .
name(
name() +
".overall_avg_mshr_miss_latency")
724 .
desc(
"average overall mshr miss latency")
735 const string &cstr = cmd.
toString();
738 .
name(
name() +
"." + cstr +
"_avg_mshr_uncacheable_latency")
739 .
desc(
"average " + cstr +
" mshr uncacheable latency")
752 .
name(
name() +
".overall_avg_mshr_uncacheable_latency")
753 .
desc(
"average overall mshr uncacheable latency")
Miss Status and Handling Register (MSHR) declaration.
Stats::Formula demandMshrMissRate
The demand miss rate in the MSHRs.
MemObject & owner
A reference to the MemObject that owns this port.
virtual void regStats()
Register stats for this object.
bool forwardSnoops
Do we forward snoops from mem side port through to cpu side port?
Declares a basic cache interface BaseCache.
BaseCache(const BaseCacheParams *p, unsigned blk_size)
Stats::Formula overallMisses
Number of misses for all accesses.
Derived & subname(off_type index, const std::string &name)
Set the subfield name for the given index, and marks this stat to print at the end of simulation...
Stats::Formula demandMissRate
The miss rate of all demand accesses.
std::string getMasterName(MasterID master_id)
Get the name of an object for a given request id.
WriteQueue writeBuffer
Write/writeback buffer.
const FlagsType nonan
Don't print if this is NAN.
MSHR * noTargetMSHR
Pointer to the MSHR that has no targets.
#define SUM_NON_DEMAND(s)
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.
Stats::Formula avgMshrMissLatency[MemCmd::NUM_MEM_CMDS]
The average latency of an MSHR miss, per command and thread.
Declaration of a LRU tag store.
virtual BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID)
Get a slave port with a given name and index.
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.
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 BaseSlavePort & getSlavePort(const std::string &if_name, PortID idx=InvalidPortID)
Get a slave port with a given name and index.
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.
Stats::Formula overallMshrMisses
Total number of misses that miss in the MSHRs.
Derived & flags(Flags _flags)
Set the flags and marks this stat to print at the end of simulation.
A BaseSlavePort is a protocol-agnostic slave port, responsible only for the structural connection to ...
Stats::Formula demandAccesses
The number of demand accesses.
Derived & init(size_type size)
Set this vector to have the given size.
void deschedule(Event &event)
Stats::Vector blocked_cycles
The total number of cycles blocked for each blocked cause.
Declaration of a fully associative LRU tag store.
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.
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.
bool isSnooping() const
Find out if the peer master port is snooping or not.
Stats::Formula avgMissLatency[MemCmd::NUM_MEM_CMDS]
The average miss latency per command and thread.
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.
Tick curTick()
The current simulated tick.
CacheSlavePort(const std::string &_name, BaseCache *_cache, const std::string &_label)
Stats::Formula demandMshrHits
Demand misses that hit in the MSHRs.
Stats::Formula overallAvgMissLatency
The average miss latency for all misses.
Stats::Vector writebacks
Number of blocks written back per thread.
Stats::Formula overallMshrHits
Total number of misses that hit in the MSHRs.
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.
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.
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.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Stats::Vector mshr_misses[MemCmd::NUM_MEM_CMDS]
Number of misses that miss in the MSHRs, per command and thread.
const unsigned blkSize
Block size of this cache.
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.
const FlagsType total
Print the total.
Stats::Formula avg_blocked
The average number of cycles blocked for each blocked cause.
void sendRangeChange() const
Called by the owner to send a range change.
MasterID maxMasters()
Get the number of masters registered in the system.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
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.
Stats::Vector mshr_miss_latency[MemCmd::NUM_MEM_CMDS]
Total cycle latency of each MSHR miss, per command and thread.
virtual const std::string name() const
Stats::Formula overallAvgMshrMissLatency
The average overall latency of an MSHR miss.
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...
Stats::Vector mshr_uncacheable[MemCmd::NUM_MEM_CMDS]
Number of misses that miss in the MSHRs, per command and thread.
const std::string & toString() const
Return the string to a cmd given by idx.
const int numTarget
The number of targets for each MSHR.
const Cycles forwardLatency
This is the forward latency of the cache.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
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.
const FlagsType nozero
Don't print if this is zero.
Describes a cache based on template policies.
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.
Declaration of a random replacement tag store.
void regStats() override
Register statistics for this object.
virtual BaseMasterPort & getMasterPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a master port with a given name and index.
Stats::Formula overallMissRate
The miss rate for all accesses.
MSHRQueue mshrQueue
Miss status registers.
void clearBlocked()
Return to normal operation and accept new requests.