BranchPredictor.py (13810:f50e3b82df73) BranchPredictor.py (13957:25e9c77a8a99)
1# Copyright (c) 2012 Mark D. Hill and David A. Wood
2# Copyright (c) 2015 The University of Wisconsin
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;

--- 17 unchanged lines hidden (view full) ---

26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28# Authors: Nilay Vaish and Dibakar Gope
29
30from m5.SimObject import SimObject
31from m5.params import *
32from m5.proxy import *
33
1# Copyright (c) 2012 Mark D. Hill and David A. Wood
2# Copyright (c) 2015 The University of Wisconsin
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;

--- 17 unchanged lines hidden (view full) ---

26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28# Authors: Nilay Vaish and Dibakar Gope
29
30from m5.SimObject import SimObject
31from m5.params import *
32from m5.proxy import *
33
34class BranchPredictor(SimObject):
35 type = 'BranchPredictor'
36 cxx_class = 'BPredUnit'
37 cxx_header = "cpu/pred/bpred_unit.hh"
34class IndirectPredictor(SimObject):
35 type = 'IndirectPredictor'
36 cxx_class = 'IndirectPredictor'
37 cxx_header = "cpu/pred/indirect.hh"
38 abstract = True
39
40 numThreads = Param.Unsigned(Parent.numThreads, "Number of threads")
38 abstract = True
39
40 numThreads = Param.Unsigned(Parent.numThreads, "Number of threads")
41 BTBEntries = Param.Unsigned(4096, "Number of BTB entries")
42 BTBTagSize = Param.Unsigned(16, "Size of the BTB tags, in bits")
43 RASSize = Param.Unsigned(16, "RAS size")
44 instShiftAmt = Param.Unsigned(2, "Number of bits to shift instructions by")
45
41
46 useIndirect = Param.Bool(True, "Use indirect branch predictor")
42class SimpleIndirectPredictor(IndirectPredictor):
43 type = 'SimpleIndirectPredictor'
44 cxx_class = 'SimpleIndirectPredictor'
45 cxx_header = "cpu/pred/simple_indirect.hh"
46
47 indirectHashGHR = Param.Bool(True, "Hash branch predictor GHR")
48 indirectHashTargets = Param.Bool(True, "Hash path history targets")
49 indirectSets = Param.Unsigned(256, "Cache sets for indirect predictor")
50 indirectWays = Param.Unsigned(2, "Ways for indirect predictor")
51 indirectTagSize = Param.Unsigned(16, "Indirect target cache tag bits")
52 indirectPathLength = Param.Unsigned(3,
53 "Previous indirect targets to use for path history")
54 indirectGHRBits = Param.Unsigned(13, "Indirect GHR number of bits")
47 indirectHashGHR = Param.Bool(True, "Hash branch predictor GHR")
48 indirectHashTargets = Param.Bool(True, "Hash path history targets")
49 indirectSets = Param.Unsigned(256, "Cache sets for indirect predictor")
50 indirectWays = Param.Unsigned(2, "Ways for indirect predictor")
51 indirectTagSize = Param.Unsigned(16, "Indirect target cache tag bits")
52 indirectPathLength = Param.Unsigned(3,
53 "Previous indirect targets to use for path history")
54 indirectGHRBits = Param.Unsigned(13, "Indirect GHR number of bits")
55 instShiftAmt = Param.Unsigned(2, "Number of bits to shift instructions by")
55
56
57class BranchPredictor(SimObject):
58 type = 'BranchPredictor'
59 cxx_class = 'BPredUnit'
60 cxx_header = "cpu/pred/bpred_unit.hh"
61 abstract = True
56
62
63 numThreads = Param.Unsigned(Parent.numThreads, "Number of threads")
64 BTBEntries = Param.Unsigned(4096, "Number of BTB entries")
65 BTBTagSize = Param.Unsigned(16, "Size of the BTB tags, in bits")
66 RASSize = Param.Unsigned(16, "RAS size")
67 instShiftAmt = Param.Unsigned(2, "Number of bits to shift instructions by")
57
68
69 indirectBranchPred = Param.IndirectPredictor(SimpleIndirectPredictor(),
70 "Indirect branch predictor, set to NULL to disable indirect predictions")
71
58class LocalBP(BranchPredictor):
59 type = 'LocalBP'
60 cxx_class = 'LocalBP'
61 cxx_header = "cpu/pred/2bit_local.hh"
62
63 localPredictorSize = Param.Unsigned(2048, "Size of local predictor")
64 localCtrBits = Param.Unsigned(2, "Bits per counter")
65

--- 398 unchanged lines hidden ---
72class LocalBP(BranchPredictor):
73 type = 'LocalBP'
74 cxx_class = 'LocalBP'
75 cxx_header = "cpu/pred/2bit_local.hh"
76
77 localPredictorSize = Param.Unsigned(2048, "Size of local predictor")
78 localCtrBits = Param.Unsigned(2, "Bits per counter")
79

--- 398 unchanged lines hidden ---