58 #include "debug/Cache.hh"
59 #include "debug/CachePort.hh"
60 #include "debug/CacheTags.hh"
61 #include "debug/CacheVerbose.hh"
70 prefetcher(p->prefetcher),
72 prefetchOnAccess(p->prefetch_on_access),
73 clusivity(p->clusivity),
74 writebackClean(p->writeback_clean),
75 tempBlockWriteback(nullptr),
76 writebackTempBlockAtomicEvent(this, false,
112 uint64_t overwrite_val;
114 uint64_t condition_val64;
115 uint32_t condition_val32;
120 assert(
sizeof(uint64_t) >= pkt->
getSize());
122 overwrite_mem =
true;
125 pkt->
writeData((uint8_t *)&overwrite_val);
129 if (pkt->
getSize() ==
sizeof(uint64_t)) {
131 overwrite_mem = !std::memcmp(&condition_val64, blk_data,
133 }
else if (pkt->
getSize() ==
sizeof(uint32_t)) {
135 overwrite_mem = !std::memcmp(&condition_val32, blk_data,
138 panic(
"Invalid size for conditional read/write\n");
142 std::memcpy(blk_data, &overwrite_val, pkt->
getSize());
150 bool deferred_response,
bool pending_downgrade)
183 DPRINTF(CacheVerbose,
"%s for %s (write)\n", __func__, pkt->
print());
184 }
else if (pkt->
isRead()) {
210 }
else if (blk->
isWritable() && !pending_downgrade &&
225 if (!deferred_response) {
274 DPRINTF(CacheVerbose,
"%s for %s (invalidation)\n", __func__,
293 "Should never see a write in a read-only cache %s\n",
296 DPRINTF(CacheVerbose,
"%s for %s\n", __func__, pkt->
print());
303 if (old_blk && old_blk->isValid()) {
322 blk ?
"hit " + blk->
print() :
"miss");
339 assert(wbPkt->isWriteback());
374 DPRINTF(
Cache,
"Clean writeback %#llx to block with MSHR, "
379 if (blk ==
nullptr) {
382 if (blk ==
nullptr) {
412 if (blk !=
nullptr) {
463 while (!writebacks.empty()) {
496 writebacks.pop_front();
503 while (!writebacks.empty()) {
525 writebacks.pop_front();
548 if (!forwardAsSnoop) {
555 DPRINTF(
Cache,
"Got prefetch response from above for addr "
578 DPRINTF(
Cache,
"packet promoted from Write to WriteLineReq\n");
603 DPRINTF(
Cache,
"Cache above responding to %s: not responding\n",
632 snoop_pkt->headerDelay = snoop_pkt->payloadDelay = 0;
639 snoop_pkt->setExpressSnoop();
640 snoop_pkt->setCacheResponding();
671 bool satisfied =
false;
676 satisfied =
access(pkt, blk, lat, writebacks);
728 DPRINTF(
Cache,
"%s satisfied %s, no response needed\n", __func__,
757 assert(needsResponse);
775 assert(pf->getAddr() == pkt->
getAddr());
901 bool needsWritable)
const
906 bool blkValid = blk && blk->
isValid();
923 const bool useUpgrades =
true;
930 }
else if (blkValid && useUpgrades) {
933 assert(needsWritable);
953 if (cpu_pkt->
hasSharers() && !needsWritable) {
959 DPRINTF(
Cache,
"%s: passing hasSharers from %s to %s\n",
988 DPRINTF(
Cache,
"Cache above responding to %s: not responding\n",
1006 bool satisfied =
access(pkt, blk, lat, writebacks);
1026 bool is_forward = (bus_pkt ==
nullptr);
1046 DPRINTF(
Cache,
"%s: Receive response: %s in state %i\n", __func__,
1047 bus_pkt->
print(), old_state);
1066 assert(blk != NULL);
1067 is_invalidate =
false;
1069 }
else if (bus_pkt->
isRead() ||
1086 if (is_invalidate && blk && blk->
isValid()) {
1144 assert(fromCpuSide);
1167 bool have_data = blk && blk->
isValid()
1174 have_data && (blk->
isDirty() ||
1177 bool done = have_dirty
1183 DPRINTF(CacheVerbose,
"%s: %s %s%s%s\n", __func__, pkt->
print(),
1184 (blk && blk->
isValid()) ?
"valid " :
"",
1185 have_data ?
"data " :
"", done ?
"done " :
"");
1233 "%s saw a non-zero packet delay\n",
name());
1235 bool is_error = pkt->
isError();
1238 DPRINTF(
Cache,
"%s: Cache received %s with error\n", __func__,
1296 if (is_fill && !is_error) {
1297 DPRINTF(
Cache,
"Block for addr %#llx being updated in Cache\n",
1301 assert(blk !=
nullptr);
1311 bool from_cache =
false;
1313 for (
auto &target: targets) {
1314 Packet *tgt_pkt = target.pkt;
1315 switch (target.source) {
1317 Tick completion_time;
1328 delete tgt_pkt->
req;
1335 from_cache = from_cache || tgt_pkt->
fromCache();
1350 targets.allocOnFill);
1351 assert(blk !=
nullptr);
1356 is_invalidate =
false;
1363 int transfer_offset =
1365 if (transfer_offset < 0) {
1380 completion_time - target.recvTime;
1401 if (is_invalidate && blk && blk->
isValid()) {
1409 if (pkt->
isRead() && !is_error) {
1439 delete tgt_pkt->
req;
1457 assert(!(is_invalidate &&
1464 panic(
"Illegal target->source enum %d\n", target.source);
1534 DPRINTF(CacheVerbose,
"%s: Leaving with %s\n", __func__, pkt->
print());
1542 "Writeback from read-only cache");
1560 DPRINTF(
Cache,
"Create Writeback %s writable: %d, dirty: %d\n",
1656 warn_once(
"Invalidating dirty cache lines. Expect things to break.\n");
1687 DPRINTF(
Cache,
"replacement: replacing %#llx (%s) with %#llx "
1688 "(%s): %s\n", repl_addr, blk->
isSecure() ?
"s" :
"ns",
1689 addr, is_secure ?
"s" :
"ns",
1690 blk->
isDirty() ?
"writeback" :
"clean");
1737 if (blk ==
nullptr) {
1748 blk = allocate ?
allocateBlock(addr, is_secure, writebacks) :
nullptr;
1750 if (blk ==
nullptr) {
1759 DPRINTF(
Cache,
"using temp block for %#llx (%s)\n", addr,
1760 is_secure ?
"s" :
"ns");
1766 assert(!blk->isValid());
1808 "in read-only cache %s\n",
name());
1812 DPRINTF(
Cache,
"Block addr %#llx (%s) moving from state %x to %s\n",
1813 addr, is_secure ?
"s" :
"ns", old_state, blk->
print());
1840 bool already_copied,
bool pending_inval)
1850 if (!already_copied)
1858 pkt->makeTimingResponse();
1859 if (pkt->isRead()) {
1860 pkt->setDataFromBlock(blk_data,
blkSize);
1877 pkt->headerDelay = pkt->payloadDelay = 0;
1878 DPRINTF(CacheVerbose,
"%s: created response: %s tick: %lu\n", __func__,
1879 pkt->print(), forward_time);
1885 bool is_deferred,
bool pending_inval)
1887 DPRINTF(CacheVerbose,
"%s: for %s\n", __func__, pkt->
print());
1889 assert(!(is_deferred && !is_timing));
1891 assert(!(pending_inval && !is_deferred));
1904 "%s got an invalidating uncacheable snoop request %s",
1907 uint32_t snoop_delay = 0;
1919 Packet snoopPkt(pkt,
true,
true);
1933 assert(!alreadyResponded);
1957 if (!blk || !blk->
isValid()) {
1958 DPRINTF(CacheVerbose,
"%s: snoop miss for %s\n", __func__,
1974 DPRINTF(
Cache,
"%s: snoop hit for %s, old state is %s\n", __func__,
1979 "Should never have a dirty block in a read-only cache %s\n",
1995 DPRINTF(
Cache,
"Found addr %#llx in upper level cache for snoop %s "
2001 if (pkt->
isRead() && !invalidate) {
2003 assert(!needs_writable);
2020 if (have_writable) {
2039 "%s is passing a Modified line through %s, "
2040 "but keeping the block",
name(), pkt->
print());
2053 if (!respond && is_deferred) {
2082 DPRINTF(CacheVerbose,
"%s: for %s\n", __func__, pkt->
print());
2109 DPRINTF(
Cache,
"Setting block cached for %s from lower cache on "
2110 "mshr hit\n", pkt->
print());
2118 DPRINTF(
Cache,
"Deferring snoop on in-service MSHR to blk %#llx (%s)."
2119 "mshrs: %s\n", blk_addr, is_secure ?
"s" :
"ns",
2123 warn(
"allocating bonus target for snoop");
2130 DPRINTF(
Cache,
"Snoop hit in writeback to addr %#llx (%s)\n",
2131 pkt->
getAddr(), is_secure ?
"s" :
"ns");
2139 assert(wb_pkt->isEviction());
2147 DPRINTF(
Cache,
"%s: Squashing %s from lower cache on writequeue "
2148 "hit\n", __func__, pkt->
print());
2159 bool have_writable = !wb_pkt->hasSharers();
2165 wb_pkt->setHasSharers();
2171 if (have_writable) {
2192 uint32_t snoop_delay =
handleSnoop(pkt, blk,
true,
false,
false);
2220 uint32_t snoop_delay =
handleSnoop(pkt, blk,
false,
false,
false);
2238 MSHR *conflict_mshr =
2242 if (conflict_mshr && conflict_mshr->
order < wq_entry->
order) {
2244 return conflict_mshr;
2251 }
else if (miss_mshr) {
2256 if (conflict_mshr) {
2269 return conflict_mshr;
2279 assert(!miss_mshr && !wq_entry);
2319 Packet snoop_pkt(pkt,
true,
false);
2345 nextReady = std::min(nextReady,
2367 assert(blk ==
nullptr);
2374 Packet snoop_pkt(tgt_pkt,
true,
false);
2401 bool pending_modified_resp = !snoop_pkt.
hasSharers();
2411 DPRINTF(
Cache,
"Block present, prefetch squashed by cache. "
2412 "Deallocating mshr target %#x.\n",
2435 pkt =
new Packet(tgt_pkt,
false,
true);
2463 bool pending_modified_resp = !pkt->
hasSharers() &&
2500 warn(
"*** The cache still contains dirty data. ***\n");
2501 warn(
" Make sure to drain the system using the correct flags.\n");
2502 warn(
" This checkpoint will not restore correctly and dirty data "
2503 " in the cache will be lost!\n");
2510 bool bad_checkpoint(dirty);
2517 bool bad_checkpoint;
2519 if (bad_checkpoint) {
2520 fatal(
"Restoring from checkpoints with dirty caches is not supported "
2521 "in the classic memory system. Please remove any caches or "
2522 " drain them properly before taking checkpoints.\n");
2535 return cache->getAddrRanges();
2541 assert(!cache->system->bypassCaches());
2543 bool success =
false;
2548 bool M5_VAR_USED bypass_success = cache->recvTimingReq(pkt);
2549 assert(bypass_success);
2551 }
else if (
blocked || mustSendRetry) {
2557 success = cache->recvTimingReq(pkt);
2561 mustSendRetry = !success;
2568 return cache->recvAtomic(pkt);
2575 cache->functionalAccess(pkt,
true);
2580 const std::string &_label)
2586 CacheParams::create()
2590 return new Cache(
this);
2601 cache->recvTimingResp(pkt);
2610 cache->recvTimingSnoopReq(pkt);
2616 return cache->recvAtomicSnoop(pkt);
2625 cache->functionalAccess(pkt,
false);
2632 assert(!waitingOnRetry);
2637 assert(deferredPacketReadyTime() ==
MaxTick);
2640 QueueEntry* entry = cache.getNextQueueEntry();
2649 if (checkConflictingSnoop(entry->
blkAddr)) {
2659 if (!waitingOnRetry) {
2660 schedSendEvent(cache.nextQueueReadyTime());
2666 const std::string &_label)
2668 _reqQueue(*_cache, *this, _snoopRespQueue, _label),
2669 _snoopRespQueue(*_cache, *this, _label), cache(_cache)
Entry * findMatch(Addr blk_addr, bool is_secure) const
Find the first WriteQueueEntry that matches the provided address.
Miss Status and Handling Register (MSHR) declaration.
#define chatty_assert(cond,...)
The chatty assert macro will function like a normal assert, but will allow the specification of addit...
This master id is used for functional requests that don't come from a particular device.
bool isDirty() const
Check to see if a block has been written.
virtual void regStats()
Register stats for this object.
virtual void recvTimingSnoopReq(PacketPtr pkt)
bool forwardSnoops
Do we forward snoops from mem side port through to cpu side port?
bool isUncacheable() const
Accessor functions for flags.
virtual void recvFunctional(PacketPtr pkt)
Target * getTarget()
Returns a reference to the first target.
bool isSecure
True if the entry targets the secure memory space.
void setResponderHadWritable()
On responding to a snoop request (which only happens for Modified or Owned lines), make sure that we can transform an Owned response to a Modified one.
QueueEntry * getNextQueueEntry()
Return the next queue entry to service, either a pending miss from the MSHR queue, a buffered write from the write buffer, or something from the prefetcher.
void setHasSharers()
On fills, the hasSharers flag is used by the caches in combination with the cacheResponding flag...
bool inService
True if the entry has been sent downstream.
State status
The current status of this block.
Cycles is a wrapper class for representing cycle counts, i.e.
bool isBlockCached() const
Entry * findPending(Addr blk_addr, bool is_secure) const
Find any pending requests that overlap the given request.
int getNumTargets() const
Returns the current number of allocated targets.
Tick whenReady
Which curTick() will this block be accessable.
bool isDirty() const
Does the array contain a dirty line?
WriteQueue writeBuffer
Write/writeback buffer.
Addr tag
Data block tag value.
bool needsWritable() const
The pending* and post* flags are only valid if inService is true.
void doWritebacksAtomic(PacketList &writebacks)
Send writebacks down the memory hierarchy in atomic mode.
Cycles ticksToCycles(Tick t) const
uint32_t snoopDelay
Keep track of the extra delay incurred by snooping upwards before sending a request down the memory s...
void makeTimingResponse()
MSHR * noTargetMSHR
Pointer to the MSHR that has no targets.
int getNumTargets() const
Returns the current number of allocated targets.
bool forceDeallocateTarget(MSHR *mshr)
Deallocate top target, possibly freeing the MSHR.
void setExtraData(uint64_t extraData)
Accessor function for store conditional return value.
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.
void memWriteback() override
Write back dirty blocks in the cache using functional accesses.
void invalidateBlock(CacheBlk *blk)
Invalidate a cache block.
bool isExpressSnoop() const
Tick sendAtomicSnoop(PacketPtr pkt)
Send an atomic snoop request packet, where the data is moved and the state is updated in zero time...
bool bypassCaches() const
Should caches be bypassed?
void functionalAccess(PacketPtr pkt, bool fromCpuSide)
Performs the access specified by the request.
Addr getBlockAddr(unsigned int blk_size) const
uint64_t getExtraData() const
Accessor function for store conditional return value.
void memInvalidate() override
Invalidates all blocks in the cache.
PacketPtr writebackBlk(CacheBlk *blk)
Create a writeback request for the given block.
System * system
System we are currently operating in.
panic_if(!root,"Invalid expression\n")
const bool isReadOnly
Is this cache read only, for example the instruction cache, or table-walker cache.
CpuSidePort(const std::string &_name, Cache *_cache, const std::string &_label)
BasePrefetcher * prefetcher
Prefetcher.
CacheSlavePort * cpuSidePort
virtual bool recvTimingReq(PacketPtr pkt)
const PacketPtr pkt
Pending request packet.
void sendFunctionalSnoop(PacketPtr pkt)
Send a functional snoop request packet, where the data is instantly updated everywhere in the memory ...
bool inRange(Addr addr) const
Determine if an address is in the ranges covered by this cache.
Simple class to provide virtual print() method on cache blocks without allocating a vtable pointer fo...
MSHR * allocateMissBuffer(PacketPtr pkt, Tick time, bool sched_send=true)
bool responderHadWritable() const
bool sendTimingReq(PacketPtr pkt)
Attempt to send a timing request to the slave port by calling its corresponding receive function...
virtual Tick notify(const PacketPtr &pkt)=0
Notify prefetcher of cache access (may be any access or just misses, depending on cache parameters...
int cmdToIndex() const
Return the index of this command.
const Cycles fillLatency
The latency to fill a cache block.
This master id is used for writeback requests by the caches.
bool isWritable() const
Checks the write permissions of this block.
Counter order
Order number assigned to disambiguate writes and misses.
void print(std::ostream &os, int verbosity=0, const std::string &prefix="") const
Prints the contents of this MSHR for debugging.
void pushLabel(const std::string &lbl)
Push label for PrintReq (safe to call unconditionally).
void writebackTempBlockAtomic()
Send the outstanding tempBlock writeback.
T * getPtr()
get a pointer to the data ptr.
bool mustCheckAbove() const
Does the request need to check for cached copies of the same block in the memory hierarchy above...
bool isCachedAbove(PacketPtr pkt, bool is_timing=true) const
Send up a snoop request and find cached copies.
void writeData(uint8_t *p) const
Copy data from the packet to the provided block pointer, which is aligned to the given block size...
void markPending(MSHR *mshr)
Mark an in service entry as pending, used to resend a request.
void dataStatic(T *p)
Set the data pointer to the following value that should not be freed.
Stats::Vector mshr_uncacheable_lat[MemCmd::NUM_MEM_CMDS]
Total cycle latency of each MSHR miss, per command and thread.
virtual void sendDeferredPacket()
Override the normal sendDeferredPacket and do not only consider the transmit list (used for responses...
bool checkFunctional(PacketPtr pkt, Addr blk_addr)
const Cycles responseLatency
The latency of sending reponse to its upper level cache/core on a linefill.
virtual AddrRangeList getAddrRanges() const
bool invalidateVisitor(CacheBlk &blk)
Cache block visitor that invalidates all blocks in the cache.
bool isSnooping() const
Find out if the peer master port is snooping or not.
void deallocate(Entry *entry)
Removes the given entry from the queue.
bool sendMSHRQueuePacket(MSHR *mshr)
Take an MSHR, turn it into a suitable downstream packet, and send it out.
A template-policy based cache.
#define UNSERIALIZE_SCALAR(scalar)
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...
const Enums::Clusivity clusivity
Clusivity with respect to the upstream cache, determining if we fill into both this cache and the cac...
A cache master port is used for the memory-side port of the cache, and in addition to the basic timin...
Cache block visitor that determines if there are dirty blocks in a cache.
Tick curTick()
The current simulated tick.
bool checkWrite(PacketPtr pkt)
Handle interaction of load-locked operations and stores.
virtual Tick recvAtomic(PacketPtr pkt)
void trackLoadLocked(PacketPtr pkt)
Track the fact that a local locked was issued to the block.
void allocateTarget(PacketPtr target, Tick when, Counter order, bool alloc_on_fill)
Add a request to the list of targets.
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
Stats::Vector writebacks
Number of blocks written back per thread.
void serialize(CheckpointOut &cp) const override
serialize the state of the caches We currently don't support checkpointing cache state, so this panics.
Target * getTarget()
Returns a reference to the first target.
void setData(const uint8_t *p)
Copy data into the packet from the provided pointer.
The memory-side port extends the base cache master port with access functions for functional...
block holds data from the secure memory space
void makeAtomicResponse()
PacketPtr cleanEvictBlk(CacheBlk *blk)
Create a CleanEvict request for the given block.
uint64_t Tick
Tick count type.
const bool prefetchOnAccess
Notify the prefetcher on every access, not just misses.
EventWrapper< Cache,&Cache::writebackTempBlockAtomic > writebackTempBlockAtomicEvent
An event to writeback the tempBlock after recvAtomic finishes.
void incMissCount(PacketPtr pkt)
bool checkFunctional(PacketPtr pkt)
Check the list of buffered packets against the supplied functional request.
void popLabel()
Pop label for PrintReq (safe to call unconditionally).
CacheMasterPort * memSidePort
unsigned State
block state: OR of CacheBlkStatusBit
Miss Status and handling Register.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
CacheBlk * handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks, bool allocate)
Populates a cache block and handles all outstanding requests for the satisfied fill request...
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...
bool sendWriteQueuePacket(WriteQueueEntry *wq_entry)
Similar to sendMSHR, but for a write-queue entry instead.
void handleUncacheableWriteResp(PacketPtr pkt)
Handling the special case of uncacheable write responses to make recvTimingResp less cluttered...
const bool writebackClean
Determine if clean lines should be written back or not.
const RequestPtr req
A pointer to the original request.
void allocateWriteBuffer(PacketPtr pkt, Tick time)
virtual void recvFunctionalSnoop(PacketPtr pkt)
Stats::Vector missLatency[MemCmd::NUM_MEM_CMDS]
Total number of cycles per thread/command spent waiting for a miss.
virtual bool recvTimingSnoopResp(PacketPtr pkt)
bool needsResponse() const
void recvTimingResp(PacketPtr pkt)
Handles a response (cache line fill/write ack) from the bus.
Tick recvAtomicSnoop(PacketPtr pkt)
Snoop for the provided request in the cache and return the estimated time taken.
void doWritebacks(PacketList &writebacks, Tick forward_time)
Insert writebacks into the write buffer.
void promoteWholeLineWrites(PacketPtr pkt)
Turn line-sized writes into WriteInvalidate transactions.
Definitions of a simple cache block class.
void invalidate()
Invalidate the block and clear all state.
virtual ~Cache()
Non-default destructor is needed to deallocate memory.
bool needsWritable() const
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.
bool cacheResponding() const
bool isCleanEviction() const
Is this packet a clean eviction, including both actual clean evict packets, but also clean writebacks...
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
Stats::Vector mshr_misses[MemCmd::NUM_MEM_CMDS]
Number of misses that miss in the MSHRs, per command and thread.
void recvTimingSnoopReq(PacketPtr pkt)
Snoops bus transactions to maintain coherence.
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
const unsigned blkSize
Block size of this cache.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Stats::Vector mshr_hits[MemCmd::NUM_MEM_CMDS]
Number of misses that hit in the MSHRs per command and thread.
void recvTimingSnoopResp(PacketPtr pkt)
Handle a snoop response.
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...
uint64_t order
Increasing order number assigned to each incoming request.
void cmpAndSwap(CacheBlk *blk, PacketPtr pkt)
Handle doing the Compare and Swap function for SPARC.
bool isSWPrefetch() const
MasterID maxMasters()
Get the number of masters registered in the system.
#define SERIALIZE_SCALAR(scalar)
Tick nextReadyTime() const
bool checkFunctional(PacketPtr other)
Check a functional request against a memory value stored in another packet (i.e.
static const int NumArgumentRegs M5_VAR_USED
Flags getFlags()
Accessor for flags.
virtual bool recvTimingResp(PacketPtr pkt)
A queue entry base class, to be used by both the MSHRs and write-queue entries.
MasterID masterId() const
Accesssor for the requestor id.
void makeResponse()
Take a request packet and modify it in place to be suitable for returning as a response to that reque...
bool canPrefetch() const
Returns true if sufficient mshrs for prefetch.
read permission (yes, block can be valid but not readable)
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...
bool access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat, PacketList &writebacks)
Does all the processing necessary to perform the provided request.
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
Tick nextQueueReadyTime() const
Find next request ready time from among possible sources.
Addr blkAddr
Block aligned address.
std::string print() const
Pretty-print a tag, and interpret state bits to readable form including mapping to a MOESI state...
A cache slave port is used for the CPU-side port of the cache, and it is basically a simple timing po...
bool hasPostDowngrade() const
std::ostream CheckpointOut
bool handleSnoop(PacketPtr target, Counter order)
PacketPtr tempBlockWriteback
Writebacks from the tempBlock, resulting on the response path in atomic mode, must happen after the c...
Cache(const CacheParams *p)
Instantiates a basic cache object.
void doTimingSupplyResponse(PacketPtr req_pkt, const uint8_t *blk_data, bool already_copied, bool pending_inval)
virtual Tick recvAtomicSnoop(PacketPtr pkt)
void setBlocked(BlockedCause cause)
Marks the access path of the cache as blocked for the given cause.
SenderState * senderState
This packet's sender state.
PacketPtr createMissPacket(PacketPtr cpu_pkt, CacheBlk *blk, bool needsWritable) const
Create an appropriate downstream bus request packet for the given parameters.
Tick recvAtomic(PacketPtr pkt)
Performs the access specified by the request.
MemCmd cmd
The command field of the packet.
TargetList extractServiceableTargets(PacketPtr pkt)
Extracts the subset of the targets that can be serviced given a received response.
virtual bool sendPacket(Cache &cache)=0
Send this queue entry as a downstream packet, with the exact behaviour depending on the specific entr...
bool isForward
True if the entry is just a simple forward from an upper level.
Stats::Vector mshr_uncacheable[MemCmd::NUM_MEM_CMDS]
Number of misses that miss in the MSHRs, per command and thread.
uint32_t handleSnoop(PacketPtr pkt, CacheBlk *blk, bool is_timing, bool is_deferred, bool pending_inval)
Perform an upward snoop if needed, and update the block state (possibly invalidating the block)...
void setCache(BaseCache *_cache)
bool promoteDeferredTargets()
const bool doFastWrites
This cache should allocate a block on a line-sized write miss.
void sendTimingSnoopReq(PacketPtr pkt)
Attempt to send a timing snoop request packet to the master port by calling its corresponding receive...
void schedule(Event &event, Tick when)
bool isDirty() const override
Determine if there are any dirty blocks in the cache.
Entry * getNext() const
Returns the WriteQueueEntry at the head of the readyList.
const int numTarget
The number of targets for each MSHR.
uint32_t task_id
Task Id associated with this block.
const Cycles forwardLatency
This is the forward latency of the cache.
const PacketPtr pkt
Pending request packet.
void schedTimingResp(PacketPtr pkt, Tick when, bool force_order=false)
Schedule the sending of a timing response.
The request targets the secure memory space.
bool recvTimingReq(PacketPtr pkt)
Performs the access specified by the request.
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...
bool writebackVisitor(CacheBlk &blk)
Cache block visitor that writes back dirty cache blocks using functional writes.
bool allocOnFill(MemCmd cmd) const override
Determine whether we should allocate on a fill or not.
CacheBlk * allocateBlock(Addr addr, bool is_secure, PacketList &writebacks)
Find a block frame for new block at address addr targeting the given security space, assuming that the block is not currently in the cache.
std::unordered_set< RequestPtr > outstandingSnoop
Store the outstanding requests that we are expecting snoop responses from so we can determine which s...
SenderState * popSenderState()
Pop the top of the state stack and return a pointer to it.
void regStats() override
Register stats for this object.
const Tick recvTime
Time when request was received (for stats)
int set
The set and way this block belongs to.
void copyError(Packet *pkt)
const T * getConstPtr() const
Common base class for Event and GlobalEvent, so they can share flag and priority definitions and acce...
void setExpressSnoop()
The express snoop flag is used for two purposes.
The CPU-side port extends the base cache slave port with access functions for functional, atomic and timing requests.
bool isReadable() const
Checks the read permissions of this block.
bool isUncacheable() const
virtual Tick nextPrefetchReadyTime() const =0
bool isValid() const
Checks that a block is valid.
bool isInvalidate() const
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time...
CacheBlk * tempBlock
Temporary cache block for occasional transitory use.
Miss and writeback queue declarations.
Describes a cache based on template policies.
void setFlags(Flags flags)
Note that unlike other accessors, this function sets specific flags (ORs them in); it does not assign...
bool wasPrefetched() const
Check if this block was the result of a hardware prefetch, yet to be touched.
void incHitCount(PacketPtr pkt)
uint8_t * data
Contains a copy of the data in this block for easy access.
virtual PacketPtr getPacket()=0
block was a hardware prefetch yet unaccessed
BaseTags * tags
Tag and data Storage.
bool hasPostInvalidate() const
void allocate()
Allocate memory for the packet.
Wrap a method and present it as a cache block visitor.
void clearBlocked(BlockedCause cause)
Marks the cache as unblocked for the given cause.
bool isPendingModified() const
bool checkFunctional(PacketPtr pkt)
Check the list of buffered packets against the supplied functional request.
bool hasPaddr() const
Accessor for paddr.
Addr getOffset(unsigned int blk_size) const
void sendFunctional(PacketPtr pkt)
Send a functional request packet, where the data is instantly updated everywhere in the memory system...
void maintainClusivity(bool from_cache, CacheBlk *blk)
Maintain the clusivity of this cache by potentially invalidating a block.
ProbePointArg< PacketInfo > Packet
Packet probe point.
MSHRQueue mshrQueue
Miss status registers.
MemSidePort(const std::string &_name, Cache *_cache, const std::string &_label)
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...
void writeDataToBlock(uint8_t *blk_data, int blkSize) const
Copy data from the packet to the memory at the provided pointer.
bool isSecure() const
Check if this block holds data from the secure memory space.
void setCacheResponding()
Snoop flags.
void schedTimingSnoopResp(PacketPtr pkt, Tick when, bool force_order=false)
Schedule the sending of a timing snoop response.