BranchPredictor.py revision 11784
19480Snilay@cs.wisc.edu# Copyright (c) 2012 Mark D. Hill and David A. Wood
210785Sgope@wisc.edu# Copyright (c) 2015 The University of Wisconsin
39480Snilay@cs.wisc.edu# All rights reserved.
49480Snilay@cs.wisc.edu#
59480Snilay@cs.wisc.edu# Redistribution and use in source and binary forms, with or without
69480Snilay@cs.wisc.edu# modification, are permitted provided that the following conditions are
79480Snilay@cs.wisc.edu# met: redistributions of source code must retain the above copyright
89480Snilay@cs.wisc.edu# notice, this list of conditions and the following disclaimer;
99480Snilay@cs.wisc.edu# redistributions in binary form must reproduce the above copyright
109480Snilay@cs.wisc.edu# notice, this list of conditions and the following disclaimer in the
119480Snilay@cs.wisc.edu# documentation and/or other materials provided with the distribution;
129480Snilay@cs.wisc.edu# neither the name of the copyright holders nor the names of its
139480Snilay@cs.wisc.edu# contributors may be used to endorse or promote products derived from
149480Snilay@cs.wisc.edu# this software without specific prior written permission.
159480Snilay@cs.wisc.edu#
169480Snilay@cs.wisc.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
179480Snilay@cs.wisc.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
189480Snilay@cs.wisc.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
199480Snilay@cs.wisc.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
209480Snilay@cs.wisc.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
219480Snilay@cs.wisc.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
229480Snilay@cs.wisc.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
239480Snilay@cs.wisc.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
249480Snilay@cs.wisc.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
259480Snilay@cs.wisc.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
269480Snilay@cs.wisc.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
279480Snilay@cs.wisc.edu#
2810785Sgope@wisc.edu# Authors: Nilay Vaish and Dibakar Gope
299480Snilay@cs.wisc.edu
309480Snilay@cs.wisc.edufrom m5.SimObject import SimObject
319480Snilay@cs.wisc.edufrom m5.params import *
329480Snilay@cs.wisc.edu
339480Snilay@cs.wisc.educlass BranchPredictor(SimObject):
349480Snilay@cs.wisc.edu    type = 'BranchPredictor'
359480Snilay@cs.wisc.edu    cxx_class = 'BPredUnit'
369480Snilay@cs.wisc.edu    cxx_header = "cpu/pred/bpred_unit.hh"
3710785Sgope@wisc.edu    abstract = True
389480Snilay@cs.wisc.edu
399480Snilay@cs.wisc.edu    numThreads = Param.Unsigned(1, "Number of threads")
4010785Sgope@wisc.edu    BTBEntries = Param.Unsigned(4096, "Number of BTB entries")
4110785Sgope@wisc.edu    BTBTagSize = Param.Unsigned(16, "Size of the BTB tags, in bits")
4210785Sgope@wisc.edu    RASSize = Param.Unsigned(16, "RAS size")
4310785Sgope@wisc.edu    instShiftAmt = Param.Unsigned(2, "Number of bits to shift instructions by")
4410785Sgope@wisc.edu
4511433Smitch.hayenga@arm.com    useIndirect = Param.Bool(True, "Use indirect branch predictor")
4611433Smitch.hayenga@arm.com    indirectHashGHR = Param.Bool(True, "Hash branch predictor GHR")
4711433Smitch.hayenga@arm.com    indirectHashTargets = Param.Bool(True, "Hash path history targets")
4811433Smitch.hayenga@arm.com    indirectSets = Param.Unsigned(256, "Cache sets for indirect predictor")
4911433Smitch.hayenga@arm.com    indirectWays = Param.Unsigned(2, "Ways for indirect predictor")
5011433Smitch.hayenga@arm.com    indirectTagSize = Param.Unsigned(16, "Indirect target cache tag bits")
5111433Smitch.hayenga@arm.com    indirectPathLength = Param.Unsigned(3,
5211433Smitch.hayenga@arm.com        "Previous indirect targets to use for path history")
5311433Smitch.hayenga@arm.com
5411433Smitch.hayenga@arm.com
5510785Sgope@wisc.edu
5610785Sgope@wisc.educlass LocalBP(BranchPredictor):
5710785Sgope@wisc.edu    type = 'LocalBP'
5810785Sgope@wisc.edu    cxx_class = 'LocalBP'
5910785Sgope@wisc.edu    cxx_header = "cpu/pred/2bit_local.hh"
6010785Sgope@wisc.edu
619480Snilay@cs.wisc.edu    localPredictorSize = Param.Unsigned(2048, "Size of local predictor")
629480Snilay@cs.wisc.edu    localCtrBits = Param.Unsigned(2, "Bits per counter")
6310785Sgope@wisc.edu
6410785Sgope@wisc.edu
6510785Sgope@wisc.educlass TournamentBP(BranchPredictor):
6610785Sgope@wisc.edu    type = 'TournamentBP'
6710785Sgope@wisc.edu    cxx_class = 'TournamentBP'
6810785Sgope@wisc.edu    cxx_header = "cpu/pred/tournament.hh"
6910785Sgope@wisc.edu
7010785Sgope@wisc.edu    localPredictorSize = Param.Unsigned(2048, "Size of local predictor")
7110785Sgope@wisc.edu    localCtrBits = Param.Unsigned(2, "Bits per counter")
7210785Sgope@wisc.edu    localHistoryTableSize = Param.Unsigned(2048, "size of local history table")
739480Snilay@cs.wisc.edu    globalPredictorSize = Param.Unsigned(8192, "Size of global predictor")
749480Snilay@cs.wisc.edu    globalCtrBits = Param.Unsigned(2, "Bits per counter")
759480Snilay@cs.wisc.edu    choicePredictorSize = Param.Unsigned(8192, "Size of choice predictor")
769480Snilay@cs.wisc.edu    choiceCtrBits = Param.Unsigned(2, "Bits of choice counters")
779480Snilay@cs.wisc.edu
789480Snilay@cs.wisc.edu
7910785Sgope@wisc.educlass BiModeBP(BranchPredictor):
8010785Sgope@wisc.edu    type = 'BiModeBP'
8110785Sgope@wisc.edu    cxx_class = 'BiModeBP'
8210785Sgope@wisc.edu    cxx_header = "cpu/pred/bi_mode.hh"
8310785Sgope@wisc.edu
8410785Sgope@wisc.edu    globalPredictorSize = Param.Unsigned(8192, "Size of global predictor")
8510785Sgope@wisc.edu    globalCtrBits = Param.Unsigned(2, "Bits per counter")
8610785Sgope@wisc.edu    choicePredictorSize = Param.Unsigned(8192, "Size of choice predictor")
8710785Sgope@wisc.edu    choiceCtrBits = Param.Unsigned(2, "Bits of choice counters")
8810785Sgope@wisc.edu
8911784Sarthur.perais@inria.frclass LTAGE(BranchPredictor):
9011784Sarthur.perais@inria.fr    type = 'LTAGE'
9111784Sarthur.perais@inria.fr    cxx_class = 'LTAGE'
9211784Sarthur.perais@inria.fr    cxx_header = "cpu/pred/ltage.hh"
9311784Sarthur.perais@inria.fr
9411784Sarthur.perais@inria.fr    logSizeBiMP = Param.Unsigned(14, "Log size of Bimodal predictor in bits")
9511784Sarthur.perais@inria.fr    logSizeTagTables = Param.Unsigned(11, "Log size of tag table in LTAGE")
9611784Sarthur.perais@inria.fr    logSizeLoopPred = Param.Unsigned(8, "Log size of the loop predictor")
9711784Sarthur.perais@inria.fr    nHistoryTables = Param.Unsigned(12, "Number of history tables")
9811784Sarthur.perais@inria.fr    tagTableCounterBits = Param.Unsigned(3, "Number of tag table counter bits")
9911784Sarthur.perais@inria.fr    histBufferSize = Param.Unsigned(2097152,
10011784Sarthur.perais@inria.fr            "A large number to track all branch histories(2MEntries default)")
10111784Sarthur.perais@inria.fr    minHist = Param.Unsigned(4, "Minimum history size of LTAGE")
10211784Sarthur.perais@inria.fr    maxHist = Param.Unsigned(640, "Maximum history size of LTAGE")
10311784Sarthur.perais@inria.fr    minTagWidth = Param.Unsigned(7, "Minimum tag size in tag tables")
10411784Sarthur.perais@inria.fr
105