fs.py (3022:b3b379cb97ef) fs.py (3025:00fe36086a14)
1# Copyright (c) 2006 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
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.
14#
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.
26#
27# Authors: Ali Saidi
28
29import optparse, os, sys
30
31import m5
32from m5.objects import *
33m5.AddToPath('../common')
34from FSConfig import *
35from SysPaths import *
36from Benchmarks import *
37
38parser = optparse.OptionParser()
39
40parser.add_option("-d", "--detailed", action="store_true")
41parser.add_option("-t", "--timing", action="store_true")
42parser.add_option("-m", "--maxtick", type="int")
43parser.add_option("--maxtime", type="float")
44parser.add_option("--dual", action="store_true",
45 help="Simulate two systems attached with an ethernet link")
46parser.add_option("-b", "--benchmark", action="store", type="string",
47 dest="benchmark",
48 help="Specify the benchmark to run. Available benchmarks: %s"\
49 % DefinedBenchmarks)
1# Copyright (c) 2006 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
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.
14#
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.
26#
27# Authors: Ali Saidi
28
29import optparse, os, sys
30
31import m5
32from m5.objects import *
33m5.AddToPath('../common')
34from FSConfig import *
35from SysPaths import *
36from Benchmarks import *
37
38parser = optparse.OptionParser()
39
40parser.add_option("-d", "--detailed", action="store_true")
41parser.add_option("-t", "--timing", action="store_true")
42parser.add_option("-m", "--maxtick", type="int")
43parser.add_option("--maxtime", type="float")
44parser.add_option("--dual", action="store_true",
45 help="Simulate two systems attached with an ethernet link")
46parser.add_option("-b", "--benchmark", action="store", type="string",
47 dest="benchmark",
48 help="Specify the benchmark to run. Available benchmarks: %s"\
49 % DefinedBenchmarks)
50parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
51 help="Specify the filename to dump a pcap capture of the ethernet"
52 "traffic")
50
51(options, args) = parser.parse_args()
52
53if args:
54 print "Error: script doesn't take any positional arguments"
55 sys.exit(1)
56
57if options.detailed:
58 cpu = DetailedO3CPU()
59 cpu2 = DetailedO3CPU()
60 mem_mode = 'timing'
61elif options.timing:
62 cpu = TimingSimpleCPU()
63 cpu2 = TimingSimpleCPU()
64 mem_mode = 'timing'
65else:
66 cpu = AtomicSimpleCPU()
67 cpu2 = AtomicSimpleCPU()
68 mem_mode = 'atomic'
69
70cpu.clock = '2GHz'
71cpu2.clock = '2GHz'
72
73if options.benchmark:
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
77 sys.exit(1)
78
79 bm = Benchmarks[options.benchmark]
80else:
81 if options.dual:
82 bm = [Machine(), Machine()]
83 else:
84 bm = [Machine()]
85
86if len(bm) == 2:
87 s1 = makeLinuxAlphaSystem(mem_mode, bm[0])
88 s1.cpu = cpu
89 cpu.connectMemPorts(s1.membus)
90 s2 = makeLinuxAlphaSystem(mem_mode, bm[1])
91 s2.cpu = cpu2
92 cpu2.connectMemPorts(s2.membus)
53
54(options, args) = parser.parse_args()
55
56if args:
57 print "Error: script doesn't take any positional arguments"
58 sys.exit(1)
59
60if options.detailed:
61 cpu = DetailedO3CPU()
62 cpu2 = DetailedO3CPU()
63 mem_mode = 'timing'
64elif options.timing:
65 cpu = TimingSimpleCPU()
66 cpu2 = TimingSimpleCPU()
67 mem_mode = 'timing'
68else:
69 cpu = AtomicSimpleCPU()
70 cpu2 = AtomicSimpleCPU()
71 mem_mode = 'atomic'
72
73cpu.clock = '2GHz'
74cpu2.clock = '2GHz'
75
76if options.benchmark:
77 if options.benchmark not in Benchmarks:
78 print "Error benchmark %s has not been defined." % options.benchmark
79 print "Valid benchmarks are: %s" % DefinedBenchmarks
80 sys.exit(1)
81
82 bm = Benchmarks[options.benchmark]
83else:
84 if options.dual:
85 bm = [Machine(), Machine()]
86 else:
87 bm = [Machine()]
88
89if len(bm) == 2:
90 s1 = makeLinuxAlphaSystem(mem_mode, bm[0])
91 s1.cpu = cpu
92 cpu.connectMemPorts(s1.membus)
93 s2 = makeLinuxAlphaSystem(mem_mode, bm[1])
94 s2.cpu = cpu2
95 cpu2.connectMemPorts(s2.membus)
93 root = makeDualRoot(s1, s2)
96 root = makeDualRoot(s1, s2, options.etherdump)
94elif len(bm) == 1:
95 root = Root(clock = '1THz',
96 system = makeLinuxAlphaSystem(mem_mode, bm[0]))
97 root.system.cpu = cpu
98 cpu.connectMemPorts(root.system.membus)
99else:
100 print "Error I don't know how to create more than 2 systems."
101 sys.exit(1)
102
103m5.instantiate(root)
104
105if options.maxtick:
106 arg = options.maxtick
107elif options.maxtime:
108 simtime = int(options.maxtime * root.clock.value)
109 print "simulating for: ", simtime
110 arg = simtime
111else:
112 arg = -1
113
114exit_event = m5.simulate(arg)
115
116while exit_event.getCause() == "checkpoint":
117 m5.checkpoint(root, "cpt.%d")
118 exit_event = m5.simulate(arg)
119
120print 'Exiting @ cycle', m5.curTick(), 'because', exit_event.getCause()
97elif len(bm) == 1:
98 root = Root(clock = '1THz',
99 system = makeLinuxAlphaSystem(mem_mode, bm[0]))
100 root.system.cpu = cpu
101 cpu.connectMemPorts(root.system.membus)
102else:
103 print "Error I don't know how to create more than 2 systems."
104 sys.exit(1)
105
106m5.instantiate(root)
107
108if options.maxtick:
109 arg = options.maxtick
110elif options.maxtime:
111 simtime = int(options.maxtime * root.clock.value)
112 print "simulating for: ", simtime
113 arg = simtime
114else:
115 arg = -1
116
117exit_event = m5.simulate(arg)
118
119while exit_event.getCause() == "checkpoint":
120 m5.checkpoint(root, "cpt.%d")
121 exit_event = m5.simulate(arg)
122
123print 'Exiting @ cycle', m5.curTick(), 'because', exit_event.getCause()