1 # Copyright (c) 2006 The Regents of The University of Michigan
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
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution;
11 # neither the name of the copyright holders nor the names of its
12 # contributors may be used to endorse or promote products derived from
13 # this software without specific prior written permission.
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 import optparse
, os
, sys
32 from m5
.objects
import *
33 m5
.AddToPath('../common')
34 from FSConfig
import *
35 from SysPaths
import *
36 from Benchmarks
import *
38 parser
= optparse
.OptionParser()
40 parser
.add_option("-d", "--detailed", action
="store_true")
41 parser
.add_option("-t", "--timing", action
="store_true")
42 parser
.add_option("-m", "--maxtick", type="int")
43 parser
.add_option("--maxtime", type="float")
44 parser
.add_option("--dual", action
="store_true",
45 help="Simulate two systems attached with an ethernet link")
46 parser
.add_option("-b", "--benchmark", action
="store", type="string",
48 help="Specify the benchmark to run. Available benchmarks: %s"\
51 (options
, args
) = parser
.parse_args()
54 print "Error: script doesn't take any positional arguments"
59 cpu2
= DetailedO3CPU()
62 cpu
= TimingSimpleCPU()
63 cpu2
= TimingSimpleCPU()
66 cpu
= AtomicSimpleCPU()
67 cpu2
= AtomicSimpleCPU()
74 if options
.benchmark
not in Benchmarks
:
75 print "Error benchmark %s has not been defined." % options
.benchmark
76 print "Valid benchmarks are: %s" % DefinedBenchmarks
79 bm
= Benchmarks
[options
.benchmark
]
82 bm
= [Machine(), Machine()]
87 s1
= makeLinuxAlphaSystem(mem_mode
, bm
[0])
89 cpu
.connectMemPorts(s1
.membus
)
90 s2
= makeLinuxAlphaSystem(mem_mode
, bm
[1])
92 cpu2
.connectMemPorts(s2
.membus
)
93 root
= makeDualRoot(s1
, s2
)
95 root
= Root(clock
= '1THz',
96 system
= makeLinuxAlphaSystem(mem_mode
, bm
[0]))
98 cpu
.connectMemPorts(root
.system
.membus
)
100 print "Error I don't know how to create more than 2 systems."
106 arg
= options
.maxtick
107 elif options
.maxtime
:
108 simtime
= int(options
.maxtime
* root
.clock
.value
)
109 print "simulating for: ", simtime
114 exit_event
= m5
.simulate(arg
)
116 while exit_event
.getCause() == "checkpoint":
117 m5
.checkpoint(root
, "cpt.%d")
118 exit_event
= m5
.simulate(arg
)
120 print 'Exiting @ cycle', m5
.curTick(), 'because', exit_event
.getCause()