memtest.py (11722:f15f02d8c79e) memtest.py (12564:2778478ca882)
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
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
42import optparse
43import random
44import sys
45
46import m5
47from m5.objects import *
48
49# This example script stress tests the memory system by creating false

--- 52 unchanged lines hidden (view full) ---

102parser.add_option("--sys-clock", action="store", type="string",
103 default='1GHz',
104 help = """Top-level clock for blocks running at system
105 speed""")
106
107(options, args) = parser.parse_args()
108
109if args:
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:
110 print "Error: script doesn't take any positional arguments"
112 print("Error: script doesn't take any positional arguments")
111 sys.exit(1)
112
113# Get the total number of testers
114def numtesters(cachespec, testerspec):
115 # Determine the tester multiplier for each level as the
116 # elements are per subsystem and it fans out
117 multiplier = [1]
118 for c in cachespec:

--- 13 unchanged lines hidden (view full) ---

132 # Generate a tree with a valid number of testers
133 while True:
134 tree_depth = random.randint(1, 4)
135 cachespec = [random.randint(1, 3) for i in range(tree_depth)]
136 testerspec = [random.randint(1, 3) for i in range(tree_depth + 1)]
137 if numtesters(cachespec, testerspec) < block_size:
138 break
139
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
140 print "Generated random tree -c", ':'.join(map(str, cachespec)), \
141 "-t", ':'.join(map(str, testerspec))
142 print("Generated random tree -c", ':'.join(map(str, cachespec)),
143 "-t", ':'.join(map(str, testerspec)))
142else:
143 try:
144 cachespec = [int(x) for x in options.caches.split(':')]
145 testerspec = [int(x) for x in options.testers.split(':')]
146 except:
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:
147 print "Error: Unable to parse caches or testers option"
149 print("Error: Unable to parse caches or testers option")
148 sys.exit(1)
149
150 if len(cachespec) < 1:
150 sys.exit(1)
151
152 if len(cachespec) < 1:
151 print "Error: Must have at least one level of caches"
153 print("Error: Must have at least one level of caches")
152 sys.exit(1)
153
154 if len(cachespec) != len(testerspec) - 1:
154 sys.exit(1)
155
156 if len(cachespec) != len(testerspec) - 1:
155 print "Error: Testers must have one element more than caches"
157 print("Error: Testers must have one element more than caches")
156 sys.exit(1)
157
158 if testerspec[-1] == 0:
158 sys.exit(1)
159
160 if testerspec[-1] == 0:
159 print "Error: Must have testers at the uppermost level"
161 print("Error: Must have testers at the uppermost level")
160 sys.exit(1)
161
162 for t in testerspec:
163 if t < 0:
162 sys.exit(1)
163
164 for t in testerspec:
165 if t < 0:
164 print "Error: Cannot have a negative number of testers"
166 print("Error: Cannot have a negative number of testers")
165 sys.exit(1)
166
167 for c in cachespec:
168 if c < 1:
167 sys.exit(1)
168
169 for c in cachespec:
170 if c < 1:
169 print "Error: Must have 1 or more caches at each level"
171 print("Error: Must have 1 or more caches at each level")
170 sys.exit(1)
171
172 if numtesters(cachespec, testerspec) > block_size:
172 sys.exit(1)
173
174 if numtesters(cachespec, testerspec) > block_size:
173 print "Error: Limited to %s testers because of false sharing" \
174 % (block_size)
175 print("Error: Limited to %s testers because of false sharing"
176 % (block_size))
175 sys.exit(1)
176
177# Define a prototype L1 cache that we scale for all successive levels
178proto_l1 = Cache(size = '32kB', assoc = 4,
179 tag_latency = 1, data_latency = 1, response_latency = 1,
180 tgts_per_mshr = 8, clusivity = 'mostly_incl',
181 writeback_clean = True)
182

--- 92 unchanged lines hidden (view full) ---

275 for cache in tree_caches:
276 cache.mem_side = xbar.slave
277 make_cache_level(ncaches[1:], prototypes[1:], level - 1, cache)
278 for tester, cache in zip(testers, tester_caches):
279 tester.port = cache.cpu_side
280 cache.mem_side = xbar.slave
281 else:
282 if not next_cache:
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:
283 print "Error: No next-level cache at top level"
285 print("Error: No next-level cache at top level")
284 sys.exit(1)
285
286 if ntesters > 1:
287 # Create a crossbar and add it to the subsystem
288 xbar = L2XBar()
289 subsys.xbar = xbar
290 xbar.master = next_cache.cpu_side
291 for tester in testers:

--- 21 unchanged lines hidden (view full) ---

313root.system.system_port = last_subsys.xbar.slave
314
315# Instantiate configuration
316m5.instantiate()
317
318# Simulate until program terminates
319exit_event = m5.simulate(options.maxtick)
320
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
321print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
323print('Exiting @ tick', m5.curTick(), 'because', exit_event.getCause())