Go to the documentation of this file.
31 #include "debug/HWPrefetch.hh"
33 #include "params/DCPTPrefetcher.hh"
34 #include "params/DeltaCorrelatingPredictionTables.hh"
39 const DeltaCorrelatingPredictionTablesParams &
p) :
SimObject(
p),
40 deltaBits(
p.delta_bits), deltaMaskBits(
p.delta_mask_bits),
41 table(
p.table_assoc,
p.table_entries,
p.table_indexing_policy,
42 p.table_replacement_policy,
DCPTEntry(
p.deltas_per_entry))
60 unsigned int delta_bits)
62 if ((address - lastAddress) != 0) {
63 Addr delta = address - lastAddress;
65 Addr max_positive_delta = (1 << (delta_bits-1)) - 1;
66 if (address > lastAddress) {
68 if (delta > max_positive_delta) {
73 if (lastAddress - address > (max_positive_delta + 1)) {
77 deltas.push_back(delta);
78 lastAddress = address;
86 assert(deltas.full());
89 const int delta_penultimate = *(deltas.end() - 2);
90 const int delta_last = *(deltas.end() - 1);
93 if (delta_last == 0 || delta_penultimate == 0) {
101 auto it = deltas.begin();
102 for (; it != (deltas.end() - 2); ++it) {
103 const int prev_delta_penultimate = *it;
104 const int prev_delta_last = *(it + 1);
105 if ((prev_delta_penultimate >>
mask) == (delta_penultimate >>
mask) &&
106 (prev_delta_last >>
mask) == (delta_last >>
mask)) {
111 while (it != deltas.end()) {
112 const int pf_delta = *(it++);
127 DPRINTF(HWPrefetch,
"Ignoring request with no PC.\n");
135 if (entry !=
nullptr) {
142 table.insertEntry(
pc,
false , entry);
void calculatePrefetch(const PrefetchInfo &pfi, std::vector< AddrPriority > &addresses) override
void getCandidates(std::vector< Queued::AddrPriority > &pfs, unsigned int mask_bits) const
Attempt to generate prefetch candidates using the two most recent deltas.
Addr getPC() const
Returns the program counter that generated this request.
DeltaCorrelatingPredictionTables & dcpt
DCPT object.
const unsigned int deltaBits
Number of bits of each delta.
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.
void flush()
Remove all the elements in the queue.
bool full() const
Is the queue full? A queue is full if the head is the 0^{th} element and the tail is the (size-1)^{th...
const unsigned int deltaMaskBits
Number of lower bits to ignore from the deltas.
void push_back(typename std::vector< T >::value_type val)
Pushes an element at the end of the queue.
AssociativeSet< DCPTEntry > table
The main table.
Copyright (c) 2018 Metempsy Technology Consulting All rights reserved.
void invalidate() override
Invalidate the block.
CircularQueue< Addr > deltas
Stored deltas.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Addr lastAddress
Last accessed address.
DCPT Table entry datatype.
void calculatePrefetch(const Base::PrefetchInfo &pfi, std::vector< Queued::AddrPriority > &addresses)
Computes the prefetch candidates given a prefetch event.
virtual void invalidate()
Invalidate the block.
Class containing the information needed by the prefetch to train and generate new prefetch requests.
DCPT(const DCPTPrefetcherParams &p)
Addr getAddr() const
Obtains the address value of this Prefetcher address.
bool hasPC() const
Returns true if the associated program counter is valid.
DeltaCorrelatingPredictionTables(const DeltaCorrelatingPredictionTablesParams &p)
Abstract superclass for simulation objects.
Generated on Tue Jun 22 2021 15:28:29 for gem5 by doxygen 1.8.17