Prefetcher.py revision 13735
14309Sgblack@eecs.umich.edu# Copyright (c) 2012, 2014 ARM Limited
24309Sgblack@eecs.umich.edu# All rights reserved.
35426Sgblack@eecs.umich.edu#
44309Sgblack@eecs.umich.edu# The license below extends only to copyright in the software and shall
54309Sgblack@eecs.umich.edu# not be construed as granting a license to any other intellectual
64309Sgblack@eecs.umich.edu# property including but not limited to intellectual property relating
74309Sgblack@eecs.umich.edu# to a hardware implementation of the functionality of the software
84309Sgblack@eecs.umich.edu# licensed hereunder.  You may use the software subject to the license
94309Sgblack@eecs.umich.edu# terms below provided that you ensure that this notice is replicated
104309Sgblack@eecs.umich.edu# unmodified and in its entirety in all distributions of the software,
114309Sgblack@eecs.umich.edu# modified or unmodified, in source code or in binary form.
124309Sgblack@eecs.umich.edu#
134309Sgblack@eecs.umich.edu# Copyright (c) 2005 The Regents of The University of Michigan
144309Sgblack@eecs.umich.edu# All rights reserved.
154309Sgblack@eecs.umich.edu#
164309Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
174309Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
184309Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
194309Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
204309Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
214309Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
224309Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
234309Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
244309Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
254309Sgblack@eecs.umich.edu# this software without specific prior written permission.
264309Sgblack@eecs.umich.edu#
274309Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
284309Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
294309Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
304309Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
314309Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
324309Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
334309Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
344309Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
354309Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
364309Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
374309Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
384309Sgblack@eecs.umich.edu#
394309Sgblack@eecs.umich.edu# Authors: Ron Dreslinski
404309Sgblack@eecs.umich.edu#          Mitch Hayenga
414309Sgblack@eecs.umich.edu
424309Sgblack@eecs.umich.edufrom m5.SimObject import *
434309Sgblack@eecs.umich.edufrom m5.params import *
444309Sgblack@eecs.umich.edufrom m5.proxy import *
454309Sgblack@eecs.umich.edu
464309Sgblack@eecs.umich.edufrom m5.objects.ClockedObject import ClockedObject
474309Sgblack@eecs.umich.edufrom m5.objects.IndexingPolicies import *
484309Sgblack@eecs.umich.edufrom m5.objects.ReplacementPolicies import *
494309Sgblack@eecs.umich.edu
504309Sgblack@eecs.umich.educlass HWPProbeEvent(object):
514309Sgblack@eecs.umich.edu    def __init__(self, prefetcher, obj, *listOfNames):
524309Sgblack@eecs.umich.edu        self.obj = obj
534309Sgblack@eecs.umich.edu        self.prefetcher = prefetcher
544309Sgblack@eecs.umich.edu        self.names = listOfNames
554309Sgblack@eecs.umich.edu
564309Sgblack@eecs.umich.edu    def register(self):
574309Sgblack@eecs.umich.edu        if self.obj:
584533Sgblack@eecs.umich.edu            for name in self.names:
594679Sgblack@eecs.umich.edu                self.prefetcher.getCCObject().addEventProbe(
604679Sgblack@eecs.umich.edu                    self.obj.getCCObject(), name)
614679Sgblack@eecs.umich.edu
624533Sgblack@eecs.umich.educlass BasePrefetcher(ClockedObject):
634533Sgblack@eecs.umich.edu    type = 'BasePrefetcher'
644537Sgblack@eecs.umich.edu    abstract = True
654533Sgblack@eecs.umich.edu    cxx_header = "mem/cache/prefetch/base.hh"
664528Sgblack@eecs.umich.edu    cxx_exports = [
675666Sgblack@eecs.umich.edu        PyBindMethod("addEventProbe"),
685666Sgblack@eecs.umich.edu    ]
695666Sgblack@eecs.umich.edu    sys = Param.System(Parent.any, "System this prefetcher belongs to")
704528Sgblack@eecs.umich.edu
714528Sgblack@eecs.umich.edu    # Get the block size from the parent (system)
724528Sgblack@eecs.umich.edu    block_size = Param.Int(Parent.cache_line_size, "Block size in bytes")
734528Sgblack@eecs.umich.edu
744605Sgblack@eecs.umich.edu    on_miss = Param.Bool(False, "Only notify prefetcher on misses")
755666Sgblack@eecs.umich.edu    on_read = Param.Bool(True, "Notify prefetcher on reads")
765666Sgblack@eecs.umich.edu    on_write = Param.Bool(True, "Notify prefetcher on writes")
774528Sgblack@eecs.umich.edu    on_data  = Param.Bool(True, "Notify prefetcher on data accesses")
786345Sgblack@eecs.umich.edu    on_inst  = Param.Bool(True, "Notify prefetcher on instruction accesses")
796345Sgblack@eecs.umich.edu    prefetch_on_access = Param.Bool(Parent.prefetch_on_access,
806345Sgblack@eecs.umich.edu        "Notify the hardware prefetcher on every access (not just misses)")
816345Sgblack@eecs.umich.edu    use_virtual_addresses = Param.Bool(False,
826345Sgblack@eecs.umich.edu        "Use virtual addresses for prefetching")
836345Sgblack@eecs.umich.edu
844615Sgblack@eecs.umich.edu    _events = []
855854Sgblack@eecs.umich.edu    def addEvent(self, newObject):
866345Sgblack@eecs.umich.edu        self._events.append(newObject)
875854Sgblack@eecs.umich.edu
886345Sgblack@eecs.umich.edu    # Override the normal SimObject::regProbeListeners method and
896345Sgblack@eecs.umich.edu    # register deferred event handlers.
904615Sgblack@eecs.umich.edu    def regProbeListeners(self):
915671Sgblack@eecs.umich.edu        for event in self._events:
926345Sgblack@eecs.umich.edu           event.register()
936345Sgblack@eecs.umich.edu        self.getCCObject().regProbeListeners()
945291Sgblack@eecs.umich.edu
955428Sgblack@eecs.umich.edu    def listenFromProbe(self, simObj, *probeNames):
965674Sgblack@eecs.umich.edu        if not isinstance(simObj, SimObject):
975899Sgblack@eecs.umich.edu            raise TypeError("argument must be of SimObject type")
985936Sgblack@eecs.umich.edu        if len(probeNames) <= 0:
995428Sgblack@eecs.umich.edu            raise TypeError("probeNames must have at least one element")
1005428Sgblack@eecs.umich.edu        self.addEvent(HWPProbeEvent(self, simObj, *probeNames))
1015294Sgblack@eecs.umich.edu
1026345Sgblack@eecs.umich.educlass QueuedPrefetcher(BasePrefetcher):
1035291Sgblack@eecs.umich.edu    type = "QueuedPrefetcher"
1045294Sgblack@eecs.umich.edu    abstract = True
1056345Sgblack@eecs.umich.edu    cxx_class = "QueuedPrefetcher"
1065294Sgblack@eecs.umich.edu    cxx_header = "mem/cache/prefetch/queued.hh"
1074615Sgblack@eecs.umich.edu    latency = Param.Int(1, "Latency for generated prefetches")
1084615Sgblack@eecs.umich.edu    queue_size = Param.Int(32, "Maximum number of queued prefetches")
1096345Sgblack@eecs.umich.edu    queue_squash = Param.Bool(True, "Squash queued prefetch on demand access")
1106345Sgblack@eecs.umich.edu    queue_filter = Param.Bool(True, "Don't queue redundant prefetches")
1116345Sgblack@eecs.umich.edu    cache_snoop = Param.Bool(False, "Snoop cache to eliminate redundant request")
1126345Sgblack@eecs.umich.edu
1136345Sgblack@eecs.umich.edu    tag_prefetch = Param.Bool(True, "Tag prefetch with PC of generating access")
1146345Sgblack@eecs.umich.edu
1156517Sgblack@eecs.umich.educlass StridePrefetcher(QueuedPrefetcher):
1166517Sgblack@eecs.umich.edu    type = 'StridePrefetcher'
1175161Sgblack@eecs.umich.edu    cxx_class = 'StridePrefetcher'
1185161Sgblack@eecs.umich.edu    cxx_header = "mem/cache/prefetch/stride.hh"
1196345Sgblack@eecs.umich.edu
1204615Sgblack@eecs.umich.edu    # Do not consult stride prefetcher on instruction accesses
1216345Sgblack@eecs.umich.edu    on_inst = False
1226345Sgblack@eecs.umich.edu
1234615Sgblack@eecs.umich.edu    max_conf = Param.Int(7, "Maximum confidence level")
1244953Sgblack@eecs.umich.edu    thresh_conf = Param.Int(4, "Threshold confidence level")
1254615Sgblack@eecs.umich.edu    min_conf = Param.Int(0, "Minimum confidence level")
1264615Sgblack@eecs.umich.edu    start_conf = Param.Int(4, "Starting confidence for new entries")
1274863Sgblack@eecs.umich.edu
1284863Sgblack@eecs.umich.edu    table_sets = Param.Int(16, "Number of sets in PC lookup table")
1295326Sgblack@eecs.umich.edu    table_assoc = Param.Int(4, "Associativity of PC lookup table")
1305326Sgblack@eecs.umich.edu    use_master_id = Param.Bool(True, "Use master id based history")
1315326Sgblack@eecs.umich.edu
1325326Sgblack@eecs.umich.edu    degree = Param.Int(4, "Number of prefetches to generate")
1335326Sgblack@eecs.umich.edu
1345326Sgblack@eecs.umich.edu    # Get replacement policy
1355326Sgblack@eecs.umich.edu    replacement_policy = Param.BaseReplacementPolicy(RandomRP(),
1365326Sgblack@eecs.umich.edu        "Replacement policy")
1375326Sgblack@eecs.umich.edu
1384863Sgblack@eecs.umich.educlass TaggedPrefetcher(QueuedPrefetcher):
1394863Sgblack@eecs.umich.edu    type = 'TaggedPrefetcher'
1404863Sgblack@eecs.umich.edu    cxx_class = 'TaggedPrefetcher'
1414863Sgblack@eecs.umich.edu    cxx_header = "mem/cache/prefetch/tagged.hh"
1424863Sgblack@eecs.umich.edu
1434620Sgblack@eecs.umich.edu    degree = Param.Int(2, "Number of prefetches to generate")
1445149Sgblack@eecs.umich.edu
1455149Sgblack@eecs.umich.educlass SignaturePathPrefetcher(QueuedPrefetcher):
1466345Sgblack@eecs.umich.edu    type = 'SignaturePathPrefetcher'
1475294Sgblack@eecs.umich.edu    cxx_class = 'SignaturePathPrefetcher'
1485294Sgblack@eecs.umich.edu    cxx_header = "mem/cache/prefetch/signature_path.hh"
1496345Sgblack@eecs.umich.edu
1505149Sgblack@eecs.umich.edu    signature_shift = Param.UInt8(3,
1515906Sgblack@eecs.umich.edu        "Number of bits to shift when calculating a new signature");
1525906Sgblack@eecs.umich.edu    signature_bits = Param.UInt16(12,
1536345Sgblack@eecs.umich.edu        "Size of the signature, in bits");
1546345Sgblack@eecs.umich.edu    signature_table_entries = Param.MemorySize("1024",
1554615Sgblack@eecs.umich.edu        "Number of entries of the signature table")
1566457Sgblack@eecs.umich.edu    signature_table_assoc = Param.Unsigned(2,
1576457Sgblack@eecs.umich.edu        "Associativity of the signature table")
1586457Sgblack@eecs.umich.edu    signature_table_indexing_policy = Param.BaseIndexingPolicy(
1596457Sgblack@eecs.umich.edu        SetAssociative(entry_size = 1, assoc = Parent.signature_table_assoc,
1605854Sgblack@eecs.umich.edu        size = Parent.signature_table_entries),
1616345Sgblack@eecs.umich.edu        "Indexing policy of the signature table")
1625241Sgblack@eecs.umich.edu    signature_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
1635426Sgblack@eecs.umich.edu        "Replacement policy of the signature table")
1645426Sgblack@eecs.umich.edu
1654686Sgblack@eecs.umich.edu    max_counter_value = Param.UInt8(7, "Maximum pattern counter value")
1664686Sgblack@eecs.umich.edu    pattern_table_entries = Param.MemorySize("4096",
1674686Sgblack@eecs.umich.edu        "Number of entries of the pattern table")
1684953Sgblack@eecs.umich.edu    pattern_table_assoc = Param.Unsigned(1,
1694686Sgblack@eecs.umich.edu        "Associativity of the pattern table")
1704686Sgblack@eecs.umich.edu    strides_per_pattern_entry = Param.Unsigned(4,
1714686Sgblack@eecs.umich.edu        "Number of strides stored in each pattern entry")
1724686Sgblack@eecs.umich.edu    pattern_table_indexing_policy = Param.BaseIndexingPolicy(
1734953Sgblack@eecs.umich.edu        SetAssociative(entry_size = 1, assoc = Parent.pattern_table_assoc,
1744953Sgblack@eecs.umich.edu        size = Parent.pattern_table_entries),
1754686Sgblack@eecs.umich.edu        "Indexing policy of the pattern table")
1764686Sgblack@eecs.umich.edu    pattern_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
1774686Sgblack@eecs.umich.edu        "Replacement policy of the pattern table")
1784686Sgblack@eecs.umich.edu
1795682Sgblack@eecs.umich.edu    prefetch_confidence_threshold = Param.Float(0.5,
1805682Sgblack@eecs.umich.edu        "Minimum confidence to issue prefetches")
1815682Sgblack@eecs.umich.edu    lookahead_confidence_threshold = Param.Float(0.75,
1826345Sgblack@eecs.umich.edu        "Minimum confidence to continue exploring lookahead entries")
1835682Sgblack@eecs.umich.edu
1844615Sgblack@eecs.umich.educlass SignaturePathPrefetcherV2(SignaturePathPrefetcher):
1854615Sgblack@eecs.umich.edu    type = 'SignaturePathPrefetcherV2'
1864615Sgblack@eecs.umich.edu    cxx_class = 'SignaturePathPrefetcherV2'
1874615Sgblack@eecs.umich.edu    cxx_header = "mem/cache/prefetch/signature_path_v2.hh"
1884615Sgblack@eecs.umich.edu
1894615Sgblack@eecs.umich.edu    signature_table_entries = "256"
1904615Sgblack@eecs.umich.edu    signature_table_assoc = 1
1915930Sgblack@eecs.umich.edu    pattern_table_entries = "512"
1925291Sgblack@eecs.umich.edu    pattern_table_assoc = 1
1935291Sgblack@eecs.umich.edu    max_counter_value = 15
1945291Sgblack@eecs.umich.edu    prefetch_confidence_threshold = 0.25
1955291Sgblack@eecs.umich.edu    lookahead_confidence_threshold = 0.25
1965291Sgblack@eecs.umich.edu
1975291Sgblack@eecs.umich.edu    global_history_register_entries = Param.MemorySize("8",
1985161Sgblack@eecs.umich.edu        "Number of entries of global history register")
1995161Sgblack@eecs.umich.edu    global_history_register_indexing_policy = Param.BaseIndexingPolicy(
2005161Sgblack@eecs.umich.edu        SetAssociative(entry_size = 1,
2015161Sgblack@eecs.umich.edu        assoc = Parent.global_history_register_entries,
2025161Sgblack@eecs.umich.edu        size = Parent.global_history_register_entries),
2035008Sgblack@eecs.umich.edu        "Indexing policy of the global history register")
2045008Sgblack@eecs.umich.edu    global_history_register_replacement_policy = Param.BaseReplacementPolicy(
2055008Sgblack@eecs.umich.edu        LRURP(), "Replacement policy of the global history register")
2065008Sgblack@eecs.umich.edu
2075008Sgblack@eecs.umich.educlass AccessMapPatternMatching(ClockedObject):
2085667Sgblack@eecs.umich.edu    type = 'AccessMapPatternMatching'
2095667Sgblack@eecs.umich.edu    cxx_class = 'AccessMapPatternMatching'
2105667Sgblack@eecs.umich.edu    cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh"
2115667Sgblack@eecs.umich.edu
2125667Sgblack@eecs.umich.edu    block_size = Param.Unsigned(Parent.block_size,
2135676Sgblack@eecs.umich.edu        "Cacheline size used by the prefetcher using this object")
2145676Sgblack@eecs.umich.edu
2155676Sgblack@eecs.umich.edu    limit_stride = Param.Unsigned(0,
2165676Sgblack@eecs.umich.edu        "Limit the strides checked up to -X/X, if 0, disable the limit")
2175676Sgblack@eecs.umich.edu    start_degree = Param.Unsigned(4,
2185082Sgblack@eecs.umich.edu        "Initial degree (Maximum number of prefetches generated")
2196345Sgblack@eecs.umich.edu    hot_zone_size = Param.MemorySize("2kB", "Memory covered by a hot zone")
2205082Sgblack@eecs.umich.edu    access_map_table_entries = Param.MemorySize("256",
2215082Sgblack@eecs.umich.edu        "Number of entries in the access map table")
2226618Sgblack@eecs.umich.edu    access_map_table_assoc = Param.Unsigned(8,
2236618Sgblack@eecs.umich.edu        "Associativity of the access map table")
2245082Sgblack@eecs.umich.edu    access_map_table_indexing_policy = Param.BaseIndexingPolicy(
2254528Sgblack@eecs.umich.edu        SetAssociative(entry_size = 1, assoc = Parent.access_map_table_assoc,
2265666Sgblack@eecs.umich.edu        size = Parent.access_map_table_entries),
2275666Sgblack@eecs.umich.edu        "Indexing policy of the access map table")
2285666Sgblack@eecs.umich.edu    access_map_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
2294528Sgblack@eecs.umich.edu        "Replacement policy of the access map table")
230    high_coverage_threshold = Param.Float(0.25,
231        "A prefetch coverage factor bigger than this is considered high")
232    low_coverage_threshold = Param.Float(0.125,
233        "A prefetch coverage factor smaller than this is considered low")
234    high_accuracy_threshold = Param.Float(0.5,
235        "A prefetch accuracy factor bigger than this is considered high")
236    low_accuracy_threshold = Param.Float(0.25,
237        "A prefetch accuracy factor smaller than this is considered low")
238    high_cache_hit_threshold = Param.Float(0.875,
239        "A cache hit ratio bigger than this is considered high")
240    low_cache_hit_threshold = Param.Float(0.75,
241        "A cache hit ratio smaller than this is considered low")
242    epoch_cycles = Param.Cycles(256000, "Cycles in an epoch period")
243    offchip_memory_latency = Param.Latency("30ns",
244        "Memory latency used to compute the required memory bandwidth")
245
246class AMPMPrefetcher(QueuedPrefetcher):
247    type = 'AMPMPrefetcher'
248    cxx_class = 'AMPMPrefetcher'
249    cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh"
250    ampm = Param.AccessMapPatternMatching( AccessMapPatternMatching(),
251        "Access Map Pattern Matching object")
252
253class DeltaCorrelatingPredictionTables(SimObject):
254    type = 'DeltaCorrelatingPredictionTables'
255    cxx_class = 'DeltaCorrelatingPredictionTables'
256    cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh"
257    deltas_per_entry = Param.Unsigned(20,
258        "Number of deltas stored in each table entry")
259    delta_bits = Param.Unsigned(12, "Bits per delta")
260    delta_mask_bits = Param.Unsigned(8,
261        "Lower bits to mask when comparing deltas")
262    table_entries = Param.MemorySize("128",
263        "Number of entries in the table")
264    table_assoc = Param.Unsigned(128,
265        "Associativity of the table")
266    table_indexing_policy = Param.BaseIndexingPolicy(
267        SetAssociative(entry_size = 1, assoc = Parent.table_assoc,
268        size = Parent.table_entries),
269        "Indexing policy of the table")
270    table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
271        "Replacement policy of the table")
272
273class DCPTPrefetcher(QueuedPrefetcher):
274    type = 'DCPTPrefetcher'
275    cxx_class = 'DCPTPrefetcher'
276    cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh"
277    dcpt = Param.DeltaCorrelatingPredictionTables(
278        DeltaCorrelatingPredictionTables(),
279        "Delta Correlating Prediction Tables object")
280
281class IrregularStreamBufferPrefetcher(QueuedPrefetcher):
282    type = "IrregularStreamBufferPrefetcher"
283    cxx_class = "IrregularStreamBufferPrefetcher"
284    cxx_header = "mem/cache/prefetch/irregular_stream_buffer.hh"
285
286    max_counter_value = Param.Unsigned(3,
287        "Maximum value of the confidence counter")
288    chunk_size = Param.Unsigned(256,
289        "Maximum number of addresses in a temporal stream")
290    degree = Param.Unsigned(4, "Number of prefetches to generate")
291    training_unit_assoc = Param.Unsigned(128,
292        "Associativity of the training unit")
293    training_unit_entries = Param.MemorySize("128",
294        "Number of entries of the training unit")
295    training_unit_indexing_policy = Param.BaseIndexingPolicy(
296        SetAssociative(entry_size = 1, assoc = Parent.training_unit_assoc,
297        size = Parent.training_unit_entries),
298        "Indexing policy of the training unit")
299    training_unit_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
300        "Replacement policy of the training unit")
301
302    prefetch_candidates_per_entry = Param.Unsigned(16,
303        "Number of prefetch candidates stored in a SP-AMC entry")
304    address_map_cache_assoc = Param.Unsigned(128,
305        "Associativity of the PS/SP AMCs")
306    address_map_cache_entries = Param.MemorySize("128",
307        "Number of entries of the PS/SP AMCs")
308    ps_address_map_cache_indexing_policy = Param.BaseIndexingPolicy(
309        SetAssociative(entry_size = 1,
310        assoc = Parent.address_map_cache_assoc,
311        size = Parent.address_map_cache_entries),
312        "Indexing policy of the Physical-to-Structural Address Map Cache")
313    ps_address_map_cache_replacement_policy = Param.BaseReplacementPolicy(
314        LRURP(),
315        "Replacement policy of the Physical-to-Structural Address Map Cache")
316    sp_address_map_cache_indexing_policy = Param.BaseIndexingPolicy(
317        SetAssociative(entry_size = 1,
318        assoc = Parent.address_map_cache_assoc,
319        size = Parent.address_map_cache_entries),
320        "Indexing policy of the Structural-to-Physical Address Mao Cache")
321    sp_address_map_cache_replacement_policy = Param.BaseReplacementPolicy(
322        LRURP(),
323        "Replacement policy of the Structural-to-Physical Address Map Cache")
324
325class SlimAccessMapPatternMatching(AccessMapPatternMatching):
326    start_degree = 2
327    limit_stride = 4
328
329class SlimDeltaCorrelatingPredictionTables(DeltaCorrelatingPredictionTables):
330    table_entries = "256"
331    table_assoc = 256
332    deltas_per_entry = 9
333
334class SlimAMPMPrefetcher(QueuedPrefetcher):
335    type = 'SlimAMPMPrefetcher'
336    cxx_class = 'SlimAMPMPrefetcher'
337    cxx_header = "mem/cache/prefetch/slim_ampm.hh"
338
339    ampm = Param.AccessMapPatternMatching(SlimAccessMapPatternMatching(),
340        "Access Map Pattern Matching object")
341    dcpt = Param.DeltaCorrelatingPredictionTables(
342        SlimDeltaCorrelatingPredictionTables(),
343        "Delta Correlating Prediction Tables object")
344
345class BOPPrefetcher(QueuedPrefetcher):
346    type = "BOPPrefetcher"
347    cxx_class = "BOPPrefetcher"
348    cxx_header = "mem/cache/prefetch/bop.hh"
349    score_max = Param.Unsigned(31, "Max. score to update the best offset")
350    round_max = Param.Unsigned(100, "Max. round to update the best offset")
351    bad_score = Param.Unsigned(10, "Score at which the HWP is disabled")
352    rr_size = Param.Unsigned(64, "Number of entries of each RR bank")
353    tag_bits = Param.Unsigned(12, "Bits used to store the tag")
354    offset_list_size = Param.Unsigned(46,
355                "Number of entries in the offsets list")
356    negative_offsets_enable = Param.Bool(True,
357                "Initialize the offsets list also with negative values \
358                (i.e. the table will have half of the entries with positive \
359                offsets and the other half with negative ones)")
360    delay_queue_enable = Param.Bool(True, "Enable the delay queue")
361    delay_queue_size = Param.Unsigned(15,
362                "Number of entries in the delay queue")
363    delay_queue_cycles = Param.Cycles(60,
364                "Cycles to delay a write in the left RR table from the delay \
365                queue")
366
367class SBOOEPrefetcher(QueuedPrefetcher):
368    type = 'SBOOEPrefetcher'
369    cxx_class = 'SBOOEPrefetcher'
370    cxx_header = "mem/cache/prefetch/sbooe.hh"
371    latency_buffer_size = Param.Int(32, "Entries in the latency buffer")
372    sequential_prefetchers = Param.Int(9, "Number of sequential prefetchers")
373    sandbox_entries = Param.Int(1024, "Size of the address buffer")
374    score_threshold_pct = Param.Percent(25, "Min. threshold to issue a \
375        prefetch. The value is the percentage of sandbox entries to use")
376