Go to the documentation of this file.
50 #include "debug/Cache.hh"
51 #include "debug/CacheComp.hh"
52 #include "debug/CachePort.hh"
53 #include "debug/CacheRepl.hh"
54 #include "debug/CacheVerbose.hh"
61 #include "params/BaseCache.hh"
62 #include "params/WriteAllocator.hh"
67 const std::string &_label)
69 queue(*_cache, *this, true, _label),
70 blocked(false), mustSendRetry(false),
79 mshrQueue(
"MSHRs",
p.mshrs, 0,
p.demand_mshr_reserve),
91 lookupLatency(
p.tag_latency),
92 dataLatency(
p.data_latency),
93 forwardLatency(
p.tag_latency),
94 fillLatency(
p.data_latency),
95 responseLatency(
p.response_latency),
96 sequentialAccess(
p.sequential_access),
97 numTarget(
p.tgts_per_mshr),
99 clusivity(
p.clusivity),
100 isReadOnly(
p.is_read_only),
101 replaceExpansions(
p.replace_expansions),
102 moveContractions(
p.move_contractions),
105 noTargetMSHR(
nullptr),
106 missCount(
p.max_miss_count),
107 addrRanges(
p.addr_ranges.begin(),
p.addr_ranges.end()),
124 prefetcher->setCache(
this);
127 "The tags of compressed cache %s must derive from CompressedTags",
130 "Compressed cache %s does not have a compression algorithm",
name());
132 compressor->setCache(
this);
144 DPRINTF(CachePort,
"Port is blocking new requests\n");
150 DPRINTF(CachePort,
"Port descheduled retry\n");
159 DPRINTF(CachePort,
"Port is accepting new requests\n");
163 owner.schedule(sendRetryEvent,
curTick() + 1);
170 DPRINTF(CachePort,
"Port is sending retry\n");
173 mustSendRetry =
false;
191 fatal(
"Cache ports on %s are not connected\n",
name());
199 if (if_name ==
"mem_side") {
201 }
else if (if_name ==
"cpu_side") {
212 if (
r.contains(
addr)) {
236 DPRINTF(
Cache,
"%s satisfied %s, no response needed\n", __func__,
249 Tick forward_time,
Tick request_time)
252 pkt && pkt->
isWrite() && !pkt->
req->isUncacheable()) {
332 pkt->
req->isCacheMaintenance());
352 bool satisfied =
false;
357 satisfied =
access(pkt, blk, lat, writebacks);
419 "%s saw a non-zero packet delay\n",
name());
421 const bool is_error = pkt->
isError();
424 DPRINTF(
Cache,
"%s: Cache received %s with error\n", __func__,
434 assert(pkt->
req->isUncacheable());
453 if (pkt->
req->isUncacheable()) {
475 if (is_fill && !is_error) {
476 DPRINTF(
Cache,
"Block for addr %#llx being updated in Cache\n",
481 blk =
handleFill(pkt, blk, writebacks, allocate);
482 assert(blk !=
nullptr);
499 !pkt->
req->isCacheInvalidate()) {
545 DPRINTF(CacheVerbose,
"%s: Leaving with %s\n", __func__, pkt->
print());
563 bool satisfied =
access(pkt, blk, lat, writebacks);
570 DPRINTF(CacheVerbose,
"%s: packet %s found block: %s\n",
573 writebacks.push_back(wb_pkt);
580 assert(writebacks.empty());
648 bool have_data = blk && blk->
isValid()
658 bool done = have_dirty ||
664 DPRINTF(CacheVerbose,
"%s: %s %s%s%s\n", __func__, pkt->
print(),
665 (blk && blk->
isValid()) ?
"valid " :
"",
666 have_data ?
"data " :
"", done ?
"done " :
"");
717 uint64_t overwrite_val;
719 uint64_t condition_val64;
720 uint32_t condition_val32;
725 assert(
sizeof(uint64_t) >= pkt->
getSize());
734 overwrite_mem =
true;
737 pkt->
writeData((uint8_t *)&overwrite_val);
740 if (pkt->
req->isCondSwap()) {
741 if (pkt->
getSize() ==
sizeof(uint64_t)) {
742 condition_val64 = pkt->
req->getExtraData();
743 overwrite_mem = !std::memcmp(&condition_val64, blk_data,
745 }
else if (pkt->
getSize() ==
sizeof(uint32_t)) {
746 condition_val32 = (uint32_t)pkt->
req->getExtraData();
747 overwrite_mem = !std::memcmp(&condition_val32, blk_data,
750 panic(
"Invalid size for conditional read/write\n");
754 std::memcpy(blk_data, &overwrite_val, pkt->
getSize());
780 if (conflict_mshr && conflict_mshr->
order < wq_entry->
order) {
782 return conflict_mshr;
789 }
else if (miss_mshr) {
805 return conflict_mshr;
815 assert(!miss_mshr && !wq_entry);
847 bool replacement =
false;
848 for (
const auto& blk : evict_blks) {
849 if (blk->isValid()) {
870 for (
auto& blk : evict_blks) {
871 if (blk->isValid()) {
893 const auto comp_data =
895 std::size_t compression_size = comp_data->getSizeBits();
899 M5_VAR_USED
const std::size_t prev_size = compression_blk->
getSizeBits();
905 bool is_data_expansion =
false;
906 bool is_data_contraction =
false;
909 std::string op_name =
"";
911 op_name =
"expansion";
912 is_data_expansion =
true;
915 op_name =
"contraction";
916 is_data_contraction =
true;
923 if (is_data_expansion || is_data_contraction) {
925 bool victim_itself =
false;
929 blk->
isSecure(), compression_size, evict_blks);
939 victim_itself =
true;
940 auto it = std::find_if(evict_blks.begin(), evict_blks.end(),
941 [&blk](
CacheBlk* evict_blk){ return evict_blk == blk; });
942 evict_blks.erase(it);
946 DPRINTF(CacheRepl,
"Data %s replacement victim: %s\n",
947 op_name, victim->
print());
953 for (
auto& sub_blk : superblock->
blks) {
954 if (sub_blk->isValid() && (blk != sub_blk)) {
955 evict_blks.push_back(sub_blk);
965 DPRINTF(CacheComp,
"Data %s: [%s] from %d to %d bits\n",
966 op_name, blk->
print(), prev_size, compression_size);
978 if (is_data_expansion) {
980 }
else if (is_data_contraction) {
1053 DPRINTF(CacheVerbose,
"%s for %s (write)\n", __func__, pkt->
print());
1054 }
else if (pkt->
isRead()) {
1078 DPRINTF(CacheVerbose,
"%s for %s (invalidation)\n", __func__,
1090 const Cycles lookup_lat)
const
1099 const Cycles lookup_lat)
const
1103 if (blk !=
nullptr) {
1117 if (when_ready >
tick &&
1139 "Should never see a write in a read-only cache %s\n",
1147 blk ?
"hit " + blk->
print() :
"miss");
1149 if (pkt->
req->isCacheMaintenance()) {
1222 DPRINTF(
Cache,
"Clean writeback %#llx to block with MSHR, "
1223 "dropping\n", pkt->
getAddr());
1233 const bool has_old_data = blk && blk->
isValid();
1305 const bool has_old_data = blk && blk->
isValid();
1393 pkt->
req->setExtraData(0);
1403 if (from_cache && blk && blk->
isValid() &&
1419 const bool has_old_data = blk && blk->
isValid();
1421 const std::string old_state = blk ? blk->
print() :
"";
1443 is_secure ?
"s" :
"ns");
1453 assert(blk->
isSecure() == is_secure);
1486 "in read-only cache %s\n",
name());
1491 DPRINTF(
Cache,
"Block addr %#llx (%s) moving from %s to %s\n",
1492 addr, is_secure ?
"s" :
"ns", old_state, blk->
print());
1517 const bool is_secure = pkt->
isSecure();
1522 std::size_t blk_size_bits =
blkSize*8;
1533 pkt->
getConstPtr<uint64_t>(), compression_lat, decompression_lat);
1534 blk_size_bits = comp_data->getSizeBits();
1547 DPRINTF(CacheRepl,
"Replacement victim: %s\n", victim->
print());
1592 writebacks.push_back(pkt);
1600 "Writeback from read-only cache");
1601 assert(blk && blk->
isValid() &&
1618 DPRINTF(
Cache,
"Create Writeback %s writable: %d, dirty: %d\n",
1660 req->setFlags(dest);
1723 RequestPtr request = std::make_shared<Request>(
1744 warn_once(
"Invalidating dirty cache lines. " \
1745 "Expect things to break.\n");
1762 nextReady = std::min(nextReady,
1791 DPRINTF(CacheVerbose,
"Delaying pkt %s %llu ticks to allow "
1792 "for write coalescing\n", tgt_pkt->
print(), delay);
1816 pkt =
new Packet(tgt_pkt,
false,
true);
1851 bool pending_modified_resp = !pkt->
hasSharers() &&
1860 DPRINTF(CacheVerbose,
"%s: packet %s found block: %s\n",
1865 writebacks.push_back(wb_pkt);
1903 warn(
"*** The cache still contains dirty data. ***\n");
1904 warn(
" Make sure to drain the system using the correct flags.\n");
1905 warn(
" This checkpoint will not restore correctly " \
1906 "and dirty data in the cache will be lost!\n");
1913 bool bad_checkpoint(dirty);
1920 bool bad_checkpoint;
1922 if (bad_checkpoint) {
1923 fatal(
"Restoring from checkpoints with dirty caches is not "
1924 "supported in the classic memory system. Please remove any "
1925 "caches or drain them properly before taking checkpoints.\n");
1931 const std::string &
name)
1936 (
"number of " +
name +
" miss ticks").c_str()),
1938 (
"number of " +
name +
" accesses(hits+misses)").c_str()),
1940 (
"miss rate for " +
name +
" accesses").c_str()),
1943 (
"average " +
name +
" miss latency").c_str()),
1945 (
"number of " +
name +
" MSHR hits").c_str()),
1947 (
"number of " +
name +
" MSHR misses").c_str()),
1949 (
"number of " +
name +
" MSHR uncacheable").c_str()),
1951 (
"number of " +
name +
" MSHR miss ticks").c_str()),
1953 (
"number of " +
name +
" MSHR uncacheable ticks").c_str()),
1955 (
"mshr miss rate for " +
name +
" accesses").c_str()),
1958 (
"average " +
name +
" mshr miss latency").c_str()),
1959 ADD_STAT(avgMshrUncacheableLatency,
1961 (
"average " +
name +
" mshr uncacheable latency").c_str())
1968 using namespace Stats;
1975 .init(max_requestors)
1978 for (
int i = 0;
i < max_requestors;
i++) {
1984 .init(max_requestors)
1987 for (
int i = 0;
i < max_requestors;
i++) {
1993 .init(max_requestors)
1996 for (
int i = 0;
i < max_requestors;
i++) {
2002 accesses = hits + misses;
2003 for (
int i = 0;
i < max_requestors;
i++) {
2009 missRate = misses / accesses;
2010 for (
int i = 0;
i < max_requestors;
i++) {
2016 avgMissLatency = missLatency / misses;
2017 for (
int i = 0;
i < max_requestors;
i++) {
2024 .init(max_requestors)
2027 for (
int i = 0;
i < max_requestors;
i++) {
2033 .init(max_requestors)
2036 for (
int i = 0;
i < max_requestors;
i++) {
2042 .init(max_requestors)
2045 for (
int i = 0;
i < max_requestors;
i++) {
2051 .init(max_requestors)
2054 for (
int i = 0;
i < max_requestors;
i++) {
2059 mshrUncacheableLatency
2060 .init(max_requestors)
2063 for (
int i = 0;
i < max_requestors;
i++) {
2069 mshrMissRate = mshrMisses / accesses;
2071 for (
int i = 0;
i < max_requestors;
i++) {
2077 avgMshrMissLatency = mshrMissLatency / mshrMisses;
2078 for (
int i = 0;
i < max_requestors;
i++) {
2084 avgMshrUncacheableLatency = mshrUncacheableLatency / mshrUncacheable;
2085 for (
int i = 0;
i < max_requestors;
i++) {
2098 "number of demand (read+write) miss ticks"),
2101 "number of demand (read+write) accesses"),
2103 "number of overall (read+write) accesses"),
2108 "average overall miss latency"),
2111 "average overall miss latency"),
2115 "average number of cycles each access was blocked"),
2117 "number of HardPF blocks evicted w/o reference"),
2120 "number of demand (read+write) MSHR hits"),
2123 "number of demand (read+write) MSHR misses"),
2126 "number of overall MSHR uncacheable misses"),
2128 "number of demand (read+write) MSHR miss ticks"),
2130 "number of overall MSHR miss ticks"),
2132 "number of overall MSHR uncacheable ticks"),
2134 "mshr miss ratio for demand accesses"),
2136 "mshr miss ratio for overall accesses"),
2139 "average overall mshr miss latency"),
2140 ADD_STAT(overallAvgMshrMissLatency,
2142 "average overall mshr miss latency"),
2143 ADD_STAT(overallAvgMshrUncacheableLatency,
2145 "average overall mshr uncacheable latency"),
2149 cmd(
MemCmd::NUM_MEM_CMDS)
2158 using namespace Stats;
2165 for (
auto &cs : cmd)
2166 cs->regStatsFromParent();
2171 #define SUM_DEMAND(s) \
2172 (cmd[MemCmd::ReadReq]->s + cmd[MemCmd::WriteReq]->s + \
2173 cmd[MemCmd::WriteLineReq]->s + cmd[MemCmd::ReadExReq]->s + \
2174 cmd[MemCmd::ReadCleanReq]->s + cmd[MemCmd::ReadSharedReq]->s)
2177 #define SUM_NON_DEMAND(s) \
2178 (cmd[MemCmd::SoftPFReq]->s + cmd[MemCmd::HardPFReq]->s + \
2179 cmd[MemCmd::SoftPFExReq]->s)
2183 for (
int i = 0;
i < max_requestors;
i++) {
2189 for (
int i = 0;
i < max_requestors;
i++) {
2195 for (
int i = 0;
i < max_requestors;
i++) {
2201 for (
int i = 0;
i < max_requestors;
i++) {
2207 for (
int i = 0;
i < max_requestors;
i++) {
2212 overallMissLatency = demandMissLatency +
SUM_NON_DEMAND(missLatency);
2213 for (
int i = 0;
i < max_requestors;
i++) {
2218 demandAccesses = demandHits + demandMisses;
2219 for (
int i = 0;
i < max_requestors;
i++) {
2224 overallAccesses = overallHits + overallMisses;
2225 for (
int i = 0;
i < max_requestors;
i++) {
2230 demandMissRate = demandMisses / demandAccesses;
2231 for (
int i = 0;
i < max_requestors;
i++) {
2236 overallMissRate = overallMisses / overallAccesses;
2237 for (
int i = 0;
i < max_requestors;
i++) {
2242 demandAvgMissLatency = demandMissLatency / demandMisses;
2243 for (
int i = 0;
i < max_requestors;
i++) {
2248 overallAvgMissLatency = overallMissLatency / overallMisses;
2249 for (
int i = 0;
i < max_requestors;
i++) {
2270 avgBlocked = blockedCycles / blockedCauses;
2272 unusedPrefetches.flags(
nozero);
2275 .init(max_requestors)
2278 for (
int i = 0;
i < max_requestors;
i++) {
2284 for (
int i = 0;
i < max_requestors;
i++) {
2290 for (
int i = 0;
i < max_requestors;
i++) {
2296 for (
int i = 0;
i < max_requestors;
i++) {
2301 overallMshrMisses = demandMshrMisses +
SUM_NON_DEMAND(mshrMisses);
2302 for (
int i = 0;
i < max_requestors;
i++) {
2307 demandMshrMissLatency =
SUM_DEMAND(mshrMissLatency);
2308 for (
int i = 0;
i < max_requestors;
i++) {
2313 overallMshrMissLatency =
2315 for (
int i = 0;
i < max_requestors;
i++) {
2320 overallMshrUncacheable =
2322 for (
int i = 0;
i < max_requestors;
i++) {
2328 overallMshrUncacheableLatency =
2331 for (
int i = 0;
i < max_requestors;
i++) {
2336 demandMshrMissRate = demandMshrMisses / demandAccesses;
2337 for (
int i = 0;
i < max_requestors;
i++) {
2342 overallMshrMissRate = overallMshrMisses / overallAccesses;
2343 for (
int i = 0;
i < max_requestors;
i++) {
2348 demandAvgMshrMissLatency = demandMshrMissLatency / demandMshrMisses;
2349 for (
int i = 0;
i < max_requestors;
i++) {
2354 overallAvgMshrMissLatency = overallMshrMissLatency / overallMshrMisses;
2355 for (
int i = 0;
i < max_requestors;
i++) {
2360 overallAvgMshrUncacheableLatency =
2361 overallMshrUncacheableLatency / overallMshrUncacheable;
2362 for (
int i = 0;
i < max_requestors;
i++) {
2363 overallAvgMshrUncacheableLatency.subname(
i,
2390 assert(!cache->system->bypassCaches());
2395 cache->recvTimingSnoopResp(pkt);
2406 }
else if (
blocked || mustSendRetry) {
2408 mustSendRetry =
true;
2411 mustSendRetry =
false;
2420 if (cache->system->bypassCaches()) {
2423 M5_VAR_USED
bool success = cache->memSidePort.sendTimingReq(pkt);
2426 }
else if (tryTiming(pkt)) {
2427 cache->recvTimingReq(pkt);
2436 if (cache->system->bypassCaches()) {
2438 return cache->memSidePort.sendAtomic(pkt);
2440 return cache->recvAtomic(pkt);
2447 if (cache->system->bypassCaches()) {
2450 cache->memSidePort.sendFunctional(pkt);
2455 cache->functionalAccess(pkt,
true);
2461 return cache->getAddrRanges();
2467 const std::string &_label)
2480 cache->recvTimingResp(pkt);
2489 assert(!cache->system->bypassCaches());
2492 cache->recvTimingSnoopReq(pkt);
2499 assert(!cache->system->bypassCaches());
2501 return cache->recvAtomicSnoop(pkt);
2508 assert(!cache->system->bypassCaches());
2513 cache->functionalAccess(pkt,
false);
2520 assert(!waitingOnRetry);
2525 assert(deferredPacketReadyTime() ==
MaxTick);
2528 QueueEntry* entry = cache.getNextQueueEntry();
2547 if (!waitingOnRetry) {
2548 schedSendEvent(cache.nextQueueReadyTime());
2554 const std::string &_label)
2556 _reqQueue(*_cache, *this, _snoopRespQueue, _label),
2557 _snoopRespQueue(*_cache, *this, true, _label), cache(_cache)
2566 if (nextAddr == write_addr) {
2567 delayCtr[blk_addr] = delayThreshold;
2569 if (
mode != WriteMode::NO_ALLOCATE) {
2570 byteCount += write_size;
2573 if (
mode == WriteMode::ALLOCATE &&
2574 byteCount > coalesceLimit) {
2575 mode = WriteMode::COALESCE;
2577 }
else if (
mode == WriteMode::COALESCE &&
2578 byteCount > noAllocateLimit) {
2581 mode = WriteMode::NO_ALLOCATE;
2588 byteCount = write_size;
2589 mode = WriteMode::ALLOCATE;
2590 resetDelay(blk_addr);
2592 nextAddr = write_addr + write_size;
OverwriteType checkExpansionContraction(const std::size_t size) const
Determines if changing the size of the block will cause a data expansion (new size is bigger) or cont...
void setBlocked(BlockedCause cause)
Marks the access path of the cache as blocked for the given cause.
#define fatal(...)
This implements a cprintf based fatal() function.
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...
bool writeThrough() const
ProbePointArg< PacketPtr > * ppFill
To probe when a cache fill occurs.
std::vector< uint64_t > oldData
The stale data contents.
Entry * getNext() const
Returns the WriteQueueEntry at the head of the readyList.
TempCacheBlk * tempBlock
Temporary cache block for occasional transitory use.
virtual void regStats()
Callback to set stat parameters.
bool scheduled() const
Determine if the current event is scheduled.
void makeAtomicResponse()
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.
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.
const bool replaceExpansions
when a data expansion of a compressed block happens it will not be able to co-allocate where it is at...
@ SECURE
The request targets the secure memory space.
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...
void makeTimingResponse()
EventFunctionWrapper sendRetryEvent
bool cacheResponding() const
Addr blkAddr
Block aligned address.
virtual void functionalAccess(PacketPtr pkt, bool from_cpu_side)
Performs the access specified by the request.
const bool sequentialAccess
Whether tags and data are accessed sequentially.
A queue entry is holding packets that will be serviced as soon as resources are available.
#define UNSERIALIZE_SCALAR(scalar)
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 clearCoherenceBits(unsigned bits)
Clear the corresponding coherence bits.
void cmpAndSwap(CacheBlk *blk, PacketPtr pkt)
Handle doing the Compare and Swap function for SPARC.
void setCacheResponding()
Snoop flags.
void writeData(uint8_t *p) const
Copy data from the packet to the memory at the provided pointer.
Tick getWhenReady() const
Get tick at which block's data will be available for access.
bool isExpressSnoop() const
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...
Stats::Vector mshrMisses
Number of misses that miss in the MSHRs, per command and thread.
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
bool needsWritable() const
The pending* and post* flags are only valid if inService is true.
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.
int getNumTargets() const
Returns the current number of allocated targets.
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.
void clearPrefetched()
Clear the prefetching bit.
const unsigned blkSize
Block size of this cache.
void setHasSharers()
On fills, the hasSharers flag is used by the caches in combination with the cacheResponding flag,...
#define SUM_NON_DEMAND(s)
ProbePointArg< DataUpdate > * ppDataUpdate
To probe when the contents of a block are updated.
void setSatisfied()
Set when a request hits in a cache and the cache is not going to respond.
void markPending(MSHR *mshr)
Mark an in service entry as pending, used to resend a request.
ProbePointArg generates a point for the class of Arg.
Stats::Vector mshrUncacheableLatency
Total cycle latency of each MSHR miss, per command and thread.
MSHR * noTargetMSHR
Pointer to the MSHR that has no targets.
uint64_t Tick
Tick count type.
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,...
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
bool needsWritable() const
bool isInvalidate() const
std::shared_ptr< Request > RequestPtr
RequestPtr req
A pointer to the original request.
EventFunctionWrapper writebackTempBlockAtomicEvent
An event to writeback the tempBlock after recvAtomic finishes.
void deschedule(Event &event)
const Tick recvTime
Time when request was received (for stats)
virtual void handleTimingReqHit(PacketPtr pkt, CacheBlk *blk, Tick request_time)
virtual void recvFunctionalSnoop(PacketPtr pkt)
Receive a functional snoop request packet from the peer.
void sendFunctional(PacketPtr pkt) const
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
@ DATA_EXPANSION
New data contents are considered larger than previous contents.
CacheBlk * allocateBlock(const PacketPtr pkt, PacketList &writebacks)
Allocate a new block and perform any necessary writebacks.
void schedTimingResp(PacketPtr pkt, Tick when)
Schedule the sending of a timing response.
const AddrRangeList addrRanges
The address range to which the cache responds on the CPU side.
@ wbRequestorId
This requestor id is used for writeback requests by the caches.
std::vector< uint64_t > newData
The new data contents.
const Enums::Clusivity clusivity
Clusivity with respect to the upstream cache, determining if we fill into both this cache and the cac...
void regStatsFromParent()
Callback to register stats from parent CacheStats::regStats().
static const Priority Delayed_Writeback_Pri
For some reason "delayed" inter-cluster writebacks are scheduled before regular writebacks (which hav...
Stats::Vector mshrHits
Number of misses that hit in the MSHRs per command and thread.
const int numTarget
The number of targets for each MSHR.
MemSidePort(const std::string &_name, BaseCache *_cache, const std::string &_label)
void writeDataToBlock(uint8_t *blk_data, int blkSize) const
Copy data from the packet to the provided block pointer, which is aligned to the given block size.
void promoteWritable()
Promotes deferred targets that do not require writable.
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.
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
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.
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
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.
const PacketPtr pkt
Pending request packet.
bool coalesce() const
Should writes be coalesced? This is true if the mode is set to NO_ALLOCATE.
void insert(const Addr addr, const bool is_secure) override
Insert the block by assigning it a tag and marking it valid.
virtual std::unique_ptr< CompressionData > compress(const std::vector< Chunk > &chunks, Cycles &comp_lat, Cycles &decomp_lat)=0
Apply the compression process to the cache line.
bool isPendingModified() const
void setBlocked()
Do not accept any new requests.
virtual bool sendPacket(BaseCache &cache)=0
Send this queue entry as a downstream packet, with the exact behaviour depending on the specific entr...
Prefetcher::Base * prefetcher
Prefetcher.
Stats::Vector writebacks
Number of blocks written back per thread.
std::size_t getSizeBits() const
bool isSecure
True if the entry targets the secure memory space.
static void setDecompressionLatency(CacheBlk *blk, const Cycles lat)
Set the decompression latency of compressed block.
std::vector< SectorSubBlk * > blks
List of blocks associated to this sector.
void incMissCount(PacketPtr pkt)
void schedule(Event &event, Tick when)
void updateBlockData(CacheBlk *blk, const PacketPtr cpkt, bool has_old_data)
Update the data contents of a block.
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
void allocateWriteBuffer(PacketPtr pkt, Tick time)
Tick cyclesToTicks(Cycles c) const
bool promoteDeferredTargets()
MSHRQueue mshrQueue
Miss status registers.
void setWriteThrough()
A writeback/writeclean cmd gets propagated further downstream by the receiver when the flag is set.
CacheResponsePort(const std::string &_name, BaseCache *_cache, const std::string &_label)
Addr regenerateBlkAddr(CacheBlk *blk)
Regenerate block address using tags.
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the responder port by calling its corresponding receive function.
virtual Port & getPort(const std::string &if_name, PortID idx=InvalidPortID)
Get a port with a given name and index.
bool delay(Addr blk_addr)
Access whether we need to delay the current write.
#define ADD_STAT(n,...)
Convenience macro to add a stat to a statistics group.
bool allocOnFill(MemCmd cmd) const
Determine whether we should allocate on a fill or not.
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
uint8_t blocked
Bit vector of the blocking reasons for the access path.
bool isSecure() const
Check if this block holds data from the secure memory space.
void invalidateBlock(CacheBlk *blk)
Invalidate a cache block.
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.
void delay(MSHR *mshr, Tick delay_ticks)
Adds a delay to the provided MSHR and moves MSHRs that will be ready earlier than this entry to the t...
void handleUncacheableWriteResp(PacketPtr pkt)
Handling the special case of uncacheable write responses to make recvTimingResp less cluttered.
Ports are used to interface objects to each other.
bool needsResponse() const
virtual void recvTimingReq(PacketPtr pkt)
Performs the access specified by the request.
Cycles getDecompressionLatency(const CacheBlk *blk)
Get the decompression latency if the block is compressed.
CacheCmdStats(BaseCache &c, const std::string &name)
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...
AtomicOpFunctor * getAtomicOp() const
Accessor function to atomic op.
void setDataFromBlock(const uint8_t *blk_data, int blkSize)
Copy data into the packet from the provided block pointer, which is aligned to the given block size.
virtual Cycles handleAtomicReqMiss(PacketPtr pkt, CacheBlk *&blk, PacketList &writebacks)=0
Handle a request in atomic mode that missed in this cache.
virtual Target * getTarget()=0
Returns a pointer to the first target.
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?
#define chatty_assert(cond,...)
The chatty assert macro will function like a normal assert, but will allow the specification of addit...
void regProbePoints() override
Registers probes.
void deallocate(Entry *entry)
Removes the given entry from the queue.
bool isSnooping() const
Find out if the peer request port is snooping or not.
virtual Tick recvAtomicSnoop(PacketPtr pkt)
Receive an atomic snoop request packet from our peer.
Stats::Scalar dataContractions
Number of data contractions (blocks that had their compression factor improved).
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.
Addr getOffset(unsigned int blk_size) const
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.
virtual void doWritebacksAtomic(PacketList &writebacks)=0
Send writebacks down the memory hierarchy in atomic mode.
std::string print() const override
Pretty-print tag, set and way, and interpret state bits to readable form including mapping to a MOESI...
Entry * findMatch(Addr blk_addr, bool is_secure, bool ignore_uncacheable=true) const
Find the first entry that matches the provided address.
int getNumTargets() const
Returns the current number of allocated targets.
virtual bool isValid() const
Checks if the entry is valid.
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.
Simple class to provide virtual print() method on cache blocks without allocating a vtable pointer fo...
const Cycles lookupLatency
The latency of tag lookup of a cache.
MSHR * allocateMissBuffer(PacketPtr pkt, Tick time, bool sched_send=true)
bool checkWrite(PacketPtr pkt)
Handle interaction of load-locked operations and stores.
Cycles calculateTagOnlyLatency(const uint32_t delay, const Cycles lookup_lat) const
Calculate latency of accesses that only touch the tag array.
bool canPrefetch() const
Returns true if sufficient mshrs for prefetch.
uint32_t getTaskId() const
Get the task id associated to this block.
@ WritableBit
write permission
Target * getTarget() override
Returns a reference to the first target.
ProbePointArg< PacketInfo > Packet
Packet probe point.
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.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
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...
virtual Tick nextPrefetchReadyTime() const =0
bool wasPrefetched() const
Check if this block was the result of a hardware prefetch, yet to be touched.
const std::string & name()
#define SERIALIZE_SCALAR(scalar)
Counter order
Order number assigned to disambiguate writes and misses.
@ funcRequestorId
This requestor id is used for functional requests that don't come from a particular device.
bool trySatisfyFunctional(PacketPtr pkt)
Check the list of buffered packets against the supplied functional request.
const FlagsType nozero
Don't print if this is zero.
ProbeManager * getProbeManager()
Get the probe manager for this object.
void setDecompressionLatency(const Cycles lat)
Set number of cycles needed to decompress this block.
QueueEntry::Target * getTarget() override
Returns a reference to the first target.
bool isSet(unsigned bits) const
Checks the given coherence bits are set.
void setCoherenceBits(unsigned bits)
Sets the corresponding coherence bits.
Compressor::Base * compressor
Compression method being used.
bool isCleanEviction() const
Is this packet a clean eviction, including both actual clean evict packets, but also clean writebacks...
virtual void doWritebacks(PacketList &writebacks, Tick forward_time)=0
Insert writebacks into the write buffer.
const bool writebackClean
Determine if clean lines should be written back or not.
void setWhenReady(const Tick tick)
Set tick at which block's data will be available for access.
SectorBlk * getSectorBlock() const
Get sector block associated to this block.
virtual const std::string name() const
MemCmd cmd
The command field of the packet.
#define UNIT_RATE(T1, T2)
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
BaseTags * tags
Tag and data Storage.
Stats::Vector mshrMissLatency
Total cycle latency of each MSHR miss, per command and thread.
bool wasWholeLineWrite
Track if we sent this as a whole line write or not.
bool inService
True if the entry has been sent downstream.
#define warn_if(cond,...)
Conditional warning macro that checks the supplied condition and only prints a warning if the conditi...
Copyright (c) 2018 Inria All rights reserved.
void allocateTarget(PacketPtr target, Tick when, Counter order, bool alloc_on_fill)
Add a request to the list of targets.
Entry * findPending(const QueueEntry *entry) const
Find any pending requests that overlap the given request of a different queue.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
virtual M5_NODISCARD PacketPtr evictBlock(CacheBlk *blk)=0
Evict a cache block.
void pushSenderState(SenderState *sender_state)
Push a new sender state to the packet and make the current sender state the predecessor of the new on...
A data contents update is composed of the updated block's address, the old contents,...
uint8_t * data
Contains a copy of the data in this block for easy access.
bool sendWriteQueuePacket(WriteQueueEntry *wq_entry)
Similar to sendMSHR, but for a write-queue entry instead.
A basic compression superblock.
void setSizeBits(const std::size_t size)
Set size, in bits, of this compressed block's data.
void resetDelay(Addr blk_addr)
Clear delay counter for the input block.
RequestorID maxRequestors()
Get the number of requestors registered in the system.
Cycles ticksToCycles(Tick t) const
@ DirtyBit
dirty (modified)
Stats::Scalar dataExpansions
Number of data expansions.
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
void trackLoadLocked(PacketPtr pkt)
Track the fact that a local locked was issued to the block.
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.
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
OverwriteType
When an overwrite happens, the data size may change an not fit in its current container any longer.
void reset()
Reset the write allocator state, meaning that it allocates for writes and has not recorded any inform...
void sendFunctionalSnoop(PacketPtr pkt) const
Send a functional snoop request packet, where the data is instantly updated everywhere in the memory ...
bool isConnected() const
Is this port currently connected to a peer?
bool allocate() const
Should writes allocate?
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.
bool handleEvictions(std::vector< CacheBlk * > &evict_blks, PacketList &writebacks)
Try to evict the given blocks.
#define UNIT_CYCLE
Convenience macros to declare the unit of a stat.
Tick nextReadyTime() const
bool isDirty() const
Determine if there are any dirty blocks in the cache.
virtual PacketPtr getPacket()=0
std::ostream CheckpointOut
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.
std::string getRequestorName(RequestorID requestor_id)
Get the name of an object for a given request id.
void writebackTempBlockAtomic()
Send the outstanding tempBlock writeback.
const bool moveContractions
Similar to data expansions, after a block improves its compression, it may need to be moved elsewhere...
bool trySatisfyFunctional(PacketPtr pkt)
Check the list of buffered packets against the supplied functional request.
void invalidate() override
Invalidate the block and clear all state.
Tick curTick()
The universal simulation clock.
void updateMode(Addr write_addr, unsigned write_size, Addr blk_addr)
Update the write mode based on the current write packet.
const Cycles responseLatency
The latency of sending reponse to its upper level cache/core on a linefill.
BaseCache(const BaseCacheParams &p, unsigned blk_size)
virtual void memWriteback() override
Write back dirty blocks in the cache using functional accesses.
void incHitCount(PacketPtr pkt)
virtual void recvTimingResp(PacketPtr pkt)
Handles a response (cache line fill/write ack) from the bus.
bool isWholeLineWrite() const
Check if this MSHR contains only compatible writes, and if they span the entire cache line.
Special instance of CacheBlk for use with tempBlk that deals with its block address regeneration.
bool isForward
True if the entry is just a simple forward from an upper level.
void allocate()
Allocate memory for the packet.
@ ReadableBit
Read permission.
A coherent cache that can be arranged in flexible topologies.
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
virtual bool tryTiming(PacketPtr pkt) override
Availability request from the peer.
virtual Tick recvAtomic(PacketPtr pkt)
Performs the access specified by the request.
const FlagsType total
Print the total.
void sendRangeChange() const
Called by the owner to send a range change.
bool trySatisfyFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
void promoteReadable()
Promotes deferred targets that do not require writable.
void regStats() override
Callback to set stat parameters.
static void setSizeBits(CacheBlk *blk, const std::size_t size_bits)
Set the size of the compressed block, in bits.
PacketPtr tempBlockWriteback
Writebacks from the tempBlock, resulting on the response path in atomic mode, must happen after the c...
const T * getConstPtr() const
A superblock is composed of sub-blocks, and each sub-block has information regarding its superblock a...
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)
virtual void recvFunctional(PacketPtr pkt) override
Receive a functional request packet from the peer.
bool inRange(Addr addr) const
Determine if an address is in the ranges covered by this cache.
@ DATA_CONTRACTION
New data contents are considered smaller than previous contents.
ProbePointArg< PacketPtr > * ppHit
To probe when a cache hit occurs.
bool trySatisfyFunctional(PacketPtr pkt)
const FlagsType nonan
Don't print if this is NAN.
virtual void recvTimingSnoopReq(PacketPtr pkt)
Receive a timing snoop request from the peer.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
#define panic(...)
This implements a cprintf based panic() function.
A cache response port is used for the CPU-side port of the cache, and it is basically a simple timing...
Miss Status and handling Register.
Addr getAddr() const
Get block's address.
uint64_t order
Increasing order number assigned to each incoming request.
Generated on Tue Mar 23 2021 19:41:24 for gem5 by doxygen 1.8.17