31#include "debug/HWPrefetch.hh"
32#include "params/DCPTPrefetcher.hh"
33#include "params/DeltaCorrelatingPredictionTables.hh"
42 const DeltaCorrelatingPredictionTablesParams &
p) :
SimObject(
p),
44 table((
name() +
"DCPT").c_str(),
p.table_entries,
45 p.table_assoc,
p.table_replacement_policy,
46 p.table_indexing_policy,
66 unsigned int delta_bits)
71 Addr max_positive_delta = (1 << (delta_bits-1)) - 1;
74 if (delta > max_positive_delta) {
79 if (
lastAddress - address > (max_positive_delta + 1)) {
95 const int delta_penultimate = *(
deltas.end() - 2);
96 const int delta_last = *(
deltas.end() - 1);
99 if (delta_last == 0 || delta_penultimate == 0) {
108 for (; it != (
deltas.end() - 2); ++it) {
109 const int prev_delta_penultimate = *it;
110 const int prev_delta_last = *(it + 1);
111 if ((prev_delta_penultimate >>
mask) == (delta_penultimate >>
mask) &&
112 (prev_delta_last >>
mask) == (delta_last >>
mask)) {
117 while (it !=
deltas.end()) {
118 const int pf_delta = *(it++);
134 DPRINTF(HWPrefetch,
"Ignoring request with no PC.\n");
141 if (entry !=
nullptr) {
164 dcpt.calculatePrefetch(pfi, addresses, cache);
virtual void invalidate()
Invalidate the block.
virtual std::string name() const
Class containing the information needed by the prefetch to train and generate new prefetch requests.
Addr getPC() const
Returns the program counter that generated this request.
Addr getAddr() const
Obtains the address value of this Prefetcher address.
bool hasPC() const
Returns true if the associated program counter is valid.
DCPT(const DCPTPrefetcherParams &p)
DeltaCorrelatingPredictionTables & dcpt
DCPT object.
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses, const CacheAccessor &cache) override
DeltaCorrelatingPredictionTables(const DeltaCorrelatingPredictionTablesParams &p)
const unsigned int deltaBits
Number of bits of each delta.
AssociativeCache< DCPTEntry > table
The main table.
void calculatePrefetch(const Base::PrefetchInfo &pfi, std::vector< Queued::AddrPriority > &addresses, const CacheAccessor &cache)
Computes the prefetch candidates given a prefetch event.
const unsigned int deltaMaskBits
Number of lower bits to ignore from the deltas.
Queued(const QueuedPrefetcherParams &p)
std::pair< Addr, int32_t > AddrPriority
SimObject(const Params &p)
Copyright (c) 2024 Arm Limited All rights reserved.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
static constexpr auto genTagExtractor(BTBIndexingPolicy *ip)
This helper generates a tag extractor function object which will be typically used by Replaceable ent...
Provides generic cache lookup functions.
DCPT Table entry datatype.
CircularQueue< Addr > deltas
Stored deltas.
void addAddress(Addr address, unsigned int delta_num_bits)
Adds an address to the entry, if the entry already existed, a delta will be generated.
Addr lastAddress
Last accessed address.
void getCandidates(std::vector< Queued::AddrPriority > &pfs, unsigned int mask_bits) const
Attempt to generate prefetch candidates using the two most recent deltas.
void invalidate() override
Invalidate the block.