Cache.py revision 9338
14776Sgblack@eecs.umich.edu# Copyright (c) 2012 ARM Limited 26365Sgblack@eecs.umich.edu# All rights reserved. 34776Sgblack@eecs.umich.edu# 44776Sgblack@eecs.umich.edu# The license below extends only to copyright in the software and shall 54776Sgblack@eecs.umich.edu# not be construed as granting a license to any other intellectual 64776Sgblack@eecs.umich.edu# property including but not limited to intellectual property relating 74776Sgblack@eecs.umich.edu# to a hardware implementation of the functionality of the software 84776Sgblack@eecs.umich.edu# licensed hereunder. You may use the software subject to the license 94776Sgblack@eecs.umich.edu# terms below provided that you ensure that this notice is replicated 104776Sgblack@eecs.umich.edu# unmodified and in its entirety in all distributions of the software, 114776Sgblack@eecs.umich.edu# modified or unmodified, in source code or in binary form. 124776Sgblack@eecs.umich.edu# 134776Sgblack@eecs.umich.edu# Copyright (c) 2005-2007 The Regents of The University of Michigan 144776Sgblack@eecs.umich.edu# All rights reserved. 154776Sgblack@eecs.umich.edu# 164776Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 174776Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 184776Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 194776Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 204776Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 214776Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 224776Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 234776Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 244776Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from 254776Sgblack@eecs.umich.edu# this software without specific prior written permission. 264776Sgblack@eecs.umich.edu# 274776Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 286365Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 294776Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 304776Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3111793Sbrandon.potter@amd.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3211793Sbrandon.potter@amd.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 334776Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 344776Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 358232Snate@binkert.org# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 364776Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 374776Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 384776Sgblack@eecs.umich.edu# 394776Sgblack@eecs.umich.edu# Authors: Nathan Binkert 404776Sgblack@eecs.umich.edu 414776Sgblack@eecs.umich.edufrom m5.params import * 425523Snate@binkert.orgfrom m5.proxy import * 436409Sgblack@eecs.umich.edufrom MemObject import MemObject 444776Sgblack@eecs.umich.edufrom Prefetcher import BasePrefetcher 455523Snate@binkert.org 465523Snate@binkert.org 475523Snate@binkert.orgclass BaseCache(MemObject): 484776Sgblack@eecs.umich.edu type = 'BaseCache' 4911321Ssteve.reinhardt@amd.com cxx_header = "mem/cache/base.hh" 504776Sgblack@eecs.umich.edu assoc = Param.Int("associativity") 514776Sgblack@eecs.umich.edu block_size = Param.Int("block size in bytes") 524776Sgblack@eecs.umich.edu hit_latency = Param.Cycles("The hit latency for this cache") 534776Sgblack@eecs.umich.edu response_latency = Param.Cycles( 544776Sgblack@eecs.umich.edu "Additional cache latency for the return path to core on a miss"); 554776Sgblack@eecs.umich.edu hash_delay = Param.Cycles(1, "time in cycles of hash access") 565049Sgblack@eecs.umich.edu max_miss_count = Param.Counter(0, 575049Sgblack@eecs.umich.edu "number of misses to handle before calling exit") 584776Sgblack@eecs.umich.edu mshrs = Param.Int("number of MSHRs (max outstanding requests)") 594776Sgblack@eecs.umich.edu prioritizeRequests = Param.Bool(False, 604776Sgblack@eecs.umich.edu "always service demand misses first") 614776Sgblack@eecs.umich.edu repl = Param.Repl(NULL, "replacement policy") 624776Sgblack@eecs.umich.edu size = Param.MemorySize("capacity in bytes") 636365Sgblack@eecs.umich.edu forward_snoops = Param.Bool(True, 646365Sgblack@eecs.umich.edu "forward snoops from mem side to cpu side") 654830Sgblack@eecs.umich.edu is_top_level = Param.Bool(False, "Is this cache at the top level (e.g. L1)") 664830Sgblack@eecs.umich.edu subblock_size = Param.Int(0, 677811Ssteve.reinhardt@amd.com "Size of subblock in IIC used for compression") 68 tgts_per_mshr = Param.Int("max number of accesses per MSHR") 69 trace_addr = Param.Addr(0, "address to trace") 70 two_queue = Param.Bool(False, 71 "whether the lifo should have two queue replacement") 72 write_buffers = Param.Int(8, "number of write buffers") 73 prefetch_on_access = Param.Bool(False, 74 "notify the hardware prefetcher on every access (not just misses)") 75 prefetcher = Param.BasePrefetcher(NULL,"Prefetcher attached to cache") 76 cpu_side = SlavePort("Port on side closer to CPU") 77 mem_side = MasterPort("Port on side closer to MEM") 78 addr_ranges = VectorParam.AddrRange([AllMemory], "The address range for the CPU-side port") 79 system = Param.System(Parent.any, "System we belong to") 80