Go to the documentation of this file.
34 #include "debug/Fetch.hh"
38 localPredictorSize(params->localPredictorSize),
39 localCtrBits(params->localCtrBits),
40 localPredictorSets(localPredictorSize / localCtrBits),
41 localCtrs(localPredictorSets,
SatCounter(localCtrBits)),
42 indexMask(localPredictorSets - 1)
45 fatal(
"Invalid local predictor size!\n");
49 fatal(
"Invalid number of local predictor sets! Check localCtrBits.\n");
54 DPRINTF(Fetch,
"local predictor size: %i\n",
59 DPRINTF(Fetch,
"instruction shift amount: %i\n",
77 DPRINTF(Fetch,
"Looking up index %#x\n",
80 uint8_t counter_val =
localCtrs[local_predictor_idx];
82 DPRINTF(Fetch,
"prediction is %i.\n",
94 assert(bp_history == NULL);
95 unsigned local_predictor_idx;
106 DPRINTF(Fetch,
"Looking up index %#x\n", local_predictor_idx);
109 DPRINTF(Fetch,
"Branch updated as taken.\n");
112 DPRINTF(Fetch,
"Branch updated as not taken.\n");
138 LocalBPParams::create()
#define fatal(...)
This implements a cprintf based fatal() function.
virtual void uncondBranch(ThreadID tid, Addr pc, void *&bp_history)
int16_t ThreadID
Thread index/ID type.
std::vector< SatCounter > localCtrs
Array of counters that make up the local predictor.
void update(ThreadID tid, Addr branch_addr, bool taken, void *bp_history, bool squashed, const StaticInstPtr &inst, Addr corrTarget)
Updates the branch predictor with the actual result of a branch.
const unsigned indexMask
Mask to get index bits.
const unsigned localPredictorSize
Size of the local predictor.
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
void btbUpdate(ThreadID tid, Addr branch_addr, void *&bp_history)
Updates the branch predictor to Not Taken if a BTB entry is invalid or not found.
Basically a wrapper class to hold both the branch predictor and the BTB.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
unsigned getLocalIndex(Addr &PC)
Calculates the local index based on the PC.
bool getPrediction(uint8_t &count)
Returns the taken/not taken prediction given the value of the counter.
Implements an n bit saturating counter and provides methods to increment, decrement,...
const unsigned localPredictorSets
Number of sets.
const unsigned localCtrBits
Number of bits of the local predictor's counters.
Implements a local predictor that uses the PC to index into a table of counters.
LocalBP(const LocalBPParams *params)
Default branch predictor constructor.
bool isPowerOf2(const T &n)
bool lookup(ThreadID tid, Addr branch_addr, void *&bp_history)
Looks up the given address in the branch predictor and returns a true/false value as to whether it is...
Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17