Prefetcher.py revision 13829:b623eae407f0
18210SN/A# Copyright (c) 2012, 2014 ARM Limited
28210SN/A# All rights reserved.
38210SN/A#
48210SN/A# The license below extends only to copyright in the software and shall
58210SN/A# not be construed as granting a license to any other intellectual
68210SN/A# property including but not limited to intellectual property relating
78210SN/A# to a hardware implementation of the functionality of the software
88210SN/A# licensed hereunder.  You may use the software subject to the license
98210SN/A# terms below provided that you ensure that this notice is replicated
108210SN/A# unmodified and in its entirety in all distributions of the software,
118210SN/A# modified or unmodified, in source code or in binary form.
128210SN/A#
138210SN/A# Copyright (c) 2005 The Regents of The University of Michigan
148210SN/A# All rights reserved.
158210SN/A#
168210SN/A# Redistribution and use in source and binary forms, with or without
178210SN/A# modification, are permitted provided that the following conditions are
188210SN/A# met: redistributions of source code must retain the above copyright
198210SN/A# notice, this list of conditions and the following disclaimer;
208210SN/A# redistributions in binary form must reproduce the above copyright
218210SN/A# notice, this list of conditions and the following disclaimer in the
228210SN/A# documentation and/or other materials provided with the distribution;
238210SN/A# neither the name of the copyright holders nor the names of its
248210SN/A# contributors may be used to endorse or promote products derived from
258210SN/A# this software without specific prior written permission.
268210SN/A#
278210SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
288210SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
298210SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
308210SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
318210SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
328210SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
338210SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
348210SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
358210SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
368210SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
378210SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
388210SN/A#
398210SN/A# Authors: Ron Dreslinski
408210SN/A#          Mitch Hayenga
418210SN/A
428210SN/Afrom m5.SimObject import *
438210SN/Afrom m5.params import *
448210SN/Afrom m5.proxy import *
458210SN/A
468210SN/Afrom m5.objects.ClockedObject import ClockedObject
478210SN/Afrom m5.objects.IndexingPolicies import *
488210SN/Afrom m5.objects.ReplacementPolicies import *
498210SN/A
508210SN/Aclass HWPProbeEvent(object):
518210SN/A    def __init__(self, prefetcher, obj, *listOfNames):
528210SN/A        self.obj = obj
538210SN/A        self.prefetcher = prefetcher
548210SN/A        self.names = listOfNames
558210SN/A
568210SN/A    def register(self):
578210SN/A        if self.obj:
588210SN/A            for name in self.names:
598210SN/A                self.prefetcher.getCCObject().addEventProbe(
608210SN/A                    self.obj.getCCObject(), name)
618210SN/A
628210SN/Aclass BasePrefetcher(ClockedObject):
638210SN/A    type = 'BasePrefetcher'
648210SN/A    abstract = True
658210SN/A    cxx_header = "mem/cache/prefetch/base.hh"
668210SN/A    cxx_exports = [
678210SN/A        PyBindMethod("addEventProbe"),
688210SN/A    ]
698210SN/A    sys = Param.System(Parent.any, "System this prefetcher belongs to")
708210SN/A
718210SN/A    # Get the block size from the parent (system)
728210SN/A    block_size = Param.Int(Parent.cache_line_size, "Block size in bytes")
738210SN/A
748210SN/A    on_miss = Param.Bool(False, "Only notify prefetcher on misses")
758210SN/A    on_read = Param.Bool(True, "Notify prefetcher on reads")
768210SN/A    on_write = Param.Bool(True, "Notify prefetcher on writes")
778210SN/A    on_data  = Param.Bool(True, "Notify prefetcher on data accesses")
788210SN/A    on_inst  = Param.Bool(True, "Notify prefetcher on instruction accesses")
798210SN/A    prefetch_on_access = Param.Bool(Parent.prefetch_on_access,
808210SN/A        "Notify the hardware prefetcher on every access (not just misses)")
818210SN/A    use_virtual_addresses = Param.Bool(False,
828210SN/A        "Use virtual addresses for prefetching")
838210SN/A
848210SN/A    _events = []
858210SN/A    def addEvent(self, newObject):
868210SN/A        self._events.append(newObject)
878210SN/A
888210SN/A    # Override the normal SimObject::regProbeListeners method and
898210SN/A    # register deferred event handlers.
908210SN/A    def regProbeListeners(self):
918210SN/A        for event in self._events:
928210SN/A           event.register()
938210SN/A        self.getCCObject().regProbeListeners()
948210SN/A
958210SN/A    def listenFromProbe(self, simObj, *probeNames):
968210SN/A        if not isinstance(simObj, SimObject):
978210SN/A            raise TypeError("argument must be of SimObject type")
988210SN/A        if len(probeNames) <= 0:
998210SN/A            raise TypeError("probeNames must have at least one element")
1008210SN/A        self.addEvent(HWPProbeEvent(self, simObj, *probeNames))
1018210SN/A
1028210SN/Aclass QueuedPrefetcher(BasePrefetcher):
1038210SN/A    type = "QueuedPrefetcher"
1048210SN/A    abstract = True
1058210SN/A    cxx_class = "QueuedPrefetcher"
1068210SN/A    cxx_header = "mem/cache/prefetch/queued.hh"
1078210SN/A    latency = Param.Int(1, "Latency for generated prefetches")
1088210SN/A    queue_size = Param.Int(32, "Maximum number of queued prefetches")
1098210SN/A    queue_squash = Param.Bool(True, "Squash queued prefetch on demand access")
1108210SN/A    queue_filter = Param.Bool(True, "Don't queue redundant prefetches")
1118210SN/A    cache_snoop = Param.Bool(False, "Snoop cache to eliminate redundant request")
1128210SN/A
1138210SN/A    tag_prefetch = Param.Bool(True, "Tag prefetch with PC of generating access")
1148210SN/A
1158210SN/Aclass StridePrefetcher(QueuedPrefetcher):
1168210SN/A    type = 'StridePrefetcher'
1178210SN/A    cxx_class = 'StridePrefetcher'
1188210SN/A    cxx_header = "mem/cache/prefetch/stride.hh"
1198210SN/A
1208210SN/A    # Do not consult stride prefetcher on instruction accesses
1218210SN/A    on_inst = False
1228210SN/A
1238210SN/A    max_conf = Param.Int(7, "Maximum confidence level")
1248210SN/A    thresh_conf = Param.Int(4, "Threshold confidence level")
1258210SN/A    min_conf = Param.Int(0, "Minimum confidence level")
1268210SN/A    start_conf = Param.Int(4, "Starting confidence for new entries")
1278210SN/A
1288210SN/A    table_sets = Param.Int(16, "Number of sets in PC lookup table")
1298210SN/A    table_assoc = Param.Int(4, "Associativity of PC lookup table")
1308210SN/A    use_master_id = Param.Bool(True, "Use master id based history")
1318210SN/A
1328210SN/A    degree = Param.Int(4, "Number of prefetches to generate")
1338210SN/A
1348210SN/A    # Get replacement policy
1358210SN/A    replacement_policy = Param.BaseReplacementPolicy(RandomRP(),
1368210SN/A        "Replacement policy")
1378210SN/A
1388210SN/Aclass TaggedPrefetcher(QueuedPrefetcher):
1398210SN/A    type = 'TaggedPrefetcher'
1408210SN/A    cxx_class = 'TaggedPrefetcher'
1418210SN/A    cxx_header = "mem/cache/prefetch/tagged.hh"
1428210SN/A
1438210SN/A    degree = Param.Int(2, "Number of prefetches to generate")
1448210SN/A
1458210SN/Aclass IndirectMemoryPrefetcher(QueuedPrefetcher):
1468210SN/A    type = 'IndirectMemoryPrefetcher'
1478210SN/A    cxx_class = 'IndirectMemoryPrefetcher'
1488210SN/A    cxx_header = "mem/cache/prefetch/indirect_memory.hh"
1498210SN/A    pt_table_entries = Param.MemorySize("16",
1508210SN/A        "Number of entries of the Prefetch Table")
1518210SN/A    pt_table_assoc = Param.Unsigned(16, "Associativity of the Prefetch Table")
1528210SN/A    pt_table_indexing_policy = Param.BaseIndexingPolicy(
1538210SN/A        SetAssociative(entry_size = 1, assoc = Parent.pt_table_assoc,
1548210SN/A        size = Parent.pt_table_entries),
1558210SN/A        "Indexing policy of the pattern table")
1568210SN/A    pt_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
1578210SN/A        "Replacement policy of the pattern table")
1588210SN/A    max_prefetch_distance = Param.Unsigned(16, "Maximum prefetch distance")
1598210SN/A    max_indirect_counter_value = Param.Unsigned(8,
1608210SN/A        "Maximum value of the indirect counter")
1618210SN/A    ipd_table_entries = Param.MemorySize("4",
1628210SN/A        "Number of entries of the Indirect Pattern Detector")
1638210SN/A    ipd_table_assoc = Param.Unsigned(4,
1648210SN/A        "Associativity of the Indirect Pattern Detector")
1658210SN/A    ipd_table_indexing_policy = Param.BaseIndexingPolicy(
1668210SN/A        SetAssociative(entry_size = 1, assoc = Parent.ipd_table_assoc,
1678210SN/A        size = Parent.ipd_table_entries),
1688210SN/A        "Indexing policy of the Indirect Pattern Detector")
1698210SN/A    ipd_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
1708210SN/A        "Replacement policy of the Indirect Pattern Detector")
1718210SN/A    shift_values = VectorParam.Int([2, 3, 4, -3], "Shift values to evaluate")
1728210SN/A    addr_array_len = Param.Unsigned(4, "Number of misses tracked")
1738210SN/A    prefetch_threshold = Param.Unsigned(2,
1748210SN/A        "Counter threshold to start the indirect prefetching")
1758210SN/A    stream_counter_threshold = Param.Unsigned(4,
1768210SN/A        "Counter threshold to enable the stream prefetcher")
1778210SN/A    streaming_distance = Param.Unsigned(4,
1788210SN/A        "Number of prefetches to generate when using the stream prefetcher")
1798210SN/A
1808210SN/Aclass SignaturePathPrefetcher(QueuedPrefetcher):
1818210SN/A    type = 'SignaturePathPrefetcher'
1828210SN/A    cxx_class = 'SignaturePathPrefetcher'
1838210SN/A    cxx_header = "mem/cache/prefetch/signature_path.hh"
1848210SN/A
1858210SN/A    signature_shift = Param.UInt8(3,
1868210SN/A        "Number of bits to shift when calculating a new signature");
1878210SN/A    signature_bits = Param.UInt16(12,
1888210SN/A        "Size of the signature, in bits");
1898210SN/A    signature_table_entries = Param.MemorySize("1024",
1908210SN/A        "Number of entries of the signature table")
1918210SN/A    signature_table_assoc = Param.Unsigned(2,
1928210SN/A        "Associativity of the signature table")
1938210SN/A    signature_table_indexing_policy = Param.BaseIndexingPolicy(
1948210SN/A        SetAssociative(entry_size = 1, assoc = Parent.signature_table_assoc,
1958210SN/A        size = Parent.signature_table_entries),
1968210SN/A        "Indexing policy of the signature table")
1978210SN/A    signature_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
1988210SN/A        "Replacement policy of the signature table")
1998210SN/A
2008210SN/A    max_counter_value = Param.UInt8(7, "Maximum pattern counter value")
2018210SN/A    pattern_table_entries = Param.MemorySize("4096",
2028210SN/A        "Number of entries of the pattern table")
2038210SN/A    pattern_table_assoc = Param.Unsigned(1,
2048210SN/A        "Associativity of the pattern table")
2058210SN/A    strides_per_pattern_entry = Param.Unsigned(4,
2068210SN/A        "Number of strides stored in each pattern entry")
2078210SN/A    pattern_table_indexing_policy = Param.BaseIndexingPolicy(
2088210SN/A        SetAssociative(entry_size = 1, assoc = Parent.pattern_table_assoc,
2098210SN/A        size = Parent.pattern_table_entries),
2108210SN/A        "Indexing policy of the pattern table")
2118210SN/A    pattern_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
2128210SN/A        "Replacement policy of the pattern table")
2138210SN/A
2148210SN/A    prefetch_confidence_threshold = Param.Float(0.5,
2158210SN/A        "Minimum confidence to issue prefetches")
2168210SN/A    lookahead_confidence_threshold = Param.Float(0.75,
2178210SN/A        "Minimum confidence to continue exploring lookahead entries")
2188210SN/A
2198210SN/Aclass SignaturePathPrefetcherV2(SignaturePathPrefetcher):
2208210SN/A    type = 'SignaturePathPrefetcherV2'
2218210SN/A    cxx_class = 'SignaturePathPrefetcherV2'
2228210SN/A    cxx_header = "mem/cache/prefetch/signature_path_v2.hh"
2238210SN/A
2248210SN/A    signature_table_entries = "256"
2258210SN/A    signature_table_assoc = 1
2268210SN/A    pattern_table_entries = "512"
2278210SN/A    pattern_table_assoc = 1
2288210SN/A    max_counter_value = 15
2298210SN/A    prefetch_confidence_threshold = 0.25
2308210SN/A    lookahead_confidence_threshold = 0.25
2318210SN/A
2328210SN/A    global_history_register_entries = Param.MemorySize("8",
2338210SN/A        "Number of entries of global history register")
2348210SN/A    global_history_register_indexing_policy = Param.BaseIndexingPolicy(
2358210SN/A        SetAssociative(entry_size = 1,
2368210SN/A        assoc = Parent.global_history_register_entries,
2378210SN/A        size = Parent.global_history_register_entries),
2388210SN/A        "Indexing policy of the global history register")
2398210SN/A    global_history_register_replacement_policy = Param.BaseReplacementPolicy(
2408210SN/A        LRURP(), "Replacement policy of the global history register")
2418210SN/A
2428210SN/Aclass AccessMapPatternMatching(ClockedObject):
2438210SN/A    type = 'AccessMapPatternMatching'
2448210SN/A    cxx_class = 'AccessMapPatternMatching'
2458210SN/A    cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh"
2468210SN/A
2478210SN/A    block_size = Param.Unsigned(Parent.block_size,
2488210SN/A        "Cacheline size used by the prefetcher using this object")
2498210SN/A
2508210SN/A    limit_stride = Param.Unsigned(0,
2518210SN/A        "Limit the strides checked up to -X/X, if 0, disable the limit")
2528210SN/A    start_degree = Param.Unsigned(4,
2538210SN/A        "Initial degree (Maximum number of prefetches generated")
2548210SN/A    hot_zone_size = Param.MemorySize("2kB", "Memory covered by a hot zone")
2558210SN/A    access_map_table_entries = Param.MemorySize("256",
2568210SN/A        "Number of entries in the access map table")
2578210SN/A    access_map_table_assoc = Param.Unsigned(8,
2588210SN/A        "Associativity of the access map table")
2598210SN/A    access_map_table_indexing_policy = Param.BaseIndexingPolicy(
2608210SN/A        SetAssociative(entry_size = 1, assoc = Parent.access_map_table_assoc,
2618210SN/A        size = Parent.access_map_table_entries),
2628210SN/A        "Indexing policy of the access map table")
2638210SN/A    access_map_table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
2648210SN/A        "Replacement policy of the access map table")
2658210SN/A    high_coverage_threshold = Param.Float(0.25,
2668210SN/A        "A prefetch coverage factor bigger than this is considered high")
2678210SN/A    low_coverage_threshold = Param.Float(0.125,
2688210SN/A        "A prefetch coverage factor smaller than this is considered low")
2698210SN/A    high_accuracy_threshold = Param.Float(0.5,
2708210SN/A        "A prefetch accuracy factor bigger than this is considered high")
2718210SN/A    low_accuracy_threshold = Param.Float(0.25,
2728210SN/A        "A prefetch accuracy factor smaller than this is considered low")
2738210SN/A    high_cache_hit_threshold = Param.Float(0.875,
2748210SN/A        "A cache hit ratio bigger than this is considered high")
2758210SN/A    low_cache_hit_threshold = Param.Float(0.75,
2768210SN/A        "A cache hit ratio smaller than this is considered low")
2778210SN/A    epoch_cycles = Param.Cycles(256000, "Cycles in an epoch period")
2788210SN/A    offchip_memory_latency = Param.Latency("30ns",
2798210SN/A        "Memory latency used to compute the required memory bandwidth")
2808210SN/A
2818210SN/Aclass AMPMPrefetcher(QueuedPrefetcher):
2828210SN/A    type = 'AMPMPrefetcher'
2838210SN/A    cxx_class = 'AMPMPrefetcher'
2848210SN/A    cxx_header = "mem/cache/prefetch/access_map_pattern_matching.hh"
2858210SN/A    ampm = Param.AccessMapPatternMatching( AccessMapPatternMatching(),
2868210SN/A        "Access Map Pattern Matching object")
2878210SN/A
2888210SN/Aclass DeltaCorrelatingPredictionTables(SimObject):
2898210SN/A    type = 'DeltaCorrelatingPredictionTables'
2908210SN/A    cxx_class = 'DeltaCorrelatingPredictionTables'
2918210SN/A    cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh"
2928210SN/A    deltas_per_entry = Param.Unsigned(20,
2938210SN/A        "Number of deltas stored in each table entry")
2948210SN/A    delta_bits = Param.Unsigned(12, "Bits per delta")
2958210SN/A    delta_mask_bits = Param.Unsigned(8,
2968210SN/A        "Lower bits to mask when comparing deltas")
2978210SN/A    table_entries = Param.MemorySize("128",
2988210SN/A        "Number of entries in the table")
2998210SN/A    table_assoc = Param.Unsigned(128,
3008210SN/A        "Associativity of the table")
3018210SN/A    table_indexing_policy = Param.BaseIndexingPolicy(
3028210SN/A        SetAssociative(entry_size = 1, assoc = Parent.table_assoc,
3038210SN/A        size = Parent.table_entries),
3048210SN/A        "Indexing policy of the table")
3058210SN/A    table_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
3068210SN/A        "Replacement policy of the table")
3078210SN/A
3088210SN/Aclass DCPTPrefetcher(QueuedPrefetcher):
3098210SN/A    type = 'DCPTPrefetcher'
3108210SN/A    cxx_class = 'DCPTPrefetcher'
3118210SN/A    cxx_header = "mem/cache/prefetch/delta_correlating_prediction_tables.hh"
3128210SN/A    dcpt = Param.DeltaCorrelatingPredictionTables(
3138210SN/A        DeltaCorrelatingPredictionTables(),
3148210SN/A        "Delta Correlating Prediction Tables object")
3158210SN/A
3168210SN/Aclass IrregularStreamBufferPrefetcher(QueuedPrefetcher):
3178210SN/A    type = "IrregularStreamBufferPrefetcher"
3188210SN/A    cxx_class = "IrregularStreamBufferPrefetcher"
3198210SN/A    cxx_header = "mem/cache/prefetch/irregular_stream_buffer.hh"
3208210SN/A
3218210SN/A    max_counter_value = Param.Unsigned(3,
3228210SN/A        "Maximum value of the confidence counter")
3238210SN/A    chunk_size = Param.Unsigned(256,
3248210SN/A        "Maximum number of addresses in a temporal stream")
3258210SN/A    degree = Param.Unsigned(4, "Number of prefetches to generate")
3268210SN/A    training_unit_assoc = Param.Unsigned(128,
3278210SN/A        "Associativity of the training unit")
3288210SN/A    training_unit_entries = Param.MemorySize("128",
3298210SN/A        "Number of entries of the training unit")
3308210SN/A    training_unit_indexing_policy = Param.BaseIndexingPolicy(
3318210SN/A        SetAssociative(entry_size = 1, assoc = Parent.training_unit_assoc,
3328210SN/A        size = Parent.training_unit_entries),
3338210SN/A        "Indexing policy of the training unit")
3348210SN/A    training_unit_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
3358210SN/A        "Replacement policy of the training unit")
3368210SN/A
3378210SN/A    prefetch_candidates_per_entry = Param.Unsigned(16,
3388210SN/A        "Number of prefetch candidates stored in a SP-AMC entry")
3398210SN/A    address_map_cache_assoc = Param.Unsigned(128,
3408210SN/A        "Associativity of the PS/SP AMCs")
3418210SN/A    address_map_cache_entries = Param.MemorySize("128",
3428210SN/A        "Number of entries of the PS/SP AMCs")
3438210SN/A    ps_address_map_cache_indexing_policy = Param.BaseIndexingPolicy(
3448210SN/A        SetAssociative(entry_size = 1,
3458210SN/A        assoc = Parent.address_map_cache_assoc,
3468210SN/A        size = Parent.address_map_cache_entries),
3478210SN/A        "Indexing policy of the Physical-to-Structural Address Map Cache")
3488210SN/A    ps_address_map_cache_replacement_policy = Param.BaseReplacementPolicy(
3498210SN/A        LRURP(),
3508210SN/A        "Replacement policy of the Physical-to-Structural Address Map Cache")
3518210SN/A    sp_address_map_cache_indexing_policy = Param.BaseIndexingPolicy(
3528210SN/A        SetAssociative(entry_size = 1,
3538210SN/A        assoc = Parent.address_map_cache_assoc,
3548210SN/A        size = Parent.address_map_cache_entries),
3558210SN/A        "Indexing policy of the Structural-to-Physical Address Mao Cache")
3568210SN/A    sp_address_map_cache_replacement_policy = Param.BaseReplacementPolicy(
3578210SN/A        LRURP(),
3588210SN/A        "Replacement policy of the Structural-to-Physical Address Map Cache")
3598210SN/A
3608210SN/Aclass SlimAccessMapPatternMatching(AccessMapPatternMatching):
3618210SN/A    start_degree = 2
3628210SN/A    limit_stride = 4
3638210SN/A
3648210SN/Aclass SlimDeltaCorrelatingPredictionTables(DeltaCorrelatingPredictionTables):
3658210SN/A    table_entries = "256"
3668210SN/A    table_assoc = 256
3678210SN/A    deltas_per_entry = 9
3688210SN/A
3698210SN/Aclass SlimAMPMPrefetcher(QueuedPrefetcher):
3708210SN/A    type = 'SlimAMPMPrefetcher'
3718210SN/A    cxx_class = 'SlimAMPMPrefetcher'
3728210SN/A    cxx_header = "mem/cache/prefetch/slim_ampm.hh"
3738210SN/A
3748210SN/A    ampm = Param.AccessMapPatternMatching(SlimAccessMapPatternMatching(),
3758210SN/A        "Access Map Pattern Matching object")
3768210SN/A    dcpt = Param.DeltaCorrelatingPredictionTables(
3778210SN/A        SlimDeltaCorrelatingPredictionTables(),
3788210SN/A        "Delta Correlating Prediction Tables object")
3798210SN/A
3808210SN/Aclass BOPPrefetcher(QueuedPrefetcher):
3818210SN/A    type = "BOPPrefetcher"
3828210SN/A    cxx_class = "BOPPrefetcher"
3838210SN/A    cxx_header = "mem/cache/prefetch/bop.hh"
3848210SN/A    score_max = Param.Unsigned(31, "Max. score to update the best offset")
3858210SN/A    round_max = Param.Unsigned(100, "Max. round to update the best offset")
3868210SN/A    bad_score = Param.Unsigned(10, "Score at which the HWP is disabled")
3878210SN/A    rr_size = Param.Unsigned(64, "Number of entries of each RR bank")
3888210SN/A    tag_bits = Param.Unsigned(12, "Bits used to store the tag")
3898210SN/A    offset_list_size = Param.Unsigned(46,
3908210SN/A                "Number of entries in the offsets list")
3918210SN/A    negative_offsets_enable = Param.Bool(True,
3928210SN/A                "Initialize the offsets list also with negative values \
3938210SN/A                (i.e. the table will have half of the entries with positive \
3948210SN/A                offsets and the other half with negative ones)")
3958210SN/A    delay_queue_enable = Param.Bool(True, "Enable the delay queue")
3968210SN/A    delay_queue_size = Param.Unsigned(15,
3978210SN/A                "Number of entries in the delay queue")
3988210SN/A    delay_queue_cycles = Param.Cycles(60,
3998210SN/A                "Cycles to delay a write in the left RR table from the delay \
4008210SN/A                queue")
4018210SN/A
4028210SN/Aclass SBOOEPrefetcher(QueuedPrefetcher):
4038210SN/A    type = 'SBOOEPrefetcher'
4048210SN/A    cxx_class = 'SBOOEPrefetcher'
4058210SN/A    cxx_header = "mem/cache/prefetch/sbooe.hh"
4068210SN/A    latency_buffer_size = Param.Int(32, "Entries in the latency buffer")
4078210SN/A    sequential_prefetchers = Param.Int(9, "Number of sequential prefetchers")
4088210SN/A    sandbox_entries = Param.Int(1024, "Size of the address buffer")
4098210SN/A    score_threshold_pct = Param.Percent(25, "Min. threshold to issue a \
4108210SN/A        prefetch. The value is the percentage of sandbox entries to use")
4118210SN/A
4128210SN/Aclass STeMSPrefetcher(QueuedPrefetcher):
4138210SN/A    type = "STeMSPrefetcher"
4148210SN/A    cxx_class = "STeMSPrefetcher"
4158210SN/A    cxx_header = "mem/cache/prefetch/spatio_temporal_memory_streaming.hh"
4168210SN/A
4178210SN/A    spatial_region_size = Param.MemorySize("2kB",
4188210SN/A        "Memory covered by a hot zone")
4198210SN/A    active_generation_table_entries = Param.MemorySize("64",
4208210SN/A        "Number of entries in the active generation table")
4218210SN/A    active_generation_table_assoc = Param.Unsigned(64,
4228210SN/A        "Associativity of the active generation table")
4238210SN/A    active_generation_table_indexing_policy = Param.BaseIndexingPolicy(
4248210SN/A        SetAssociative(entry_size = 1,
4258210SN/A            assoc = Parent.active_generation_table_assoc,
4268210SN/A            size = Parent.active_generation_table_entries),
4278210SN/A        "Indexing policy of the active generation table")
4288210SN/A    active_generation_table_replacement_policy = Param.BaseReplacementPolicy(
4298210SN/A        LRURP(), "Replacement policy of the active generation table")
4308210SN/A
4318210SN/A    pattern_sequence_table_entries = Param.MemorySize("16384",
4328210SN/A        "Number of entries in the pattern sequence table")
4338210SN/A    pattern_sequence_table_assoc = Param.Unsigned(16384,
4348210SN/A        "Associativity of the pattern sequence table")
4358210SN/A    pattern_sequence_table_indexing_policy = Param.BaseIndexingPolicy(
4368210SN/A        SetAssociative(entry_size = 1,
4378210SN/A            assoc = Parent.pattern_sequence_table_assoc,
4388210SN/A            size = Parent.pattern_sequence_table_entries),
4398210SN/A        "Indexing policy of the pattern sequence table")
4408210SN/A    pattern_sequence_table_replacement_policy = Param.BaseReplacementPolicy(
4418210SN/A        LRURP(), "Replacement policy of the pattern sequence table")
4428210SN/A
4438210SN/A    region_miss_order_buffer_entries = Param.Unsigned(131072,
4448210SN/A        "Number of entries of the Region Miss Order Buffer")
4458210SN/A    reconstruction_entries = Param.Unsigned(256,
4468210SN/A        "Number of reconstruction entries")
4478210SN/A
4488210SN/Aclass HWPProbeEventRetiredInsts(HWPProbeEvent):
4498210SN/A    def register(self):
4508210SN/A        if self.obj:
4518210SN/A            for name in self.names:
4528210SN/A                self.prefetcher.getCCObject().addEventProbeRetiredInsts(
4538210SN/A                    self.obj.getCCObject(), name)
4548210SN/A
4558210SN/Aclass PIFPrefetcher(QueuedPrefetcher):
4568210SN/A    type = 'PIFPrefetcher'
4578210SN/A    cxx_class = 'PIFPrefetcher'
4588210SN/A    cxx_header = "mem/cache/prefetch/pif.hh"
4598210SN/A    cxx_exports = [
4608210SN/A        PyBindMethod("addEventProbeRetiredInsts"),
4618210SN/A    ]
4628210SN/A
4638210SN/A    prec_spatial_region_bits = Param.Unsigned(2,
4648210SN/A        "Number of preceding addresses in the spatial region")
4658210SN/A    succ_spatial_region_bits = Param.Unsigned(8,
4668210SN/A        "Number of subsequent addresses in the spatial region")
4678210SN/A    compactor_entries = Param.Unsigned(2, "Entries in the temp. compactor")
4688210SN/A    stream_address_buffer_entries = Param.Unsigned(7, "Entries in the SAB")
4698210SN/A    history_buffer_size = Param.Unsigned(16, "Entries in the history buffer")
4708210SN/A
4718210SN/A    index_entries = Param.MemorySize("64",
4728210SN/A        "Number of entries in the index")
4738210SN/A    index_assoc = Param.Unsigned(64,
4748210SN/A        "Associativity of the index")
4758210SN/A    index_indexing_policy = Param.BaseIndexingPolicy(
4768210SN/A        SetAssociative(entry_size = 1, assoc = Parent.index_assoc,
4778210SN/A        size = Parent.index_entries),
4788210SN/A        "Indexing policy of the index")
4798210SN/A    index_replacement_policy = Param.BaseReplacementPolicy(LRURP(),
4808210SN/A        "Replacement policy of the index")
4818210SN/A
4828210SN/A    def listenFromProbeRetiredInstructions(self, simObj):
4838210SN/A        if not isinstance(simObj, SimObject):
4848210SN/A            raise TypeError("argument must be of SimObject type")
4858210SN/A        self.addEvent(HWPProbeEventRetiredInsts(self, simObj,"RetiredInstsPC"))
4868210SN/A