config: Add an option to generate a random topology in memcheck

This change adds the option to use the memcheck with random memory
hierarchies at the moment limited to a maximum depth of 3 allowing
testing with uncommon topologies.

Change-Id: Id2c2fe82a8175d9a67eb4cd7f3d2e2720a809b60
Reviewed-by: Andreas Hansson <andreas.hansson@arm.com>
This commit is contained in:
Nikos Nikoleris 2016-12-05 16:48:31 -05:00
parent c1a40f9e44
commit 9e57e4e89d

View file

@ -40,6 +40,7 @@
# Andreas Hansson
import optparse
import random
import sys
import m5
@ -97,6 +98,8 @@ parser.add_option("-t", "--testers", type="string", default="1:0:2",
help="Colon-separated tester hierarchy specification, "
"see script comments for details "
"[default: %default]")
parser.add_option("-r", "--random", action="store_true",
help="Generate a random tree topology")
parser.add_option("--sys-clock", action="store", type="string",
default='1GHz',
help = """Top-level clock for blocks running at system
@ -110,6 +113,14 @@ if args:
# Start by parsing the command line options and do some basic sanity
# checking
if options.random:
# Generate a tree with a valid number of testers
tree_depth = random.randint(1, 4)
cachespec = [random.randint(1, 3) for i in range(tree_depth)]
testerspec = [random.randint(1, 3) for i in range(tree_depth + 1)]
print "Generated random tree -c", ':'.join(map(str, cachespec)), \
"-t", ':'.join(map(str, testerspec))
else:
try:
cachespec = [int(x) for x in options.caches.split(':')]
testerspec = [int(x) for x in options.testers.split(':')]