1 # Copyright (c) 2012 Mark D. Hill and David A. Wood
2 # Copyright (c) 2015 The University of Wisconsin
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;
9 # redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution;
12 # neither the name of the copyright holders nor the names of its
13 # contributors may be used to endorse or promote products derived from
14 # this software without specific prior written permission.
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 # Authors: Nilay Vaish and Dibakar Gope
30 from m5
.SimObject
import SimObject
31 from m5
.params
import *
33 class BranchPredictor(SimObject
):
34 type = 'BranchPredictor'
35 cxx_class
= 'BPredUnit'
36 cxx_header
= "cpu/pred/bpred_unit.hh"
39 numThreads
= Param
.Unsigned(1, "Number of threads")
40 BTBEntries
= Param
.Unsigned(4096, "Number of BTB entries")
41 BTBTagSize
= Param
.Unsigned(16, "Size of the BTB tags, in bits")
42 RASSize
= Param
.Unsigned(16, "RAS size")
43 instShiftAmt
= Param
.Unsigned(2, "Number of bits to shift instructions by")
45 useIndirect
= Param
.Bool(True, "Use indirect branch predictor")
46 indirectHashGHR
= Param
.Bool(True, "Hash branch predictor GHR")
47 indirectHashTargets
= Param
.Bool(True, "Hash path history targets")
48 indirectSets
= Param
.Unsigned(256, "Cache sets for indirect predictor")
49 indirectWays
= Param
.Unsigned(2, "Ways for indirect predictor")
50 indirectTagSize
= Param
.Unsigned(16, "Indirect target cache tag bits")
51 indirectPathLength
= Param
.Unsigned(3,
52 "Previous indirect targets to use for path history")
56 class LocalBP(BranchPredictor
):
59 cxx_header
= "cpu/pred/2bit_local.hh"
61 localPredictorSize
= Param
.Unsigned(2048, "Size of local predictor")
62 localCtrBits
= Param
.Unsigned(2, "Bits per counter")
65 class TournamentBP(BranchPredictor
):
67 cxx_class
= 'TournamentBP'
68 cxx_header
= "cpu/pred/tournament.hh"
70 localPredictorSize
= Param
.Unsigned(2048, "Size of local predictor")
71 localCtrBits
= Param
.Unsigned(2, "Bits per counter")
72 localHistoryTableSize
= Param
.Unsigned(2048, "size of local history table")
73 globalPredictorSize
= Param
.Unsigned(8192, "Size of global predictor")
74 globalCtrBits
= Param
.Unsigned(2, "Bits per counter")
75 choicePredictorSize
= Param
.Unsigned(8192, "Size of choice predictor")
76 choiceCtrBits
= Param
.Unsigned(2, "Bits of choice counters")
79 class BiModeBP(BranchPredictor
):
81 cxx_class
= 'BiModeBP'
82 cxx_header
= "cpu/pred/bi_mode.hh"
84 globalPredictorSize
= Param
.Unsigned(8192, "Size of global predictor")
85 globalCtrBits
= Param
.Unsigned(2, "Bits per counter")
86 choicePredictorSize
= Param
.Unsigned(8192, "Size of choice predictor")
87 choiceCtrBits
= Param
.Unsigned(2, "Bits of choice counters")
89 class LTAGE(BranchPredictor
):
92 cxx_header
= "cpu/pred/ltage.hh"
94 logSizeBiMP
= Param
.Unsigned(14, "Log size of Bimodal predictor in bits")
95 logSizeTagTables
= Param
.Unsigned(11, "Log size of tag table in LTAGE")
96 logSizeLoopPred
= Param
.Unsigned(8, "Log size of the loop predictor")
97 nHistoryTables
= Param
.Unsigned(12, "Number of history tables")
98 tagTableCounterBits
= Param
.Unsigned(3, "Number of tag table counter bits")
99 histBufferSize
= Param
.Unsigned(2097152,
100 "A large number to track all branch histories(2MEntries default)")
101 minHist
= Param
.Unsigned(4, "Minimum history size of LTAGE")
102 maxHist
= Param
.Unsigned(640, "Maximum history size of LTAGE")
103 minTagWidth
= Param
.Unsigned(7, "Minimum tag size in tag tables")