Deleted Added
sdiff udiff text old ( 11722:f15f02d8c79e ) new ( 12564:2778478ca882 )
full compact
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
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:
110 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
140 print "Generated random tree -c", ':'.join(map(str, cachespec)), \
141 "-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:
147 print "Error: Unable to parse caches or testers option"
148 sys.exit(1)
149
150 if len(cachespec) < 1:
151 print "Error: Must have at least one level of caches"
152 sys.exit(1)
153
154 if len(cachespec) != len(testerspec) - 1:
155 print "Error: Testers must have one element more than caches"
156 sys.exit(1)
157
158 if testerspec[-1] == 0:
159 print "Error: Must have testers at the uppermost level"
160 sys.exit(1)
161
162 for t in testerspec:
163 if t < 0:
164 print "Error: Cannot have a negative number of testers"
165 sys.exit(1)
166
167 for c in cachespec:
168 if c < 1:
169 print "Error: Must have 1 or more caches at each level"
170 sys.exit(1)
171
172 if numtesters(cachespec, testerspec) > block_size:
173 print "Error: Limited to %s testers because of false sharing" \
174 % (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:
283 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
321print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()