52 #ifndef __MEM_CACHE_CACHE_HH__
53 #define __MEM_CACHE_CACHE_HH__
55 #include <unordered_set>
58 #include "enums/Clusivity.hh"
63 #include "params/Cache.hh"
104 const std::string &_label);
126 const std::string &
label) :
146 DPRINTF(CachePort,
"Waiting for snoop response to be "
185 const std::string &_label);
341 return clusivity == Enums::mostly_incl ||
426 bool deferred_response =
false,
427 bool pending_downgrade =
false);
430 bool already_copied,
bool pending_inval);
445 bool is_timing,
bool is_deferred,
bool pending_inval);
494 bool needsWritable)
const;
537 Cache(
const CacheParams *
p);
629 #endif // __MEM_CACHE_CACHE_HH__
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
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.
bool isDirty() const
Check to see if a block has been written.
virtual void recvTimingSnoopReq(PacketPtr pkt)
Declares a basic cache interface BaseCache.
virtual void recvFunctional(PacketPtr pkt)
bool hasAddr(Addr addr) const
Check if a packets address exists in the queue.
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.
Cycles is a wrapper class for representing cycle counts, i.e.
CacheBlkVisitorWrapper(Cache &_cache, VisitorPtr _visitor)
bool isDirty() const
Does the array contain a dirty line?
void doWritebacksAtomic(PacketList &writebacks)
Send writebacks down the memory hierarchy in atomic mode.
void memWriteback() override
Write back dirty blocks in the cache using functional accesses.
void invalidateBlock(CacheBlk *blk)
Invalidate a cache block.
void functionalAccess(PacketPtr pkt, bool fromCpuSide)
Performs the access specified by the request.
void memInvalidate() override
Invalidates all blocks in the cache.
PacketPtr writebackBlk(CacheBlk *blk)
Create a writeback request for the given block.
CpuSidePort(const std::string &_name, Cache *_cache, const std::string &_label)
BasePrefetcher * prefetcher
Prefetcher.
virtual bool recvTimingReq(PacketPtr pkt)
Override the default behaviour of sendDeferredPacket to enable the memory-side cache port to also sen...
void schedSendEvent(Tick when)
Schedule a send event if we are not already waiting for a retry.
bool operator()(CacheBlk &blk) override
void writebackTempBlockAtomic()
Send the outstanding tempBlock writeback.
CacheReqPacketQueue _reqQueue
The cache-specific queue.
bool isCachedAbove(PacketPtr pkt, bool is_timing=true) const
Send up a snoop request and find cached copies.
virtual void sendDeferredPacket()
Override the normal sendDeferredPacket and do not only consider the transmit list (used for responses...
virtual AddrRangeList getAddrRanges() const
bool invalidateVisitor(CacheBlk &blk)
Cache block visitor that invalidates all blocks in the cache.
bool sendMSHRQueuePacket(MSHR *mshr)
Take an MSHR, turn it into a suitable downstream packet, and send it out.
A template-policy based cache.
bool outstandingMisses() const
Return whether there are any outstanding misses.
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.
virtual Tick recvAtomic(PacketPtr pkt)
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.
CacheBlk * findBlock(Addr addr, bool is_secure) const
The memory-side port extends the base cache master port with access functions for functional...
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.
SnoopRespPacketQueue _snoopRespQueue
Miss Status and handling Register.
void unserialize(CheckpointIn &cp) override
Unserialize an object.
Tick deferredPacketReadyTime() const
Get the next packet ready time.
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...
CacheBlk * handleFill(PacketPtr pkt, CacheBlk *blk, PacketList &writebacks, bool allocate)
Populates a cache block and handles all outstanding requests for the satisfied fill request...
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.
virtual void recvFunctionalSnoop(PacketPtr pkt)
virtual bool recvTimingSnoopResp(PacketPtr pkt)
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.
virtual ~Cache()
Non-default destructor is needed to deallocate memory.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
bool(Cache::* VisitorPtr)(CacheBlk &blk)
void recvTimingSnoopReq(PacketPtr pkt)
Snoops bus transactions to maintain coherence.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
void recvTimingSnoopResp(PacketPtr pkt)
Handle a snoop response.
bool inMissQueue(Addr addr, bool is_secure) const override
void cmpAndSwap(CacheBlk *blk, PacketPtr pkt)
Handle doing the Compare and Swap function for SPARC.
virtual bool recvTimingResp(PacketPtr pkt)
A queue entry base class, to be used by both the MSHRs and write-queue entries.
bool access(PacketPtr pkt, CacheBlk *&blk, Cycles &lat, PacketList &writebacks)
Does all the processing necessary to perform the provided request.
Tick nextQueueReadyTime() const
Find next request ready time from among possible sources.
CacheReqPacketQueue(Cache &cache, MasterPort &port, SnoopRespPacketQueue &snoop_resp_queue, const std::string &label)
A cache slave port is used for the CPU-side port of the cache, and it is basically a simple timing po...
std::ostream CheckpointOut
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)
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.
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)...
const bool doFastWrites
This cache should allocate a block on a line-sized write miss.
SnoopRespPacketQueue & snoopRespQueue
bool checkConflictingSnoop(Addr addr)
Check if there is a conflicting snoop response about to be send out, and if so simply stall any reque...
bool isDirty() const override
Determine if there are any dirty blocks in the cache.
bool recvTimingReq(PacketPtr pkt)
Performs the access specified by the request.
bool operator()(CacheBlk &blk) override
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...
void regStats() override
Register stats for this object.
The CPU-side port extends the base cache slave port with access functions for functional, atomic and timing requests.
bool inCache(Addr addr, bool is_secure) const override
CacheBlk * tempBlock
Temporary cache block for occasional transitory use.
Base class for cache block visitor, operating on the cache block base class (later subclassed for the...
BaseTags * tags
Tag and data Storage.
Wrap a method and present it as a cache block visitor.
void maintainClusivity(bool from_cache, CacheBlk *blk)
Maintain the clusivity of this cache by potentially invalidating a block.
MSHRQueue mshrQueue
Miss status registers.
MemSidePort(const std::string &_name, Cache *_cache, const std::string &_label)
const std::string label
Label to use for print request packets label stack.
std::unique_ptr< Packet > pendingDelete
Upstream caches need this packet until true is returned, so hold it for deletion until a subsequent c...