1# Copyright (c) 2015 ARM Limited 2# All rights reserved. 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 25 unchanged lines hidden (view full) --- 34# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 35# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 36# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38# 39# Authors: Ron Dreslinski 40# Andreas Hansson 41 |
42from __future__ import print_function 43 |
44import optparse 45import random 46import sys 47 48import m5 49from m5.objects import * 50 51# This example script stress tests the memory system by creating false --- 52 unchanged lines hidden (view full) --- 104parser.add_option("--sys-clock", action="store", type="string", 105 default='1GHz', 106 help = """Top-level clock for blocks running at system 107 speed""") 108 109(options, args) = parser.parse_args() 110 111if args: |
112 print("Error: script doesn't take any positional arguments") |
113 sys.exit(1) 114 115# Get the total number of testers 116def numtesters(cachespec, testerspec): 117 # Determine the tester multiplier for each level as the 118 # elements are per subsystem and it fans out 119 multiplier = [1] 120 for c in cachespec: --- 13 unchanged lines hidden (view full) --- 134 # Generate a tree with a valid number of testers 135 while True: 136 tree_depth = random.randint(1, 4) 137 cachespec = [random.randint(1, 3) for i in range(tree_depth)] 138 testerspec = [random.randint(1, 3) for i in range(tree_depth + 1)] 139 if numtesters(cachespec, testerspec) < block_size: 140 break 141 |
142 print("Generated random tree -c", ':'.join(map(str, cachespec)), 143 "-t", ':'.join(map(str, testerspec))) |
144else: 145 try: 146 cachespec = [int(x) for x in options.caches.split(':')] 147 testerspec = [int(x) for x in options.testers.split(':')] 148 except: |
149 print("Error: Unable to parse caches or testers option") |
150 sys.exit(1) 151 152 if len(cachespec) < 1: |
153 print("Error: Must have at least one level of caches") |
154 sys.exit(1) 155 156 if len(cachespec) != len(testerspec) - 1: |
157 print("Error: Testers must have one element more than caches") |
158 sys.exit(1) 159 160 if testerspec[-1] == 0: |
161 print("Error: Must have testers at the uppermost level") |
162 sys.exit(1) 163 164 for t in testerspec: 165 if t < 0: |
166 print("Error: Cannot have a negative number of testers") |
167 sys.exit(1) 168 169 for c in cachespec: 170 if c < 1: |
171 print("Error: Must have 1 or more caches at each level") |
172 sys.exit(1) 173 174 if numtesters(cachespec, testerspec) > block_size: |
175 print("Error: Limited to %s testers because of false sharing" 176 % (block_size)) |
177 sys.exit(1) 178 179# Define a prototype L1 cache that we scale for all successive levels 180proto_l1 = Cache(size = '32kB', assoc = 4, 181 tag_latency = 1, data_latency = 1, response_latency = 1, 182 tgts_per_mshr = 8, clusivity = 'mostly_incl', 183 writeback_clean = True) 184 --- 92 unchanged lines hidden (view full) --- 277 for cache in tree_caches: 278 cache.mem_side = xbar.slave 279 make_cache_level(ncaches[1:], prototypes[1:], level - 1, cache) 280 for tester, cache in zip(testers, tester_caches): 281 tester.port = cache.cpu_side 282 cache.mem_side = xbar.slave 283 else: 284 if not next_cache: |
285 print("Error: No next-level cache at top level") |
286 sys.exit(1) 287 288 if ntesters > 1: 289 # Create a crossbar and add it to the subsystem 290 xbar = L2XBar() 291 subsys.xbar = xbar 292 xbar.master = next_cache.cpu_side 293 for tester in testers: --- 21 unchanged lines hidden (view full) --- 315root.system.system_port = last_subsys.xbar.slave 316 317# Instantiate configuration 318m5.instantiate() 319 320# Simulate until program terminates 321exit_event = m5.simulate(options.maxtick) 322 |
323print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()) |