From: Anthony Gutierrez Date: Tue, 14 May 2013 22:39:47 +0000 (-0400) Subject: cpu: remove local/globalHistoryBits params from branch pred X-Git-Tag: stable_2013_10_14~113 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=d3c33d91b68e917478dba48c03a674b21ebd2747;p=gem5.git cpu: remove local/globalHistoryBits params from branch pred having separate params for the local/globalHistoryBits and the local/globalPredictorSize can lead to inconsistencies if they are not carefully set. this patch dervies the number of bits necessary to index into the local/global predictors based on their size. the value of the localHistoryTableSize for the ARM O3 CPU has been increased to 1024 from 64, which is more accurate for an A15 based on some correlation against A15 hardware. --- diff --git a/configs/common/O3_ARM_v7a.py b/configs/common/O3_ARM_v7a.py index c85ba2c6c..f5cd3bbc8 100644 --- a/configs/common/O3_ARM_v7a.py +++ b/configs/common/O3_ARM_v7a.py @@ -90,12 +90,11 @@ class O3_ARM_v7a_FUP(FUPool): # Tournament Branch Predictor class O3_ARM_v7a_BP(BranchPredictor): predType = "tournament" + localPredictorSize = 2048 localCtrBits = 2 - localHistoryTableSize = 64 - localHistoryBits = 6 + localHistoryTableSize = 1024 globalPredictorSize = 8192 globalCtrBits = 2 - globalHistoryBits = 13 choicePredictorSize = 8192 choiceCtrBits = 2 BTBEntries = 2048 diff --git a/src/cpu/pred/BranchPredictor.py b/src/cpu/pred/BranchPredictor.py index 21001b360..07fc840b8 100644 --- a/src/cpu/pred/BranchPredictor.py +++ b/src/cpu/pred/BranchPredictor.py @@ -40,10 +40,8 @@ class BranchPredictor(SimObject): localPredictorSize = Param.Unsigned(2048, "Size of local predictor") localCtrBits = Param.Unsigned(2, "Bits per counter") localHistoryTableSize = Param.Unsigned(2048, "Size of local history table") - localHistoryBits = Param.Unsigned(11, "Bits for the local history") globalPredictorSize = Param.Unsigned(8192, "Size of global predictor") globalCtrBits = Param.Unsigned(2, "Bits per counter") - globalHistoryBits = Param.Unsigned(13, "Bits of history") choicePredictorSize = Param.Unsigned(8192, "Size of choice predictor") choiceCtrBits = Param.Unsigned(2, "Bits of choice counters") diff --git a/src/cpu/pred/tournament.cc b/src/cpu/pred/tournament.cc index 52a05960f..e471d08f5 100644 --- a/src/cpu/pred/tournament.cc +++ b/src/cpu/pred/tournament.cc @@ -46,17 +46,28 @@ TournamentBP::TournamentBP(const Params *params) : BPredUnit(params), + localPredictorSize(params->localPredictorSize), localCtrBits(params->localCtrBits), localHistoryTableSize(params->localHistoryTableSize), - localHistoryBits(params->localHistoryBits), + localHistoryBits(ceilLog2(params->localPredictorSize)), globalPredictorSize(params->globalPredictorSize), globalCtrBits(params->globalCtrBits), - globalHistoryBits(params->globalHistoryBits), + globalHistoryBits( + ceilLog2(params->globalPredictorSize) > + ceilLog2(params->choicePredictorSize) ? + ceilLog2(params->globalPredictorSize) : + ceilLog2(params->choicePredictorSize)), choicePredictorSize(params->choicePredictorSize), choiceCtrBits(params->choiceCtrBits), instShiftAmt(params->instShiftAmt) { - localPredictorSize = ULL(1) << localHistoryBits; + if (!isPowerOf2(localPredictorSize)) { + fatal("Invalid local predictor size!\n"); + } + + if (!isPowerOf2(globalPredictorSize)) { + fatal("Invalid global predictor size!\n"); + } //Set up the array of counters for the local predictor localCtrs.resize(localPredictorSize); @@ -76,10 +87,6 @@ TournamentBP::TournamentBP(const Params *params) for (int i = 0; i < localHistoryTableSize; ++i) localHistoryTable[i] = 0; - if (!isPowerOf2(globalPredictorSize)) { - fatal("Invalid global predictor size!\n"); - } - //Setup the array of counters for the global predictor globalCtrs.resize(globalPredictorSize);