Go to the documentation of this file.
48 localPredictorSize(params->localPredictorSize),
49 localCtrBits(params->localCtrBits),
50 localCtrs(localPredictorSize,
SatCounter(localCtrBits)),
51 localHistoryTableSize(params->localHistoryTableSize),
52 localHistoryBits(
ceilLog2(params->localPredictorSize)),
53 globalPredictorSize(params->globalPredictorSize),
54 globalCtrBits(params->globalCtrBits),
55 globalCtrs(globalPredictorSize,
SatCounter(globalCtrBits)),
56 globalHistory(params->numThreads, 0),
58 ceilLog2(params->globalPredictorSize) >
59 ceilLog2(params->choicePredictorSize) ?
60 ceilLog2(params->globalPredictorSize) :
61 ceilLog2(params->choicePredictorSize)),
62 choicePredictorSize(params->choicePredictorSize),
63 choiceCtrBits(params->choiceCtrBits),
64 choiceCtrs(choicePredictorSize,
SatCounter(choiceCtrBits))
67 fatal(
"Invalid local predictor size!\n");
71 fatal(
"Invalid global predictor size!\n");
77 fatal(
"Invalid local history table size!\n");
91 fatal(
"Invalid choice predictor size!\n");
103 fatal(
"Global predictor too large for global history bits!\n");
106 fatal(
"Choice predictor too large for global history bits!\n");
111 inform(
"More global history bits than required by predictors\n");
176 bool local_prediction;
177 unsigned local_history_idx;
178 unsigned local_predictor_idx;
180 bool global_prediction;
181 bool choice_prediction;
205 bp_history = (
void *)history;
211 if (choice_prediction) {
212 if (global_prediction) {
222 if (local_prediction) {
245 bp_history =
static_cast<void *
>(history);
252 void *bp_history,
bool squashed,
276 if (old_local_pred_valid) {
292 old_local_pred_valid)
297 unsigned choice_predictor_idx =
311 unsigned global_predictor_idx =
315 if (old_local_pred_valid) {
320 if (old_local_pred_valid) {
347 TournamentBPParams::create()
354 TournamentBP::BPHistory::newCount = 0;
#define fatal(...)
This implements a cprintf based fatal() function.
unsigned choicePredictorSize
Number of entries in the choice predictor.
unsigned globalHistoryMask
Mask to apply to globalHistory to access global history table.
static const int invalidPredictorIndex
Flag for invalid predictor index.
void updateLocalHistTaken(unsigned local_history_idx)
Updates local histories as taken.
unsigned localThreshold
Thresholds for the counter value; above the threshold is taken, equal to or below the threshold is no...
unsigned localPredictorMask
Mask to truncate values stored in the local history table.
int16_t ThreadID
Thread index/ID type.
std::vector< unsigned > localHistoryTable
Array of local history table entries.
unsigned localCtrBits
Number of bits of the local predictor's counters.
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.
TournamentBP(const TournamentBPParams *params)
Default branch predictor constructor.
void squash(ThreadID tid, void *bp_history)
Restores the global branch history on a squash.
void updateGlobalHistTaken(ThreadID tid)
Updates global history as taken.
unsigned localHistoryBits
Number of bits for each entry of the local history table.
const unsigned instShiftAmt
Number of bits to shift instructions by for predictor addresses.
unsigned choiceCtrBits
Number of bits in the choice predictor's counters.
The branch history information that is created upon predicting a branch.
std::vector< unsigned > globalHistory
Global history register.
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...
std::vector< SatCounter > localCtrs
Local counters.
void updateLocalHistNotTaken(unsigned local_history_idx)
Updates local histories as not taken.
unsigned historyRegisterMask
Mask to control how much history is stored.
unsigned calcLocHistIdx(Addr &branch_addr)
Returns the local history index, given a branch address.
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.
void updateGlobalHistNotTaken(ThreadID tid)
Updates global history as not taken.
unsigned localHistoryTableSize
Number of entries in the local history table.
Implements an n bit saturating counter and provides methods to increment, decrement,...
unsigned localPredictorSize
Number of counters in the local predictor.
unsigned globalPredictorSize
Number of entries in the global predictor.
std::vector< SatCounter > choiceCtrs
Array of counters that make up the choice predictor.
Implements a tournament branch predictor, hopefully identical to the one used in the 21264.
void uncondBranch(ThreadID tid, Addr pc, void *&bp_history)
Records that there was an unconditional branch, and modifies the bp history to point to an object tha...
std::vector< SatCounter > globalCtrs
Array of counters that make up the global predictor.
unsigned globalHistoryBits
Number of bits for the global history.
bool isPowerOf2(const T &n)
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.
#define ULL(N)
uint64_t constant
unsigned globalCtrBits
Number of bits of the global predictor's counters.
unsigned choiceHistoryMask
Mask to apply to globalHistory to access choice history table.
Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17