summaryrefslogtreecommitdiff
path: root/src/cpu/pred/tournament.cc
diff options
context:
space:
mode:
authorAnthony Gutierrez <atgutier@umich.edu>2013-05-14 18:39:47 -0400
committerAnthony Gutierrez <atgutier@umich.edu>2013-05-14 18:39:47 -0400
commitd3c33d91b68e917478dba48c03a674b21ebd2747 (patch)
tree3e86a50e40dd96f1d7c48081d5b7a787c3d277c7 /src/cpu/pred/tournament.cc
parent4e52789c6db91cd292e2de933c7c797e24fa870f (diff)
downloadgem5-d3c33d91b68e917478dba48c03a674b21ebd2747.tar.xz
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.
Diffstat (limited to 'src/cpu/pred/tournament.cc')
-rw-r--r--src/cpu/pred/tournament.cc21
1 files changed, 14 insertions, 7 deletions
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);