Prefetcher.py revision 10466
19288Sandreas.hansson@arm.com# Copyright (c) 2012 ARM Limited
29288Sandreas.hansson@arm.com# All rights reserved.
39288Sandreas.hansson@arm.com#
49288Sandreas.hansson@arm.com# The license below extends only to copyright in the software and shall
59288Sandreas.hansson@arm.com# not be construed as granting a license to any other intellectual
69288Sandreas.hansson@arm.com# property including but not limited to intellectual property relating
79288Sandreas.hansson@arm.com# to a hardware implementation of the functionality of the software
89288Sandreas.hansson@arm.com# licensed hereunder.  You may use the software subject to the license
99288Sandreas.hansson@arm.com# terms below provided that you ensure that this notice is replicated
109288Sandreas.hansson@arm.com# unmodified and in its entirety in all distributions of the software,
119288Sandreas.hansson@arm.com# modified or unmodified, in source code or in binary form.
129288Sandreas.hansson@arm.com#
139288Sandreas.hansson@arm.com# Copyright (c) 2005 The Regents of The University of Michigan
149288Sandreas.hansson@arm.com# All rights reserved.
159288Sandreas.hansson@arm.com#
169288Sandreas.hansson@arm.com# Redistribution and use in source and binary forms, with or without
179288Sandreas.hansson@arm.com# modification, are permitted provided that the following conditions are
189288Sandreas.hansson@arm.com# met: redistributions of source code must retain the above copyright
199288Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer;
209288Sandreas.hansson@arm.com# redistributions in binary form must reproduce the above copyright
219288Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer in the
229288Sandreas.hansson@arm.com# documentation and/or other materials provided with the distribution;
239288Sandreas.hansson@arm.com# neither the name of the copyright holders nor the names of its
249288Sandreas.hansson@arm.com# contributors may be used to endorse or promote products derived from
259288Sandreas.hansson@arm.com# this software without specific prior written permission.
269288Sandreas.hansson@arm.com#
279288Sandreas.hansson@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
289288Sandreas.hansson@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
299288Sandreas.hansson@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
309288Sandreas.hansson@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
319288Sandreas.hansson@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
329288Sandreas.hansson@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
339288Sandreas.hansson@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
349288Sandreas.hansson@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
359288Sandreas.hansson@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
369288Sandreas.hansson@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
379288Sandreas.hansson@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
389288Sandreas.hansson@arm.com#
399288Sandreas.hansson@arm.com# Authors: Ron Dreslinski
409288Sandreas.hansson@arm.com
419288Sandreas.hansson@arm.comfrom ClockedObject import ClockedObject
428831Smrinmoy.ghosh@arm.comfrom m5.params import *
438832SAli.Saidi@ARM.comfrom m5.proxy import *
448832SAli.Saidi@ARM.com
459288Sandreas.hansson@arm.comclass BasePrefetcher(ClockedObject):
468831Smrinmoy.ghosh@arm.com    type = 'BasePrefetcher'
478831Smrinmoy.ghosh@arm.com    abstract = True
489338SAndreas.Sandberg@arm.com    cxx_header = "mem/cache/prefetch/base.hh"
498831Smrinmoy.ghosh@arm.com    size = Param.Int(100,
508831Smrinmoy.ghosh@arm.com         "Number of entries in the hardware prefetch queue")
518831Smrinmoy.ghosh@arm.com    cross_pages = Param.Bool(False,
528831Smrinmoy.ghosh@arm.com         "Allow prefetches to cross virtual page boundaries")
538831Smrinmoy.ghosh@arm.com    serial_squash = Param.Bool(False,
548831Smrinmoy.ghosh@arm.com         "Squash prefetches with a later time on a subsequent miss")
558831Smrinmoy.ghosh@arm.com    degree = Param.Int(1,
568831Smrinmoy.ghosh@arm.com         "Degree of the prefetch depth")
579288Sandreas.hansson@arm.com    latency = Param.Cycles('1', "Latency of the prefetcher")
588832SAli.Saidi@ARM.com    use_master_id = Param.Bool(True,
598832SAli.Saidi@ARM.com         "Use the master id to separate calculations of prefetches")
608831Smrinmoy.ghosh@arm.com    data_accesses_only = Param.Bool(False,
618831Smrinmoy.ghosh@arm.com         "Only prefetch on data not on instruction accesses")
6210052Smitch.hayenga+gem5@gmail.com    on_miss_only = Param.Bool(False,
6310052Smitch.hayenga+gem5@gmail.com         "Only prefetch on miss (as opposed to always)")
6410052Smitch.hayenga+gem5@gmail.com    on_read_only = Param.Bool(False,
6510052Smitch.hayenga+gem5@gmail.com         "Only prefetch on read requests (write requests ignored)")
6610052Smitch.hayenga+gem5@gmail.com    on_prefetch = Param.Bool(True,
6710052Smitch.hayenga+gem5@gmail.com         "Let lower cache prefetcher train on prefetch requests")
6810053Smitch.hayenga+gem5@gmail.com    inst_tagged = Param.Bool(True,
6910053Smitch.hayenga+gem5@gmail.com         "Perform a tagged prefetch for instruction fetches always")
7010466Sandreas.hansson@arm.com    sys = Param.System(Parent.any, "System this prefetcher belongs to")
718831Smrinmoy.ghosh@arm.com
728831Smrinmoy.ghosh@arm.comclass StridePrefetcher(BasePrefetcher):
738831Smrinmoy.ghosh@arm.com    type = 'StridePrefetcher'
748831Smrinmoy.ghosh@arm.com    cxx_class = 'StridePrefetcher'
759338SAndreas.Sandberg@arm.com    cxx_header = "mem/cache/prefetch/stride.hh"
768831Smrinmoy.ghosh@arm.com
778831Smrinmoy.ghosh@arm.comclass TaggedPrefetcher(BasePrefetcher):
788831Smrinmoy.ghosh@arm.com    type = 'TaggedPrefetcher'
798831Smrinmoy.ghosh@arm.com    cxx_class = 'TaggedPrefetcher'
809338SAndreas.Sandberg@arm.com    cxx_header = "mem/cache/prefetch/tagged.hh"
818831Smrinmoy.ghosh@arm.com
828831Smrinmoy.ghosh@arm.com
838831Smrinmoy.ghosh@arm.com
848831Smrinmoy.ghosh@arm.com
85