56 #include "params/BasePrefetcher.hh" 60 : address(addr),
pc(pkt->req->hasPC() ? pkt->req->getPC() : 0),
61 masterId(pkt->req->masterId()), validPC(pkt->req->hasPC()),
62 secure(pkt->isSecure()), size(pkt->req->getSize()), write(pkt->isWrite()),
63 paddress(pkt->req->getPaddr()), cacheMiss(miss)
65 unsigned int req_size = pkt->
req->getSize();
69 data =
new uint8_t[req_size];
86 parent.notifyFill(pkt);
88 parent.probeNotify(pkt, miss);
121 .
desc(
"number of hwpf issued")
129 bool fetch = pkt->
req->isInstFetch();
130 bool read = pkt->
isRead();
133 if (pkt->
req->isUncacheable())
return false;
134 if (fetch && !
onInst)
return false;
135 if (!fetch && !
onData)
return false;
136 if (!fetch && read && !
onRead)
return false;
137 if (!fetch && !read && !
onWrite)
return false;
138 if (!fetch && !read && inv)
return false;
199 return page + (blockIndex <<
lBlkSize);
208 if (pkt->
req->isCacheMaintenance())
return;
210 if (!pkt->
req->hasPaddr()) {
211 panic(
"Request must have a physical address");
261 fatal_if(
tlb !=
nullptr,
"Only one TLB can be registered");
#define panic(...)
This implements a cprintf based panic() function.
BasePrefetcher(const BasePrefetcherParams *p)
Declares a basic cache interface BaseCache.
const bool onWrite
Consult prefetcher on reads?
const bool onInst
Consult prefetcher on instruction accesses?
Addr pageIthBlockAddress(Addr page, uint32_t i) const
Build the address of the i-th block inside the page.
Addr blockIndex(Addr a) const
Determine the address of a at block granularity.
bool inCache(Addr addr, bool is_secure) const
Determine if address is in cache.
std::vector< PrefetchListener * > listeners
bool isSWPrefetch() const
BaseCache * cache
Pointr to the parent cache.
uint64_t usefulPrefetches
Total prefetches that has been useful.
const bool onMiss
Only consult prefetcher on cache misses?
virtual void regStats()
Callback to set stat parameters.
ProbeManager is a conduit class that lives on each SimObject, and is used to match up probe listeners...
bool coalesce() const
Checks if the cache is coalescing writes.
virtual void notify(const PacketPtr &pkt, const PrefetchInfo &pfi)=0
Notify prefetcher of cache access (may be any access or just misses, depending on cache parameters...
const bool prefetchOnAccess
Prefetch on every access, not just misses.
unsigned lBlkSize
log_2(block size of the parent cache).
BaseTLB * tlb
Registered tlb for address translations.
bool isInvalidate() const
void addTLB(BaseTLB *tlb)
Add a BaseTLB object to be used whenever a translation is needed.
RequestPtr req
A pointer to the original request.
uint64_t issuedPrefetches
Total prefetches issued.
void addEventProbe(SimObject *obj, const char *name)
Add a SimObject and a probe name to listen events from.
Class containing the information needed by the prefetch to train and generate new prefetch requests...
MasterID masterId
The requestor ID that generated this address.
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
bool validPC
Validity bit for the PC of this address.
bool cacheMiss
Whether this event comes from a cache miss.
void regStats() override
Register local statistics.
const bool onRead
Consult prefetcher on reads?
void notify(const PacketPtr &pkt) override
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
T roundDown(const T &val, const U &align)
This function is used to align addresses in memory.
bool secure
Whether this address targets the secure memory space.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
virtual const std::string name() const
bool write
Whether this event comes from a write request.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Addr pageOffset(Addr a) const
Determine the page-offset of a.
bool observeAccess(const PacketPtr &pkt, bool miss) const
Determine if this access should be observed.
Derived & name(const std::string &name)
Set the name and marks this stat to print at the end of simulation.
int floorLog2(unsigned x)
Addr pageAddress(Addr a) const
Determine the address of the page in which a lays.
PrefetchInfo(PacketPtr pkt, Addr addr, bool miss)
Constructs a PrefetchInfo using a PacketPtr.
Addr pc
The program counter that generated this address.
bool inMissQueue(Addr addr, bool is_secure) const
Determine if address is in cache miss queue.
const bool useVirtualAddresses
Use Virtual Addresses for prefetching.
unsigned int size
Size in bytes of the request triggering this event.
MemCmd cmd
The command field of the packet.
bool inMissQueue(Addr addr, bool is_secure) const
Addr address
The address used to train and generate prefetches.
ProbeManager * getProbeManager()
Get the probe manager for this object.
virtual void setCache(BaseCache *_cache)
bool samePage(Addr a, Addr b) const
Determine if addresses are on the same page.
const T * getConstPtr() const
unsigned getBlockSize() const
Query block size of a cache.
bool inCache(Addr addr, bool is_secure) const
Addr blockAddress(Addr a) const
Determine the address of the block in which a lays.
Derived & desc(const std::string &_desc)
Set the description and marks this stat to print at the end of simulation.
const bool onData
Consult prefetcher on data accesses?
unsigned blkSize
The block size of the parent cache.
Addr paddress
Physical address, needed because address can be virtual.
Miss and writeback queue declarations.
void regProbeListeners() override
Register probe points for this object.
uint8_t * data
Pointer to the associated request data.
bool hasBeenPrefetched(Addr addr, bool is_secure) const
bool hasBeenPrefetched(Addr addr, bool is_secure) const
Abstract superclass for simulation objects.
void probeNotify(const PacketPtr &pkt, bool miss)
Process a notification event from the ProbeListener.
MasterID getMasterId() const
Gets the requestor ID that generated this address.