Cache.py revision 9338
15132Sgblack@eecs.umich.edu# Copyright (c) 2012 ARM Limited
25132Sgblack@eecs.umich.edu# All rights reserved.
35132Sgblack@eecs.umich.edu#
45132Sgblack@eecs.umich.edu# The license below extends only to copyright in the software and shall
55132Sgblack@eecs.umich.edu# not be construed as granting a license to any other intellectual
65132Sgblack@eecs.umich.edu# property including but not limited to intellectual property relating
75132Sgblack@eecs.umich.edu# to a hardware implementation of the functionality of the software
85132Sgblack@eecs.umich.edu# licensed hereunder.  You may use the software subject to the license
95132Sgblack@eecs.umich.edu# terms below provided that you ensure that this notice is replicated
105132Sgblack@eecs.umich.edu# unmodified and in its entirety in all distributions of the software,
115132Sgblack@eecs.umich.edu# modified or unmodified, in source code or in binary form.
125132Sgblack@eecs.umich.edu#
135132Sgblack@eecs.umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan
145132Sgblack@eecs.umich.edu# All rights reserved.
155132Sgblack@eecs.umich.edu#
165132Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
175132Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are
185132Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright
195132Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
205132Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
215132Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
225132Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution;
235132Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its
245132Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from
255132Sgblack@eecs.umich.edu# this software without specific prior written permission.
265132Sgblack@eecs.umich.edu#
275132Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
285132Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
295132Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
305132Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
315132Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
325132Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
335132Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
345132Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
355132Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
365132Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
375132Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
385132Sgblack@eecs.umich.edu#
395132Sgblack@eecs.umich.edu# Authors: Nathan Binkert
405132Sgblack@eecs.umich.edu
415132Sgblack@eecs.umich.edufrom m5.params import *
425132Sgblack@eecs.umich.edufrom m5.proxy import *
435132Sgblack@eecs.umich.edufrom MemObject import MemObject
445132Sgblack@eecs.umich.edufrom Prefetcher import BasePrefetcher
455132Sgblack@eecs.umich.edu
465132Sgblack@eecs.umich.edu
475132Sgblack@eecs.umich.educlass BaseCache(MemObject):
485132Sgblack@eecs.umich.edu    type = 'BaseCache'
495132Sgblack@eecs.umich.edu    cxx_header = "mem/cache/base.hh"
505132Sgblack@eecs.umich.edu    assoc = Param.Int("associativity")
515132Sgblack@eecs.umich.edu    block_size = Param.Int("block size in bytes")
525132Sgblack@eecs.umich.edu    hit_latency = Param.Cycles("The hit latency for this cache")
535132Sgblack@eecs.umich.edu    response_latency = Param.Cycles(
545132Sgblack@eecs.umich.edu            "Additional cache latency for the return path to core on a miss");
555132Sgblack@eecs.umich.edu    hash_delay = Param.Cycles(1, "time in cycles of hash access")
565132Sgblack@eecs.umich.edu    max_miss_count = Param.Counter(0,
575132Sgblack@eecs.umich.edu        "number of misses to handle before calling exit")
585612Sgblack@eecs.umich.edu    mshrs = Param.Int("number of MSHRs (max outstanding requests)")
595625Sgblack@eecs.umich.edu    prioritizeRequests = Param.Bool(False,
605299Sgblack@eecs.umich.edu        "always service demand misses first")
615132Sgblack@eecs.umich.edu    repl = Param.Repl(NULL, "replacement policy")
625132Sgblack@eecs.umich.edu    size = Param.MemorySize("capacity in bytes")
635625Sgblack@eecs.umich.edu    forward_snoops = Param.Bool(True,
645132Sgblack@eecs.umich.edu        "forward snoops from mem side to cpu side")
655132Sgblack@eecs.umich.edu    is_top_level = Param.Bool(False, "Is this cache at the top level (e.g. L1)")
665625Sgblack@eecs.umich.edu    subblock_size = Param.Int(0,
675132Sgblack@eecs.umich.edu        "Size of subblock in IIC used for compression")
685299Sgblack@eecs.umich.edu    tgts_per_mshr = Param.Int("max number of accesses per MSHR")
695132Sgblack@eecs.umich.edu    trace_addr = Param.Addr(0, "address to trace")
705132Sgblack@eecs.umich.edu    two_queue = Param.Bool(False,
715132Sgblack@eecs.umich.edu        "whether the lifo should have two queue replacement")
725132Sgblack@eecs.umich.edu    write_buffers = Param.Int(8, "number of write buffers")
735132Sgblack@eecs.umich.edu    prefetch_on_access = Param.Bool(False,
745299Sgblack@eecs.umich.edu         "notify the hardware prefetcher on every access (not just misses)")
755299Sgblack@eecs.umich.edu    prefetcher = Param.BasePrefetcher(NULL,"Prefetcher attached to cache")
765132Sgblack@eecs.umich.edu    cpu_side = SlavePort("Port on side closer to CPU")
775625Sgblack@eecs.umich.edu    mem_side = MasterPort("Port on side closer to MEM")
785625Sgblack@eecs.umich.edu    addr_ranges = VectorParam.AddrRange([AllMemory], "The address range for the CPU-side port")
795625Sgblack@eecs.umich.edu    system = Param.System(Parent.any, "System we belong to")
805627Sgblack@eecs.umich.edu