46#include "debug/Fetch.hh"
63 fatal(
"Invalid local predictor size!\n");
67 fatal(
"Invalid number of local predictor sets! Check localCtrBits.\n");
72 DPRINTF(Fetch,
"local predictor size: %i\n",
77 DPRINTF(Fetch,
"instruction shift amount: %i\n",
82 bool uncond,
void * &bpHistory)
102 DPRINTF(Fetch,
"Looking up index %#x\n",
103 local_predictor_idx);
105 uint8_t counter_val =
localCtrs[local_predictor_idx];
107 DPRINTF(Fetch,
"prediction is %i.\n",
119 assert(bp_history == NULL);
120 unsigned local_predictor_idx;
131 DPRINTF(Fetch,
"Looking up index %#x\n", local_predictor_idx);
134 DPRINTF(Fetch,
"Branch updated as taken.\n");
137 DPRINTF(Fetch,
"Branch updated as not taken.\n");
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
ConditionalPredictor(const Params ¶ms)
void branchPlaceholder(ThreadID tid, Addr pc, bool uncond, void *&bpHistory) override
Special function for the decoupled front-end.
const unsigned localPredictorSize
Size of the local predictor.
bool getPrediction(uint8_t &count)
Returns the taken/not taken prediction given the value of the counter.
void updateHistories(ThreadID tid, Addr pc, bool uncond, bool taken, Addr target, const StaticInstPtr &inst, void *&bp_history) override
Ones done with the prediction this function updates the path and global history.
const unsigned localCtrBits
Number of bits of the local predictor's counters.
const unsigned localPredictorSets
Number of sets.
void update(ThreadID tid, Addr pc, bool taken, void *&bp_history, bool squashed, const StaticInstPtr &inst, Addr target) override
Updates the BP with taken/not taken information.
LocalBP(const LocalBPParams ¶ms)
Default branch predictor constructor.
bool lookup(ThreadID tid, Addr pc, void *&bp_history) override
Looks up a given conditional branch PC of in the BP to see if it is taken or not taken.
const unsigned indexMask
Mask to get index bits.
std::vector< SatCounter8 > localCtrs
Array of counters that make up the local predictor.
unsigned getLocalIndex(Addr &PC)
Calculates the local index based on the PC.
static constexpr bool isPowerOf2(const T &n)
#define fatal(...)
This implements a cprintf based fatal() function.
GenericSatCounter< uint8_t > SatCounter8
const Params & params() const
Copyright (c) 2024 Arm Limited All rights reserved.
int16_t ThreadID
Thread index/ID type.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
RefCountingPtr< StaticInst > StaticInstPtr