bi_mode.hh (10244:d2deb51a4abf) | bi_mode.hh (10785:f56c10663a01) |
---|---|
1/* 2 * Copyright (c) 2014 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 23 unchanged lines hidden (view full) --- 32 * Implementation of a bi-mode branch predictor 33 */ 34 35#ifndef __CPU_PRED_BI_MODE_PRED_HH__ 36#define __CPU_PRED_BI_MODE_PRED_HH__ 37 38#include "cpu/pred/bpred_unit.hh" 39#include "cpu/pred/sat_counter.hh" | 1/* 2 * Copyright (c) 2014 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 23 unchanged lines hidden (view full) --- 32 * Implementation of a bi-mode branch predictor 33 */ 34 35#ifndef __CPU_PRED_BI_MODE_PRED_HH__ 36#define __CPU_PRED_BI_MODE_PRED_HH__ 37 38#include "cpu/pred/bpred_unit.hh" 39#include "cpu/pred/sat_counter.hh" |
40#include "params/BiModeBP.hh" |
|
40 41/** 42 * Implements a bi-mode branch predictor. The bi-mode predictor is a two-level 43 * branch predictor that has three seprate history arrays: a taken array, a 44 * not-taken array, and a choice array. The taken/not-taken arrays are indexed 45 * by a hash of the PC and the global history. The choice array is indexed by 46 * the PC only. Because the taken/not-taken arrays use the same index, they must 47 * be the same size. 48 * 49 * The bi-mode branch predictor aims to eliminate the destructive aliasing that 50 * occurs when two branches of opposite biases share the same global history 51 * pattern. By separating the predictors into taken/not-taken arrays, and using 52 * the branch's PC to choose between the two, destructive aliasing is reduced. 53 */ 54 55class BiModeBP : public BPredUnit 56{ 57 public: | 41 42/** 43 * Implements a bi-mode branch predictor. The bi-mode predictor is a two-level 44 * branch predictor that has three seprate history arrays: a taken array, a 45 * not-taken array, and a choice array. The taken/not-taken arrays are indexed 46 * by a hash of the PC and the global history. The choice array is indexed by 47 * the PC only. Because the taken/not-taken arrays use the same index, they must 48 * be the same size. 49 * 50 * The bi-mode branch predictor aims to eliminate the destructive aliasing that 51 * occurs when two branches of opposite biases share the same global history 52 * pattern. By separating the predictors into taken/not-taken arrays, and using 53 * the branch's PC to choose between the two, destructive aliasing is reduced. 54 */ 55 56class BiModeBP : public BPredUnit 57{ 58 public: |
58 BiModeBP(const Params *params); 59 void uncondBranch(void * &bp_history); | 59 BiModeBP(const BiModeBPParams *params); 60 void uncondBranch(Addr pc, void * &bp_history); |
60 void squash(void *bp_history); 61 bool lookup(Addr branch_addr, void * &bp_history); 62 void btbUpdate(Addr branch_addr, void * &bp_history); 63 void update(Addr branch_addr, bool taken, void *bp_history, bool squashed); 64 void retireSquashed(void *bp_history); 65 66 private: 67 void updateGlobalHistReg(bool taken); --- 20 unchanged lines hidden (view full) --- 88 89 // choice predictors 90 std::vector<SatCounter> choiceCounters; 91 // taken direction predictors 92 std::vector<SatCounter> takenCounters; 93 // not-taken direction predictors 94 std::vector<SatCounter> notTakenCounters; 95 | 61 void squash(void *bp_history); 62 bool lookup(Addr branch_addr, void * &bp_history); 63 void btbUpdate(Addr branch_addr, void * &bp_history); 64 void update(Addr branch_addr, bool taken, void *bp_history, bool squashed); 65 void retireSquashed(void *bp_history); 66 67 private: 68 void updateGlobalHistReg(bool taken); --- 20 unchanged lines hidden (view full) --- 89 90 // choice predictors 91 std::vector<SatCounter> choiceCounters; 92 // taken direction predictors 93 std::vector<SatCounter> takenCounters; 94 // not-taken direction predictors 95 std::vector<SatCounter> notTakenCounters; 96 |
96 unsigned instShiftAmt; 97 | |
98 unsigned globalHistoryReg; 99 unsigned globalHistoryBits; 100 unsigned historyRegisterMask; 101 102 unsigned choicePredictorSize; 103 unsigned choiceCtrBits; 104 unsigned choiceHistoryMask; 105 unsigned globalPredictorSize; 106 unsigned globalCtrBits; 107 unsigned globalHistoryMask; 108 109 unsigned choiceThreshold; 110 unsigned takenThreshold; 111 unsigned notTakenThreshold; 112}; 113 114#endif // __CPU_PRED_BI_MODE_PRED_HH__ | 97 unsigned globalHistoryReg; 98 unsigned globalHistoryBits; 99 unsigned historyRegisterMask; 100 101 unsigned choicePredictorSize; 102 unsigned choiceCtrBits; 103 unsigned choiceHistoryMask; 104 unsigned globalPredictorSize; 105 unsigned globalCtrBits; 106 unsigned globalHistoryMask; 107 108 unsigned choiceThreshold; 109 unsigned takenThreshold; 110 unsigned notTakenThreshold; 111}; 112 113#endif // __CPU_PRED_BI_MODE_PRED_HH__ |