BranchPredictor.py revision 9480
19480Snilay@cs.wisc.edu# Copyright (c) 2012 Mark D. Hill and David A. Wood
29480Snilay@cs.wisc.edu# All rights reserved.
39480Snilay@cs.wisc.edu#
49480Snilay@cs.wisc.edu# Redistribution and use in source and binary forms, with or without
59480Snilay@cs.wisc.edu# modification, are permitted provided that the following conditions are
69480Snilay@cs.wisc.edu# met: redistributions of source code must retain the above copyright
79480Snilay@cs.wisc.edu# notice, this list of conditions and the following disclaimer;
89480Snilay@cs.wisc.edu# redistributions in binary form must reproduce the above copyright
99480Snilay@cs.wisc.edu# notice, this list of conditions and the following disclaimer in the
109480Snilay@cs.wisc.edu# documentation and/or other materials provided with the distribution;
119480Snilay@cs.wisc.edu# neither the name of the copyright holders nor the names of its
129480Snilay@cs.wisc.edu# contributors may be used to endorse or promote products derived from
139480Snilay@cs.wisc.edu# this software without specific prior written permission.
149480Snilay@cs.wisc.edu#
159480Snilay@cs.wisc.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
169480Snilay@cs.wisc.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
179480Snilay@cs.wisc.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
189480Snilay@cs.wisc.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
199480Snilay@cs.wisc.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
209480Snilay@cs.wisc.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
219480Snilay@cs.wisc.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
229480Snilay@cs.wisc.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
239480Snilay@cs.wisc.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
249480Snilay@cs.wisc.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
259480Snilay@cs.wisc.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
269480Snilay@cs.wisc.edu#
279480Snilay@cs.wisc.edu# Authors: Nilay Vaish
289480Snilay@cs.wisc.edu
299480Snilay@cs.wisc.edufrom m5.SimObject import SimObject
309480Snilay@cs.wisc.edufrom m5.params import *
319480Snilay@cs.wisc.edu
329480Snilay@cs.wisc.educlass BranchPredictor(SimObject):
339480Snilay@cs.wisc.edu    type = 'BranchPredictor'
349480Snilay@cs.wisc.edu    cxx_class = 'BPredUnit'
359480Snilay@cs.wisc.edu    cxx_header = "cpu/pred/bpred_unit.hh"
369480Snilay@cs.wisc.edu
379480Snilay@cs.wisc.edu    numThreads = Param.Unsigned(1, "Number of threads")
389480Snilay@cs.wisc.edu    predType = Param.String("tournament",
399480Snilay@cs.wisc.edu        "Branch predictor type ('local', 'tournament')")
409480Snilay@cs.wisc.edu    localPredictorSize = Param.Unsigned(2048, "Size of local predictor")
419480Snilay@cs.wisc.edu    localCtrBits = Param.Unsigned(2, "Bits per counter")
429480Snilay@cs.wisc.edu    localHistoryTableSize = Param.Unsigned(2048, "Size of local history table")
439480Snilay@cs.wisc.edu    localHistoryBits = Param.Unsigned(11, "Bits for the local history")
449480Snilay@cs.wisc.edu    globalPredictorSize = Param.Unsigned(8192, "Size of global predictor")
459480Snilay@cs.wisc.edu    globalCtrBits = Param.Unsigned(2, "Bits per counter")
469480Snilay@cs.wisc.edu    globalHistoryBits = Param.Unsigned(13, "Bits of history")
479480Snilay@cs.wisc.edu    choicePredictorSize = Param.Unsigned(8192, "Size of choice predictor")
489480Snilay@cs.wisc.edu    choiceCtrBits = Param.Unsigned(2, "Bits of choice counters")
499480Snilay@cs.wisc.edu
509480Snilay@cs.wisc.edu    BTBEntries = Param.Unsigned(4096, "Number of BTB entries")
519480Snilay@cs.wisc.edu    BTBTagSize = Param.Unsigned(16, "Size of the BTB tags, in bits")
529480Snilay@cs.wisc.edu
539480Snilay@cs.wisc.edu    RASSize = Param.Unsigned(16, "RAS size")
549480Snilay@cs.wisc.edu    instShiftAmt = Param.Unsigned(2, "Number of bits to shift instructions by")
55