Cache.py revision 10884
110923SN/A# Copyright (c) 2012-2013, 2015 ARM Limited
210923SN/A# All rights reserved.
310923SN/A#
410923SN/A# The license below extends only to copyright in the software and shall
510923SN/A# not be construed as granting a license to any other intellectual
610923SN/A# property including but not limited to intellectual property relating
710923SN/A# to a hardware implementation of the functionality of the software
810923SN/A# licensed hereunder.  You may use the software subject to the license
910923SN/A# terms below provided that you ensure that this notice is replicated
1010923SN/A# unmodified and in its entirety in all distributions of the software,
1110923SN/A# modified or unmodified, in source code or in binary form.
1210923SN/A#
1310923SN/A# Copyright (c) 2005-2007 The Regents of The University of Michigan
1410923SN/A# All rights reserved.
1510923SN/A#
1610923SN/A# Redistribution and use in source and binary forms, with or without
1710923SN/A# modification, are permitted provided that the following conditions are
1810923SN/A# met: redistributions of source code must retain the above copyright
1910923SN/A# notice, this list of conditions and the following disclaimer;
2010923SN/A# redistributions in binary form must reproduce the above copyright
2110923SN/A# notice, this list of conditions and the following disclaimer in the
2210923SN/A# documentation and/or other materials provided with the distribution;
2310923SN/A# neither the name of the copyright holders nor the names of its
2410923SN/A# contributors may be used to endorse or promote products derived from
2510923SN/A# this software without specific prior written permission.
2610923SN/A#
2710923SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2810923SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2910923SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
3010923SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
3110923SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
3210923SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3310923SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3410923SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3510923SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3610923SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3710923SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3810923SN/A#
3910923SN/A# Authors: Nathan Binkert
4010923SN/A
4111290Sgabor.dozsa@arm.comfrom m5.params import *
4210923SN/Afrom m5.proxy import *
4310923SN/Afrom MemObject import MemObject
4411290Sgabor.dozsa@arm.comfrom Prefetcher import BasePrefetcher
4510923SN/Afrom Tags import *
4610923SN/A
4710923SN/Aclass BaseCache(MemObject):
4810923SN/A    type = 'BaseCache'
4910923SN/A    cxx_header = "mem/cache/base.hh"
5010923SN/A
5110923SN/A    size = Param.MemorySize("Capacity")
5210923SN/A    assoc = Param.Unsigned("Associativity")
5310923SN/A
5410923SN/A    hit_latency = Param.Cycles("Hit latency")
5510923SN/A    response_latency = Param.Cycles("Latency for the return path on a miss");
5610923SN/A
5711290Sgabor.dozsa@arm.com    max_miss_count = Param.Counter(0,
5811290Sgabor.dozsa@arm.com        "Number of misses to handle before calling exit")
5910923SN/A
6011290Sgabor.dozsa@arm.com    mshrs = Param.Unsigned("Number of MSHRs (max outstanding requests)")
6111263SN/A    demand_mshr_reserve = Param.Unsigned(1, "MSHRs reserved for demand access")
6211263SN/A    tgts_per_mshr = Param.Unsigned("Max number of accesses per MSHR")
6311263SN/A    write_buffers = Param.Unsigned(8, "Number of write buffers")
6411263SN/A
6511263SN/A    forward_snoops = Param.Bool(True,
6611263SN/A        "Forward snoops from mem side to cpu side")
6710923SN/A    is_top_level = Param.Bool(False, "Is this cache at the top level (e.g. L1)")
6810923SN/A    is_read_only = Param.Bool(False, "Is this cache read only (e.g. inst)")
6910923SN/A
7010923SN/A    prefetcher = Param.BasePrefetcher(NULL,"Prefetcher attached to cache")
7110923SN/A    prefetch_on_access = Param.Bool(False,
7210923SN/A         "Notify the hardware prefetcher on every access (not just misses)")
7310923SN/A
7411290Sgabor.dozsa@arm.com    tags = Param.BaseTags(LRU(), "Tag store (replacement policy)")
7513766Sgabeblack@google.com    sequential_access = Param.Bool(False,
7610923SN/A        "Whether to access tags and data sequentially")
7711290Sgabor.dozsa@arm.com
7811290Sgabor.dozsa@arm.com    cpu_side = SlavePort("Upstream port closer to the CPU and/or device")
7910923SN/A    mem_side = MasterPort("Downstream port closer to memory")
8010923SN/A
8110923SN/A    addr_ranges = VectorParam.AddrRange([AllMemory],
8210923SN/A         "Address range for the CPU-side port (to allow striping)")
8310923SN/A
8411290Sgabor.dozsa@arm.com    system = Param.System(Parent.any, "System we belong to")
8511290Sgabor.dozsa@arm.com