memcheck.py (11837:17b37f38944a) | memcheck.py (12564:2778478ca882) |
---|---|
1# Copyright (c) 2015-2016 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 | 1# Copyright (c) 2015-2016 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 |
|
42import optparse 43import random 44import sys 45 46import m5 47from m5.objects import * 48 49parser = optparse.OptionParser() --- 53 unchanged lines hidden (view full) --- 103parser.add_option("--sys-clock", action="store", type="string", 104 default='1GHz', 105 help = """Top-level clock for blocks running at system 106 speed""") 107 108(options, args) = parser.parse_args() 109 110if args: | 44import optparse 45import random 46import sys 47 48import m5 49from m5.objects import * 50 51parser = optparse.OptionParser() --- 53 unchanged lines hidden (view full) --- 105parser.add_option("--sys-clock", action="store", type="string", 106 default='1GHz', 107 help = """Top-level clock for blocks running at system 108 speed""") 109 110(options, args) = parser.parse_args() 111 112if args: |
111 print "Error: script doesn't take any positional arguments" | 113 print("Error: script doesn't take any positional arguments") |
112 sys.exit(1) 113 114# Start by parsing the command line options and do some basic sanity 115# checking 116if options.random: 117 # Generate a tree with a valid number of testers 118 tree_depth = random.randint(1, 4) 119 cachespec = [random.randint(1, 3) for i in range(tree_depth)] 120 testerspec = [random.randint(1, 3) for i in range(tree_depth + 1)] | 114 sys.exit(1) 115 116# Start by parsing the command line options and do some basic sanity 117# checking 118if options.random: 119 # Generate a tree with a valid number of testers 120 tree_depth = random.randint(1, 4) 121 cachespec = [random.randint(1, 3) for i in range(tree_depth)] 122 testerspec = [random.randint(1, 3) for i in range(tree_depth + 1)] |
121 print "Generated random tree -c", ':'.join(map(str, cachespec)), \ 122 "-t", ':'.join(map(str, testerspec)) | 123 print("Generated random tree -c", ':'.join(map(str, cachespec)), 124 "-t", ':'.join(map(str, testerspec))) |
123else: 124 try: 125 cachespec = [int(x) for x in options.caches.split(':')] 126 testerspec = [int(x) for x in options.testers.split(':')] 127 except: | 125else: 126 try: 127 cachespec = [int(x) for x in options.caches.split(':')] 128 testerspec = [int(x) for x in options.testers.split(':')] 129 except: |
128 print "Error: Unable to parse caches or testers option" | 130 print("Error: Unable to parse caches or testers option") |
129 sys.exit(1) 130 131 if len(cachespec) < 1: | 131 sys.exit(1) 132 133 if len(cachespec) < 1: |
132 print "Error: Must have at least one level of caches" | 134 print("Error: Must have at least one level of caches") |
133 sys.exit(1) 134 135 if len(cachespec) != len(testerspec) - 1: | 135 sys.exit(1) 136 137 if len(cachespec) != len(testerspec) - 1: |
136 print "Error: Testers must have one element more than caches" | 138 print("Error: Testers must have one element more than caches") |
137 sys.exit(1) 138 139 if testerspec[-1] == 0: | 139 sys.exit(1) 140 141 if testerspec[-1] == 0: |
140 print "Error: Must have testers at the uppermost level" | 142 print("Error: Must have testers at the uppermost level") |
141 sys.exit(1) 142 143 for t in testerspec: 144 if t < 0: | 143 sys.exit(1) 144 145 for t in testerspec: 146 if t < 0: |
145 print "Error: Cannot have a negative number of testers" | 147 print("Error: Cannot have a negative number of testers") |
146 sys.exit(1) 147 148 for c in cachespec: 149 if c < 1: | 148 sys.exit(1) 149 150 for c in cachespec: 151 if c < 1: |
150 print "Error: Must have 1 or more caches at each level" | 152 print("Error: Must have 1 or more caches at each level") |
151 sys.exit(1) 152 153# Determine the tester multiplier for each level as the string 154# elements are per subsystem and it fans out 155multiplier = [1] 156for c in cachespec: 157 if c < 1: | 153 sys.exit(1) 154 155# Determine the tester multiplier for each level as the string 156# elements are per subsystem and it fans out 157multiplier = [1] 158for c in cachespec: 159 if c < 1: |
158 print "Error: Must have at least one cache per level" | 160 print("Error: Must have at least one cache per level") |
159 multiplier.append(multiplier[-1] * c) 160 161numtesters = 0 162for t, m in zip(testerspec, multiplier): 163 numtesters += t * m 164 165# Define a prototype L1 cache that we scale for all successive levels 166proto_l1 = Cache(size = '32kB', assoc = 4, --- 103 unchanged lines hidden (view full) --- 270 cache.mem_side = xbar.slave 271 make_cache_level(ncaches[1:], prototypes[1:], level - 1, cache) 272 for tester, checker, cache in zip(testers, checkers, tester_caches): 273 tester.port = checker.slave 274 checker.master = cache.cpu_side 275 cache.mem_side = xbar.slave 276 else: 277 if not next_cache: | 161 multiplier.append(multiplier[-1] * c) 162 163numtesters = 0 164for t, m in zip(testerspec, multiplier): 165 numtesters += t * m 166 167# Define a prototype L1 cache that we scale for all successive levels 168proto_l1 = Cache(size = '32kB', assoc = 4, --- 103 unchanged lines hidden (view full) --- 272 cache.mem_side = xbar.slave 273 make_cache_level(ncaches[1:], prototypes[1:], level - 1, cache) 274 for tester, checker, cache in zip(testers, checkers, tester_caches): 275 tester.port = checker.slave 276 checker.master = cache.cpu_side 277 cache.mem_side = xbar.slave 278 else: 279 if not next_cache: |
278 print "Error: No next-level cache at top level" | 280 print("Error: No next-level cache at top level") |
279 sys.exit(1) 280 281 if ntesters > 1: 282 # Create a crossbar and add it to the subsystem 283 xbar = L2XBar(width = 32) 284 subsys.xbar = xbar 285 xbar.master = next_cache.cpu_side 286 for tester, checker in zip(testers, checkers): --- 23 unchanged lines hidden (view full) --- 310root.system.system_port = last_subsys.xbar.slave 311 312# Instantiate configuration 313m5.instantiate() 314 315# Simulate until program terminates 316exit_event = m5.simulate(options.maxtick) 317 | 281 sys.exit(1) 282 283 if ntesters > 1: 284 # Create a crossbar and add it to the subsystem 285 xbar = L2XBar(width = 32) 286 subsys.xbar = xbar 287 xbar.master = next_cache.cpu_side 288 for tester, checker in zip(testers, checkers): --- 23 unchanged lines hidden (view full) --- 312root.system.system_port = last_subsys.xbar.slave 313 314# Instantiate configuration 315m5.instantiate() 316 317# Simulate until program terminates 318exit_event = m5.simulate(options.maxtick) 319 |
318print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause() | 320print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()) |