summaryrefslogtreecommitdiff
path: root/src/cpu/pred/tournament.hh
diff options
context:
space:
mode:
authorErik Tomusk <E.Tomusk@sms.ed.ac.uk>2012-12-06 09:31:06 -0600
committerErik Tomusk <E.Tomusk@sms.ed.ac.uk>2012-12-06 09:31:06 -0600
commit3dc7e4f496ad3ddab3010f8e7fdfce683ffdbdfb (patch)
tree854164f75e2fd4cfafa88668025c02e2cfcdd115 /src/cpu/pred/tournament.hh
parent150e9b8c6875493c0b1a11391638b895d551e45f (diff)
downloadgem5-3dc7e4f496ad3ddab3010f8e7fdfce683ffdbdfb.tar.xz
TournamentBP: Fix some bugs with table sizes and counters
globalHistoryBits, globalPredictorSize, and choicePredictorSize are decoupled. globalHistoryBits controls how much history is kept, global and choice predictor sizes control how much of that history is used when accessing predictor tables. This way, global and choice predictors can actually be different sizes, and it is no longer possible to walk off the predictor arrays and cause a seg fault. There are now individual thresholds for choice, global, and local saturating counters, so that taken/not taken decisions are correct even when the predictors' counters' sizes are different. The interface for localPredictorSize has been removed from TournamentBP because the value can be calculated from localHistoryBits. Committed by: Nilay Vaish <nilay@cs.wisc.edu>
Diffstat (limited to 'src/cpu/pred/tournament.hh')
-rw-r--r--src/cpu/pred/tournament.hh46
1 files changed, 27 insertions, 19 deletions
diff --git a/src/cpu/pred/tournament.hh b/src/cpu/pred/tournament.hh
index f9df2a61d..35cfd8455 100644
--- a/src/cpu/pred/tournament.hh
+++ b/src/cpu/pred/tournament.hh
@@ -63,8 +63,7 @@ class TournamentBP
/**
* Default branch predictor constructor.
*/
- TournamentBP(unsigned localPredictorSize,
- unsigned localCtrBits,
+ TournamentBP(unsigned localCtrBits,
unsigned localHistoryTableSize,
unsigned localHistoryBits,
unsigned globalPredictorSize,
@@ -181,10 +180,10 @@ class TournamentBP
/** Local counters. */
std::vector<SatCounter> localCtrs;
- /** Size of the local predictor. */
+ /** Number of counters in the local predictor. */
unsigned localPredictorSize;
- /** Mask to get the proper index bits into the predictor. */
+ /** Mask to truncate values stored in the local history table. */
unsigned localPredictorMask;
/** Number of bits of the local predictor's counters. */
@@ -193,42 +192,49 @@ class TournamentBP
/** Array of local history table entries. */
std::vector<unsigned> localHistoryTable;
- /** Size of the local history table. */
+ /** Number of entries in the local history table. */
unsigned localHistoryTableSize;
- /** Number of bits for each entry of the local history table.
- * @todo Doesn't this come from the size of the local predictor?
- */
+ /** Number of bits for each entry of the local history table. */
unsigned localHistoryBits;
- /** Mask to get the proper local history. */
- unsigned localHistoryMask;
-
/** Array of counters that make up the global predictor. */
std::vector<SatCounter> globalCtrs;
- /** Size of the global predictor. */
+ /** Number of entries in the global predictor. */
unsigned globalPredictorSize;
/** Number of bits of the global predictor's counters. */
unsigned globalCtrBits;
- /** Global history register. */
+ /** Global history register. Contains as much history as specified by
+ * globalHistoryBits. Actual number of bits used is determined by
+ * globalHistoryMask and choiceHistoryMask. */
unsigned globalHistory;
- /** Number of bits for the global history. */
+ /** Number of bits for the global history. Determines maximum number of
+ entries in global and choice predictor tables. */
unsigned globalHistoryBits;
- /** Mask to get the proper global history. */
+ /** Mask to apply to globalHistory to access global history table.
+ * Based on globalPredictorSize.*/
unsigned globalHistoryMask;
+ /** Mask to apply to globalHistory to access choice history table.
+ * Based on choicePredictorSize.*/
+ unsigned choiceHistoryMask;
+
+ /** Mask to control how much history is stored. All of it might not be
+ * used. */
+ unsigned historyRegisterMask;
+
/** Array of counters that make up the choice predictor. */
std::vector<SatCounter> choiceCtrs;
- /** Size of the choice predictor (identical to the global predictor). */
+ /** Number of entries in the choice predictor. */
unsigned choicePredictorSize;
- /** Number of bits of the choice predictor's counters. */
+ /** Number of bits in the choice predictor's counters. */
unsigned choiceCtrBits;
/** Number of bits to shift the instruction over to get rid of the word
@@ -236,10 +242,12 @@ class TournamentBP
*/
unsigned instShiftAmt;
- /** Threshold for the counter value; above the threshold is taken,
+ /** Thresholds for the counter value; above the threshold is taken,
* equal to or below the threshold is not taken.
*/
- unsigned threshold;
+ unsigned localThreshold;
+ unsigned globalThreshold;
+ unsigned choiceThreshold;
};
#endif // __CPU_O3_TOURNAMENT_PRED_HH__