ReplacementPolicies.py revision 12626
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
4312600Sodanrc@yahoo.com.brclass LRURP(BaseReplacementPolicy):
4412600Sodanrc@yahoo.com.br    type = 'LRURP'
4512600Sodanrc@yahoo.com.br    cxx_class = 'LRURP'
4612600Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/lru_rp.hh"
4712600Sodanrc@yahoo.com.br
4812601Sodanrc@yahoo.com.brclass MRURP(BaseReplacementPolicy):
4912601Sodanrc@yahoo.com.br    type = 'MRURP'
5012601Sodanrc@yahoo.com.br    cxx_class = 'MRURP'
5112601Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/mru_rp.hh"
5212601Sodanrc@yahoo.com.br
5312600Sodanrc@yahoo.com.brclass RandomRP(BaseReplacementPolicy):
5412600Sodanrc@yahoo.com.br    type = 'RandomRP'
5512600Sodanrc@yahoo.com.br    cxx_class = 'RandomRP'
5612600Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/random_rp.hh"
5712626Sodanrc@yahoo.com.br
5812626Sodanrc@yahoo.com.brclass BRRIPRP(BaseReplacementPolicy):
5912626Sodanrc@yahoo.com.br    type = 'BRRIPRP'
6012626Sodanrc@yahoo.com.br    cxx_class = 'BRRIPRP'
6112626Sodanrc@yahoo.com.br    cxx_header = "mem/cache/replacement_policies/brrip_rp.hh"
6212626Sodanrc@yahoo.com.br    max_RRPV = Param.Unsigned(3, "Maximum RRPV possible")
6312626Sodanrc@yahoo.com.br    hit_priority = Param.Bool(False,
6412626Sodanrc@yahoo.com.br        "Prioritize evicting blocks that havent had a hit recently")
6512626Sodanrc@yahoo.com.br    btp = Param.Percent(3,
6612626Sodanrc@yahoo.com.br        "Percentage of blocks to be inserted with long RRPV")
67