54#include "debug/Cache.hh"
57#include "params/NoncoherentCache.hh"
66 assert(
p.replacement_policy);
100 while (!writebacks.empty()) {
103 writebacks.pop_front();
110 while (!writebacks.empty()) {
113 writebacks.pop_front();
120 Tick forward_time,
Tick request_time)
129 assert(mshr || !blk || !blk->
isValid());
141 "Should only see read and writes at non-coherent cache\n");
149 bool is_whole_line_write)
const
156 assert(!blk || !blk->
isValid());
184 assert(bus_pkt->
isRead());
195 DPRINTF(
Cache,
"Block for addr %#llx being updated in Cache\n",
226 "Should only see read and writes at non-coherent cache\n");
235 panic_if(!from_cpu_side,
"Non-coherent cache received functional snoop"
248 bool from_core =
false;
249 bool from_pref =
false;
252 for (
auto &target: targets) {
253 Packet *tgt_pkt = target.pkt;
255 switch (target.source) {
262 Tick completion_time;
272 if (transfer_offset < 0) {
284 completion_time - target.recvTime;
310 panic(
"Illegal target->source enum %d\n", target.source);
314 if (blk && !from_core && from_pref) {
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,...
Definitions of a simple cache block class.
virtual void functionalAccess(PacketPtr pkt, bool from_cpu_side)
Performs the access specified by the request.
virtual void recvTimingReq(PacketPtr pkt)
Performs the access specified by the request.
void invalidateBlock(CacheBlk *blk)
Invalidate a cache block.
const bool writebackClean
Determine if clean lines should be written back or not.
virtual void handleTimingReqMiss(PacketPtr pkt, CacheBlk *blk, Tick forward_time, Tick request_time)=0
bool allocOnFill(MemCmd cmd) const
Determine whether we should allocate on a fill or not.
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...
gem5::BaseCache::CacheStats stats
MSHRQueue mshrQueue
Miss status registers.
const unsigned blkSize
Block size of this cache.
const Cycles responseLatency
The latency of sending reponse to its upper level cache/core on a linefill.
virtual Tick recvAtomic(PacketPtr pkt)
Performs the access specified by the request.
virtual void recvTimingResp(PacketPtr pkt)
Handles a response (cache line fill/write ack) from the bus.
virtual bool access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat, PacketList &writebacks)
Does all the processing necessary to perform the provided request.
void allocateWriteBuffer(PacketPtr pkt, Tick time)
CacheBlk * handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks, bool allocate)
Handle a fill operation caused by a received packet.
PacketPtr writebackBlk(CacheBlk *blk)
Create a writeback request for the given block.
void maintainClusivity(bool from_cache, CacheBlk *blk)
Maintain the clusivity of this cache by potentially invalidating a block.
System * system
System we are currently operating in.
@ WritableBit
write permission
@ DirtyBit
dirty (modified)
void setPrefetched()
Marks this blocks as a recently prefetched block.
bool isSet(unsigned bits) const
Checks the given coherence bits are set.
void setCoherenceBits(unsigned bits)
Sets the corresponding coherence bits.
virtual bool isValid() const
Checks if the entry is valid.
A coherent cache that can be arranged in flexible topologies.
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...
Cycles ticksToCycles(Tick t) const
Cycles is a wrapper class for representing cycle counts, i.e.
Miss Status and handling Register.
TargetList extractServiceableTargets(PacketPtr pkt)
Extracts the subset of the targets that can be serviced given a received response.
int getNumTargets() const
Returns the current number of allocated targets.
QueueEntry::Target * getTarget() override
Returns a reference to the first target.
NoncoherentCache(const NoncoherentCacheParams &p)
void doWritebacksAtomic(PacketList &writebacks) override
Send writebacks down the memory hierarchy in atomic mode.
PacketPtr evictBlock(CacheBlk *blk) override
Evict a cache block.
void functionalAccess(PacketPtr pkt, bool from_cpu_side) override
Performs the access specified by the request.
bool access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat, PacketList &writebacks) override
Does all the processing necessary to perform the provided request.
void recvTimingReq(PacketPtr pkt) override
Performs the access specified by the request.
PacketPtr createMissPacket(PacketPtr cpu_pkt, CacheBlk *blk, bool needs_writable, bool is_whole_line_write) const override
Create an appropriate downstream bus request packet.
void doWritebacks(PacketList &writebacks, Tick forward_time) override
Insert writebacks into the write buffer.
void handleTimingReqMiss(PacketPtr pkt, CacheBlk *blk, Tick forward_time, Tick request_time) override
void satisfyRequest(PacketPtr pkt, CacheBlk *blk, bool deferred_response=false, bool pending_downgrade=false) override
Perform any necessary updates to the block and perform any data exchange between the packet and the b...
Tick recvAtomic(PacketPtr pkt) override
Performs the access specified by the request.
Cycles handleAtomicReqMiss(PacketPtr pkt, CacheBlk *&blk, PacketList &writebacks) override
Handle a request in atomic mode that missed in this cache.
void serviceMSHRTargets(MSHR *mshr, const PacketPtr pkt, CacheBlk *blk) override
Service non-deferred MSHR targets using the received response.
void recvTimingResp(PacketPtr pkt) override
Handles a response (cache line fill/write ack) from the bus.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
void makeTimingResponse()
void print(std::ostream &o, int verbosity=0, const std::string &prefix="") const
void copyError(Packet *pkt)
bool needsResponse() const
uint32_t payloadDelay
The extra pipelining delay from seeing the packet until the end of payload is transmitted by the comp...
uint32_t headerDelay
The extra delay from seeing the packet until the header is transmitted.
Addr getOffset(unsigned int blk_size) const
Addr getBlockAddr(unsigned int blk_size) const
RequestPtr req
A pointer to the original request.
bool cacheResponding() const
void makeAtomicResponse()
MemCmd cmd
The command field of the packet.
bool isInvalidate() const
bool isWholeLineWrite(unsigned blk_size)
void allocate()
Allocate memory for the packet.
PacketPtr pkt
Pending request packet.
Entry * findMatch(Addr blk_addr, bool is_secure, bool ignore_uncacheable=true) const
Find the first entry that matches the provided address.
void schedTimingResp(PacketPtr pkt, Tick when)
Schedule the sending of a timing response.
Tick sendAtomic(PacketPtr pkt)
Send an atomic request packet, where the data is moved and the state is updated in zero time,...
RequestorID maxRequestors()
Get the number of requestors registered in the system.
#define panic(...)
This implements a cprintf based panic() function.
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
Miss Status and Handling Register (MSHR) declaration.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
uint64_t Tick
Tick count type.
Specifies a non-coherent cache.
statistics::Vector missLatency
Total number of ticks per thread/command spent waiting for a miss.
CacheCmdStats & cmdStats(const PacketPtr p)