fs.py (6981:aba5f7216636) fs.py (6995:f2b4d8bea5d3)
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
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
30import os
31import sys
32
33import m5
34from m5.defines import buildEnv
35from m5.objects import *
36from m5.util import addToPath, fatal
37
38if not buildEnv['FULL_SYSTEM']:
39 fatal("This script requires full-system mode (*_FS).")
40
41addToPath('../common')
42
43from FSConfig import *
44from SysPaths import *
45from Benchmarks import *
46import Simulation
47import CacheConfig
48from Caches import *
49
50# Get paths we might need. It's expected this file is in m5/configs/example.
51config_path = os.path.dirname(os.path.abspath(__file__))
52config_root = os.path.dirname(config_path)
53
54parser = optparse.OptionParser()
55
56# System options
57parser.add_option("--kernel", action="store", type="string")
58parser.add_option("--script", action="store", type="string")
59
60# Benchmark options
61parser.add_option("--dual", action="store_true",
62 help="Simulate two systems attached with an ethernet link")
63parser.add_option("-b", "--benchmark", action="store", type="string",
64 dest="benchmark",
65 help="Specify the benchmark to run. Available benchmarks: %s"\
66 % DefinedBenchmarks)
67
68# Metafile options
69parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
70 help="Specify the filename to dump a pcap capture of the" \
71 "ethernet traffic")
72
73execfile(os.path.join(config_root, "common", "Options.py"))
74
75(options, args) = parser.parse_args()
76
77if args:
78 print "Error: script doesn't take any positional arguments"
79 sys.exit(1)
80
81# driver system CPU is always simple... note this is an assignment of
82# a class, not an instance.
83DriveCPUClass = AtomicSimpleCPU
84drive_mem_mode = 'atomic'
85
86# system under test can be any CPU
87(TestCPUClass, test_mem_mode, FutureClass) = Simulation.setCPUClass(options)
88
89TestCPUClass.clock = '2GHz'
90DriveCPUClass.clock = '2GHz'
91
92if options.benchmark:
93 try:
94 bm = Benchmarks[options.benchmark]
95 except KeyError:
96 print "Error benchmark %s has not been defined." % options.benchmark
97 print "Valid benchmarks are: %s" % DefinedBenchmarks
98 sys.exit(1)
99else:
100 if options.dual:
101 bm = [SysConfig(), SysConfig()]
102 else:
103 bm = [SysConfig()]
104
105np = options.num_cpus
106
107if buildEnv['TARGET_ISA'] == "alpha":
108 test_sys = makeLinuxAlphaSystem(test_mem_mode, bm[0])
109elif buildEnv['TARGET_ISA'] == "mips":
110 test_sys = makeLinuxMipsSystem(test_mem_mode, bm[0])
111elif buildEnv['TARGET_ISA'] == "sparc":
112 test_sys = makeSparcSystem(test_mem_mode, bm[0])
113elif buildEnv['TARGET_ISA'] == "x86":
114 test_sys = makeLinuxX86System(test_mem_mode, np, bm[0])
115else:
116 fatal("incapable of building non-alpha or non-sparc full system!")
117
118if options.kernel is not None:
119 test_sys.kernel = binary(options.kernel)
120
121if options.script is not None:
122 test_sys.readfile = options.script
123
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
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
30import os
31import sys
32
33import m5
34from m5.defines import buildEnv
35from m5.objects import *
36from m5.util import addToPath, fatal
37
38if not buildEnv['FULL_SYSTEM']:
39 fatal("This script requires full-system mode (*_FS).")
40
41addToPath('../common')
42
43from FSConfig import *
44from SysPaths import *
45from Benchmarks import *
46import Simulation
47import CacheConfig
48from Caches import *
49
50# Get paths we might need. It's expected this file is in m5/configs/example.
51config_path = os.path.dirname(os.path.abspath(__file__))
52config_root = os.path.dirname(config_path)
53
54parser = optparse.OptionParser()
55
56# System options
57parser.add_option("--kernel", action="store", type="string")
58parser.add_option("--script", action="store", type="string")
59
60# Benchmark options
61parser.add_option("--dual", action="store_true",
62 help="Simulate two systems attached with an ethernet link")
63parser.add_option("-b", "--benchmark", action="store", type="string",
64 dest="benchmark",
65 help="Specify the benchmark to run. Available benchmarks: %s"\
66 % DefinedBenchmarks)
67
68# Metafile options
69parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
70 help="Specify the filename to dump a pcap capture of the" \
71 "ethernet traffic")
72
73execfile(os.path.join(config_root, "common", "Options.py"))
74
75(options, args) = parser.parse_args()
76
77if args:
78 print "Error: script doesn't take any positional arguments"
79 sys.exit(1)
80
81# driver system CPU is always simple... note this is an assignment of
82# a class, not an instance.
83DriveCPUClass = AtomicSimpleCPU
84drive_mem_mode = 'atomic'
85
86# system under test can be any CPU
87(TestCPUClass, test_mem_mode, FutureClass) = Simulation.setCPUClass(options)
88
89TestCPUClass.clock = '2GHz'
90DriveCPUClass.clock = '2GHz'
91
92if options.benchmark:
93 try:
94 bm = Benchmarks[options.benchmark]
95 except KeyError:
96 print "Error benchmark %s has not been defined." % options.benchmark
97 print "Valid benchmarks are: %s" % DefinedBenchmarks
98 sys.exit(1)
99else:
100 if options.dual:
101 bm = [SysConfig(), SysConfig()]
102 else:
103 bm = [SysConfig()]
104
105np = options.num_cpus
106
107if buildEnv['TARGET_ISA'] == "alpha":
108 test_sys = makeLinuxAlphaSystem(test_mem_mode, bm[0])
109elif buildEnv['TARGET_ISA'] == "mips":
110 test_sys = makeLinuxMipsSystem(test_mem_mode, bm[0])
111elif buildEnv['TARGET_ISA'] == "sparc":
112 test_sys = makeSparcSystem(test_mem_mode, bm[0])
113elif buildEnv['TARGET_ISA'] == "x86":
114 test_sys = makeLinuxX86System(test_mem_mode, np, bm[0])
115else:
116 fatal("incapable of building non-alpha or non-sparc full system!")
117
118if options.kernel is not None:
119 test_sys.kernel = binary(options.kernel)
120
121if options.script is not None:
122 test_sys.readfile = options.script
123
124CacheConfig.config_cache(options, system)
125
126test_sys.cpu = [TestCPUClass(cpu_id=i) for i in xrange(np)]
127
124test_sys.cpu = [TestCPUClass(cpu_id=i) for i in xrange(np)]
125
126CacheConfig.config_cache(options, test_sys)
127
128if options.caches or options.l2cache:
129 test_sys.bridge.filter_ranges_a=[AddrRange(0, Addr.max)]
130 test_sys.bridge.filter_ranges_b=[AddrRange(0, size='8GB')]
131 test_sys.iocache = IOCache(addr_range=AddrRange(0, size='8GB'))
132 test_sys.iocache.cpu_side = test_sys.iobus.port
133 test_sys.iocache.mem_side = test_sys.membus.port
134
135for i in xrange(np):
136 if options.fastmem:
137 test_sys.cpu[i].physmem_port = test_sys.physmem.port
138
139if buildEnv['TARGET_ISA'] == 'mips':
140 setMipsOptions(TestCPUClass)
141
142if len(bm) == 2:
143 if buildEnv['TARGET_ISA'] == 'alpha':
144 drive_sys = makeLinuxAlphaSystem(drive_mem_mode, bm[1])
145 elif buildEnv['TARGET_ISA'] == 'mips':
146 drive_sys = makeLinuxMipsSystem(drive_mem_mode, bm[1])
147 elif buildEnv['TARGET_ISA'] == 'sparc':
148 drive_sys = makeSparcSystem(drive_mem_mode, bm[1])
149 elif buildEnv['TARGET_ISA'] == 'x86':
150 drive_sys = makeX86System(drive_mem_mode, np, bm[1])
151 drive_sys.cpu = DriveCPUClass(cpu_id=0)
152 drive_sys.cpu.connectMemPorts(drive_sys.membus)
153 if options.fastmem:
154 drive_sys.cpu.physmem_port = drive_sys.physmem.port
155 if options.kernel is not None:
156 drive_sys.kernel = binary(options.kernel)
157
158 root = makeDualRoot(test_sys, drive_sys, options.etherdump)
159elif len(bm) == 1:
160 root = Root(system=test_sys)
161else:
162 print "Error I don't know how to create more than 2 systems."
163 sys.exit(1)
164
165Simulation.run(options, root, test_sys, FutureClass)
128if options.caches or options.l2cache:
129 test_sys.bridge.filter_ranges_a=[AddrRange(0, Addr.max)]
130 test_sys.bridge.filter_ranges_b=[AddrRange(0, size='8GB')]
131 test_sys.iocache = IOCache(addr_range=AddrRange(0, size='8GB'))
132 test_sys.iocache.cpu_side = test_sys.iobus.port
133 test_sys.iocache.mem_side = test_sys.membus.port
134
135for i in xrange(np):
136 if options.fastmem:
137 test_sys.cpu[i].physmem_port = test_sys.physmem.port
138
139if buildEnv['TARGET_ISA'] == 'mips':
140 setMipsOptions(TestCPUClass)
141
142if len(bm) == 2:
143 if buildEnv['TARGET_ISA'] == 'alpha':
144 drive_sys = makeLinuxAlphaSystem(drive_mem_mode, bm[1])
145 elif buildEnv['TARGET_ISA'] == 'mips':
146 drive_sys = makeLinuxMipsSystem(drive_mem_mode, bm[1])
147 elif buildEnv['TARGET_ISA'] == 'sparc':
148 drive_sys = makeSparcSystem(drive_mem_mode, bm[1])
149 elif buildEnv['TARGET_ISA'] == 'x86':
150 drive_sys = makeX86System(drive_mem_mode, np, bm[1])
151 drive_sys.cpu = DriveCPUClass(cpu_id=0)
152 drive_sys.cpu.connectMemPorts(drive_sys.membus)
153 if options.fastmem:
154 drive_sys.cpu.physmem_port = drive_sys.physmem.port
155 if options.kernel is not None:
156 drive_sys.kernel = binary(options.kernel)
157
158 root = makeDualRoot(test_sys, drive_sys, options.etherdump)
159elif len(bm) == 1:
160 root = Root(system=test_sys)
161else:
162 print "Error I don't know how to create more than 2 systems."
163 sys.exit(1)
164
165Simulation.run(options, root, test_sys, FutureClass)