ReplacementPolicies.py revision 12684:44ebd2bc020f
12100SN/A# Copyright (c) 2018 Inria
22100SN/A# All rights reserved.
35222Sksewell@umich.edu#
45222Sksewell@umich.edu# Redistribution and use in source and binary forms, with or without
55222Sksewell@umich.edu# modification, are permitted provided that the following conditions are
65222Sksewell@umich.edu# met: redistributions of source code must retain the above copyright
75222Sksewell@umich.edu# notice, this list of conditions and the following disclaimer;
85222Sksewell@umich.edu# redistributions in binary form must reproduce the above copyright
95222Sksewell@umich.edu# notice, this list of conditions and the following disclaimer in the
105222Sksewell@umich.edu# documentation and/or other materials provided with the distribution;
115222Sksewell@umich.edu# neither the name of the copyright holders nor the names of its
125222Sksewell@umich.edu# contributors may be used to endorse or promote products derived from
135222Sksewell@umich.edu# this software without specific prior written permission.
145222Sksewell@umich.edu#
155222Sksewell@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
165222Sksewell@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
175222Sksewell@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
185222Sksewell@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
195222Sksewell@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
205222Sksewell@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
215222Sksewell@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
225222Sksewell@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
235222Sksewell@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
245222Sksewell@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
255222Sksewell@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
265222Sksewell@umich.edu#
275222Sksewell@umich.edu# Authors: Daniel Carvalho
285222Sksewell@umich.edu
295222Sksewell@umich.edufrom m5.params import *
305222Sksewell@umich.edufrom m5.proxy import *
315222Sksewell@umich.edufrom m5.SimObject import SimObject
325222Sksewell@umich.edu
335222Sksewell@umich.educlass BaseReplacementPolicy(SimObject):
345222Sksewell@umich.edu    type = 'BaseReplacementPolicy'
355222Sksewell@umich.edu    abstract = True
365222Sksewell@umich.edu    cxx_header = "mem/cache/replacement_policies/base.hh"
372706Sksewell@umich.edu
382100SN/Aclass FIFORP(BaseReplacementPolicy):
392124SN/A    type = 'FIFORP'
402124SN/A    cxx_class = 'FIFORP'
412124SN/A    cxx_header = "mem/cache/replacement_policies/fifo_rp.hh"
422124SN/A
432124SN/Aclass LFURP(BaseReplacementPolicy):
442124SN/A    type = 'LFURP'
452124SN/A    cxx_class = 'LFURP'
462124SN/A    cxx_header = "mem/cache/replacement_policies/lfu_rp.hh"
472124SN/A
482124SN/Aclass LRURP(BaseReplacementPolicy):
492124SN/A    type = 'LRURP'
502124SN/A    cxx_class = 'LRURP'
512124SN/A    cxx_header = "mem/cache/replacement_policies/lru_rp.hh"
522124SN/A
532124SN/Aclass BIPRP(LRURP):
542124SN/A    type = 'BIPRP'
553953Sstever@eecs.umich.edu    cxx_class = 'BIPRP'
563953Sstever@eecs.umich.edu    cxx_header = "mem/cache/replacement_policies/bip_rp.hh"
573953Sstever@eecs.umich.edu    btp = Param.Percent(3, "Percentage of blocks to be inserted as MRU")
583953Sstever@eecs.umich.edu
593953Sstever@eecs.umich.educlass LIPRP(BIPRP):
603953Sstever@eecs.umich.edu    btp = 0
613953Sstever@eecs.umich.edu
623953Sstever@eecs.umich.educlass MRURP(BaseReplacementPolicy):
633953Sstever@eecs.umich.edu    type = 'MRURP'
643953Sstever@eecs.umich.edu    cxx_class = 'MRURP'
653953Sstever@eecs.umich.edu    cxx_header = "mem/cache/replacement_policies/mru_rp.hh"
663953Sstever@eecs.umich.edu
672124SN/Aclass RandomRP(BaseReplacementPolicy):
682124SN/A    type = 'RandomRP'
692124SN/A    cxx_class = 'RandomRP'
702124SN/A    cxx_header = "mem/cache/replacement_policies/random_rp.hh"
712124SN/A
722124SN/Aclass BRRIPRP(BaseReplacementPolicy):
732124SN/A    type = 'BRRIPRP'
742935Sksewell@umich.edu    cxx_class = 'BRRIPRP'
754056Sstever@eecs.umich.edu    cxx_header = "mem/cache/replacement_policies/brrip_rp.hh"
764056Sstever@eecs.umich.edu    max_RRPV = Param.Int(3, "Maximum RRPV possible")
772935Sksewell@umich.edu    hit_priority = Param.Bool(False,
782935Sksewell@umich.edu        "Prioritize evicting blocks that havent had a hit recently")
792124SN/A    btp = Param.Percent(3,
802124SN/A        "Percentage of blocks to be inserted with long RRPV")
812124SN/A
822124SN/Aclass RRIPRP(BRRIPRP):
835222Sksewell@umich.edu    btp = 0
845222Sksewell@umich.edu
855222Sksewell@umich.educlass NRURP(BRRIPRP):
865222Sksewell@umich.edu    btp = 0
875222Sksewell@umich.edu    max_RRPV = 1
885222Sksewell@umich.edu