tournament.hh (10330:f54586c894e3) | tournament.hh (10785:f56c10663a01) |
---|---|
1/* 2 * Copyright (c) 2011, 2014 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 36 unchanged lines hidden (view full) --- 45#ifndef __CPU_PRED_TOURNAMENT_PRED_HH__ 46#define __CPU_PRED_TOURNAMENT_PRED_HH__ 47 48#include <vector> 49 50#include "base/types.hh" 51#include "cpu/pred/bpred_unit.hh" 52#include "cpu/pred/sat_counter.hh" | 1/* 2 * Copyright (c) 2011, 2014 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 36 unchanged lines hidden (view full) --- 45#ifndef __CPU_PRED_TOURNAMENT_PRED_HH__ 46#define __CPU_PRED_TOURNAMENT_PRED_HH__ 47 48#include <vector> 49 50#include "base/types.hh" 51#include "cpu/pred/bpred_unit.hh" 52#include "cpu/pred/sat_counter.hh" |
53#include "params/TournamentBP.hh" |
|
53 54/** 55 * Implements a tournament branch predictor, hopefully identical to the one 56 * used in the 21264. It has a local predictor, which uses a local history 57 * table to index into a table of counters, and a global predictor, which 58 * uses a global history to index into a table of counters. A choice 59 * predictor chooses between the two. Only the global history register 60 * is speculatively updated, the rest are updated upon branches committing 61 * or misspeculating. 62 */ 63class TournamentBP : public BPredUnit 64{ 65 public: 66 /** 67 * Default branch predictor constructor. 68 */ | 54 55/** 56 * Implements a tournament branch predictor, hopefully identical to the one 57 * used in the 21264. It has a local predictor, which uses a local history 58 * table to index into a table of counters, and a global predictor, which 59 * uses a global history to index into a table of counters. A choice 60 * predictor chooses between the two. Only the global history register 61 * is speculatively updated, the rest are updated upon branches committing 62 * or misspeculating. 63 */ 64class TournamentBP : public BPredUnit 65{ 66 public: 67 /** 68 * Default branch predictor constructor. 69 */ |
69 TournamentBP(const Params *params); | 70 TournamentBP(const TournamentBPParams *params); |
70 71 /** 72 * Looks up the given address in the branch predictor and returns 73 * a true/false value as to whether it is taken. Also creates a 74 * BPHistory object to store any state it will need on squash/update. 75 * @param branch_addr The address of the branch to look up. 76 * @param bp_history Pointer that will be set to the BPHistory object. 77 * @return Whether or not the branch is taken. 78 */ 79 bool lookup(Addr branch_addr, void * &bp_history); 80 81 /** 82 * Records that there was an unconditional branch, and modifies 83 * the bp history to point to an object that has the previous 84 * global history stored in it. 85 * @param bp_history Pointer that will be set to the BPHistory object. 86 */ | 71 72 /** 73 * Looks up the given address in the branch predictor and returns 74 * a true/false value as to whether it is taken. Also creates a 75 * BPHistory object to store any state it will need on squash/update. 76 * @param branch_addr The address of the branch to look up. 77 * @param bp_history Pointer that will be set to the BPHistory object. 78 * @return Whether or not the branch is taken. 79 */ 80 bool lookup(Addr branch_addr, void * &bp_history); 81 82 /** 83 * Records that there was an unconditional branch, and modifies 84 * the bp history to point to an object that has the previous 85 * global history stored in it. 86 * @param bp_history Pointer that will be set to the BPHistory object. 87 */ |
87 void uncondBranch(void * &bp_history); | 88 void uncondBranch(Addr pc, void * &bp_history); |
88 /** 89 * Updates the branch predictor to Not Taken if a BTB entry is 90 * invalid or not found. 91 * @param branch_addr The address of the branch to look up. 92 * @param bp_history Pointer to any bp history state. 93 * @return Whether or not the branch is taken. 94 */ 95 void btbUpdate(Addr branch_addr, void * &bp_history); --- 133 unchanged lines hidden (view full) --- 229 std::vector<SatCounter> choiceCtrs; 230 231 /** Number of entries in the choice predictor. */ 232 unsigned choicePredictorSize; 233 234 /** Number of bits in the choice predictor's counters. */ 235 unsigned choiceCtrBits; 236 | 89 /** 90 * Updates the branch predictor to Not Taken if a BTB entry is 91 * invalid or not found. 92 * @param branch_addr The address of the branch to look up. 93 * @param bp_history Pointer to any bp history state. 94 * @return Whether or not the branch is taken. 95 */ 96 void btbUpdate(Addr branch_addr, void * &bp_history); --- 133 unchanged lines hidden (view full) --- 230 std::vector<SatCounter> choiceCtrs; 231 232 /** Number of entries in the choice predictor. */ 233 unsigned choicePredictorSize; 234 235 /** Number of bits in the choice predictor's counters. */ 236 unsigned choiceCtrBits; 237 |
237 /** Number of bits to shift the instruction over to get rid of the word 238 * offset. 239 */ 240 unsigned instShiftAmt; 241 | |
242 /** Thresholds for the counter value; above the threshold is taken, 243 * equal to or below the threshold is not taken. 244 */ 245 unsigned localThreshold; 246 unsigned globalThreshold; 247 unsigned choiceThreshold; 248}; 249 250#endif // __CPU_PRED_TOURNAMENT_PRED_HH__ | 238 /** Thresholds for the counter value; above the threshold is taken, 239 * equal to or below the threshold is not taken. 240 */ 241 unsigned localThreshold; 242 unsigned globalThreshold; 243 unsigned choiceThreshold; 244}; 245 246#endif // __CPU_PRED_TOURNAMENT_PRED_HH__ |