memtest.py (4891:02babad9bfce) memtest.py (4892:298bc09b72fa)
1# Copyright (c) 2006-2007 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

28
29import m5
30from m5.objects import *
31import os, optparse, sys
32m5.AddToPath('../common')
33
34parser = optparse.OptionParser()
35
1# Copyright (c) 2006-2007 The Regents of The University of Michigan
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions are
6# met: redistributions of source code must retain the above copyright
7# notice, this list of conditions and the following disclaimer;
8# redistributions in binary form must reproduce the above copyright

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

28
29import m5
30from m5.objects import *
31import os, optparse, sys
32m5.AddToPath('../common')
33
34parser = optparse.OptionParser()
35
36parser.add_option("-c", "--cache-levels", type="int", default=2,
37 metavar="LEVELS",
38 help="Number of cache levels [default: %default]")
39parser.add_option("-a", "--atomic", action="store_true",
40 help="Use atomic (non-timing) mode")
41parser.add_option("-b", "--blocking", action="store_true",
42 help="Use blocking caches")
36parser.add_option("-a", "--atomic", action="store_true",
37 help="Use atomic (non-timing) mode")
38parser.add_option("-b", "--blocking", action="store_true",
39 help="Use blocking caches")
43parser.add_option("-l", "--maxloads", default="1G", metavar="N",
44 help="Stop after N loads [default: %default]")
40parser.add_option("-l", "--maxloads", metavar="N",
41 help="Stop after N loads")
45parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick,
46 metavar="T",
47 help="Stop after T ticks")
42parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick,
43 metavar="T",
44 help="Stop after T ticks")
48parser.add_option("-n", "--numtesters", type="int", default=8,
49 metavar="N",
50 help="Number of tester pseudo-CPUs [default: %default]")
51
45
52parser.add_option("-t", "--treespec", type="string",
53 help="Colon-separated multilevel tree specification")
46#
47# The "tree" specification is a colon-separated list of one or more
48# integers. The first integer is the number of caches/testers
49# connected directly to main memory. The last integer in the list is
50# the number of testers associated with the uppermost level of memory
51# (L1 cache, if there are caches, or main memory if no caches). Thus
52# if there is only one integer, there are no caches, and the integer
53# specifies the number of testers connected directly to main memory.
54# The other integers (if any) specify the number of caches at each
55# level of the hierarchy between.
56#
57# Examples:
58#
59# "2:1" Two caches connected to memory with a single tester behind each
60# (single-level hierarchy, two testers total)
61#
62# "2:2:1" Two-level hierarchy, 2 L1s behind each of 2 L2s, 4 testers total
63#
64parser.add_option("-t", "--treespec", type="string", default="8:1",
65 help="Colon-separated multilevel tree specification, "
66 "see script comments for details "
67 "[default: %default]")
54
55parser.add_option("--force-bus", action="store_true",
56 help="Use bus between levels even with single cache")
57
58parser.add_option("-f", "--functional", type="int", default=0,
59 metavar="PCT",
60 help="Target percentage of functional accesses "
61 "[default: %default]")

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

72(options, args) = parser.parse_args()
73
74if args:
75 print "Error: script doesn't take any positional arguments"
76 sys.exit(1)
77
78block_size = 64
79
68
69parser.add_option("--force-bus", action="store_true",
70 help="Use bus between levels even with single cache")
71
72parser.add_option("-f", "--functional", type="int", default=0,
73 metavar="PCT",
74 help="Target percentage of functional accesses "
75 "[default: %default]")

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

86(options, args) = parser.parse_args()
87
88if args:
89 print "Error: script doesn't take any positional arguments"
90 sys.exit(1)
91
92block_size = 64
93
80if not options.treespec:
81 # convert simple cache_levels option to treespec
82 treespec = [options.numtesters, 1]
83 numtesters = options.numtesters
84else:
85 try:
86 treespec = [int(x) for x in options.treespec.split(':')]
87 numtesters = reduce(lambda x,y: x*y, treespec)
88 except:
89 print "Error parsing treespec option"
90 sys.exit(1)
94try:
95 treespec = [int(x) for x in options.treespec.split(':')]
96 numtesters = reduce(lambda x,y: x*y, treespec)
97except:
98 print "Error parsing treespec option"
99 sys.exit(1)
91
92if numtesters > block_size:
93 print "Error: Number of testers limited to %s because of false sharing" \
94 % (block_size)
95 sys.exit(1)
96
97if len(treespec) < 1:
98 print "Error parsing treespec"

--- 77 unchanged lines hidden ---
100
101if numtesters > block_size:
102 print "Error: Number of testers limited to %s because of false sharing" \
103 % (block_size)
104 sys.exit(1)
105
106if len(treespec) < 1:
107 print "Error parsing treespec"

--- 77 unchanged lines hidden ---