ReplacementPolicies.py revision 12672
112600Sodanrc@yahoo.com.br# Copyright (c) 2018 Inria
212600Sodanrc@yahoo.com.br# All rights reserved.
312600Sodanrc@yahoo.com.br#
412600Sodanrc@yahoo.com.br# Redistribution and use in source and binary forms, with or without
512600Sodanrc@yahoo.com.br# modification, are permitted provided that the following conditions are
612600Sodanrc@yahoo.com.br# met: redistributions of source code must retain the above copyright
712600Sodanrc@yahoo.com.br# notice, this list of conditions and the following disclaimer;
812600Sodanrc@yahoo.com.br# redistributions in binary form must reproduce the above copyright
912600Sodanrc@yahoo.com.br# notice, this list of conditions and the following disclaimer in the
1012600Sodanrc@yahoo.com.br# documentation and/or other materials provided with the distribution;
1112600Sodanrc@yahoo.com.br# neither the name of the copyright holders nor the names of its
1212600Sodanrc@yahoo.com.br# contributors may be used to endorse or promote products derived from
1312600Sodanrc@yahoo.com.br# this software without specific prior written permission.
1412600Sodanrc@yahoo.com.br#
1512600Sodanrc@yahoo.com.br# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1612600Sodanrc@yahoo.com.br# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1712600Sodanrc@yahoo.com.br# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1812600Sodanrc@yahoo.com.br# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1912600Sodanrc@yahoo.com.br# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2012600Sodanrc@yahoo.com.br# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2112600Sodanrc@yahoo.com.br# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2212600Sodanrc@yahoo.com.br# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2312600Sodanrc@yahoo.com.br# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2412600Sodanrc@yahoo.com.br# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2512600Sodanrc@yahoo.com.br# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2612600Sodanrc@yahoo.com.br#
2712600Sodanrc@yahoo.com.br# Authors: Daniel Carvalho
2812600Sodanrc@yahoo.com.br
2912600Sodanrc@yahoo.com.brfrom m5.params import *
3012600Sodanrc@yahoo.com.brfrom m5.proxy import *
3112600Sodanrc@yahoo.com.brfrom m5.SimObject import SimObject
3212600Sodanrc@yahoo.com.br
3312600Sodanrc@yahoo.com.brclass BaseReplacementPolicy(SimObject):
3412600Sodanrc@yahoo.com.br    type = 'BaseReplacementPolicy'
3512600Sodanrc@yahoo.com.br    abstract = True
3612600Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/base.hh"
3712600Sodanrc@yahoo.com.br
3812607Sodanrc@yahoo.com.brclass FIFORP(BaseReplacementPolicy):
3912607Sodanrc@yahoo.com.br    type = 'FIFORP'
4012607Sodanrc@yahoo.com.br    cxx_class = 'FIFORP'
4112607Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/fifo_rp.hh"
4212607Sodanrc@yahoo.com.br
4312628Sodanrc@yahoo.com.brclass LFURP(BaseReplacementPolicy):
4412628Sodanrc@yahoo.com.br    type = 'LFURP'
4512628Sodanrc@yahoo.com.br    cxx_class = 'LFURP'
4612628Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/lfu_rp.hh"
4712628Sodanrc@yahoo.com.br
4812600Sodanrc@yahoo.com.brclass LRURP(BaseReplacementPolicy):
4912600Sodanrc@yahoo.com.br    type = 'LRURP'
5012600Sodanrc@yahoo.com.br    cxx_class = 'LRURP'
5112600Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/lru_rp.hh"
5212600Sodanrc@yahoo.com.br
5312634Sodanrc@yahoo.com.brclass BIPRP(LRURP):
5412634Sodanrc@yahoo.com.br    type = 'BIPRP'
5512634Sodanrc@yahoo.com.br    cxx_class = 'BIPRP'
5612634Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/bip_rp.hh"
5712634Sodanrc@yahoo.com.br    btp = Param.Percent(3, "Percentage of blocks to be inserted as MRU")
5812634Sodanrc@yahoo.com.br
5912635Sodanrc@yahoo.com.brclass LIPRP(BIPRP):
6012635Sodanrc@yahoo.com.br    btp = 0
6112635Sodanrc@yahoo.com.br
6212601Sodanrc@yahoo.com.brclass MRURP(BaseReplacementPolicy):
6312601Sodanrc@yahoo.com.br    type = 'MRURP'
6412601Sodanrc@yahoo.com.br    cxx_class = 'MRURP'
6512601Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/mru_rp.hh"
6612601Sodanrc@yahoo.com.br
6712600Sodanrc@yahoo.com.brclass RandomRP(BaseReplacementPolicy):
6812600Sodanrc@yahoo.com.br    type = 'RandomRP'
6912600Sodanrc@yahoo.com.br    cxx_class = 'RandomRP'
7012600Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/random_rp.hh"
7112626Sodanrc@yahoo.com.br
7212626Sodanrc@yahoo.com.brclass BRRIPRP(BaseReplacementPolicy):
7312626Sodanrc@yahoo.com.br    type = 'BRRIPRP'
7412626Sodanrc@yahoo.com.br    cxx_class = 'BRRIPRP'
7512626Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/brrip_rp.hh"
7612626Sodanrc@yahoo.com.br    max_RRPV = Param.Unsigned(3, "Maximum RRPV possible")
7712626Sodanrc@yahoo.com.br    hit_priority = Param.Bool(False,
7812626Sodanrc@yahoo.com.br        "Prioritize evicting blocks that havent had a hit recently")
7912626Sodanrc@yahoo.com.br    btp = Param.Percent(3,
8012626Sodanrc@yahoo.com.br        "Percentage of blocks to be inserted with long RRPV")
8112627Sodanrc@yahoo.com.br
8212627Sodanrc@yahoo.com.brclass RRIPRP(BRRIPRP):
8312627Sodanrc@yahoo.com.br    btp = 0
8412672Sodanrc@yahoo.com.br
8512672Sodanrc@yahoo.com.brclass NRURP(BRRIPRP):
8612672Sodanrc@yahoo.com.br    btp = 0
8712672Sodanrc@yahoo.com.br    max_RRPV = 1
88