fs.py (3409:769707cf0664) fs.py (3444:6abefa632e10)
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 *
37import Simulation
38
39if not m5.build_env['FULL_SYSTEM']:
40 m5.panic("This script requires full-system mode (ALPHA_FS).")
41
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 *
37import Simulation
38
39if not m5.build_env['FULL_SYSTEM']:
40 m5.panic("This script requires full-system mode (ALPHA_FS).")
41
42# Get paths we might need. It's expected this file is in m5/configs/example.
43config_path = os.path.dirname(os.path.abspath(__file__))
44config_root = os.path.dirname(config_path)
45
42parser = optparse.OptionParser()
43
44# Benchmark options
45parser.add_option("--dual", action="store_true",
46 help="Simulate two systems attached with an ethernet link")
47parser.add_option("-b", "--benchmark", action="store", type="string",
48 dest="benchmark",
49 help="Specify the benchmark to run. Available benchmarks: %s"\
50 % DefinedBenchmarks)
51
52# Metafile options
53parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
54 help="Specify the filename to dump a pcap capture of the" \
55 "ethernet traffic")
56
46parser = optparse.OptionParser()
47
48# Benchmark options
49parser.add_option("--dual", action="store_true",
50 help="Simulate two systems attached with an ethernet link")
51parser.add_option("-b", "--benchmark", action="store", type="string",
52 dest="benchmark",
53 help="Specify the benchmark to run. Available benchmarks: %s"\
54 % DefinedBenchmarks)
55
56# Metafile options
57parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
58 help="Specify the filename to dump a pcap capture of the" \
59 "ethernet traffic")
60
61execfile(os.path.join(config_root, "common", "Options.py"))
57
62
58execfile("Options.py")
59
60(options, args) = parser.parse_args()
61
62if args:
63 print "Error: script doesn't take any positional arguments"
64 sys.exit(1)
65
66# driver system CPU is always simple... note this is an assignment of
67# a class, not an instance.
68DriveCPUClass = AtomicSimpleCPU
69drive_mem_mode = 'atomic'
70
71# system under test can be any of these CPUs
72if options.detailed:
73 TestCPUClass = DerivO3CPU
74 test_mem_mode = 'timing'
75elif options.timing:
76 TestCPUClass = TimingSimpleCPU
77 test_mem_mode = 'timing'
78else:
79 TestCPUClass = AtomicSimpleCPU
80 test_mem_mode = 'atomic'
81
82TestCPUClass.clock = '2GHz'
83DriveCPUClass.clock = '2GHz'
84
85if options.benchmark:
86 try:
87 bm = Benchmarks[options.benchmark]
88 except KeyError:
89 print "Error benchmark %s has not been defined." % options.benchmark
90 print "Valid benchmarks are: %s" % DefinedBenchmarks
91 sys.exit(1)
92else:
93 if options.dual:
94 bm = [SysConfig(), SysConfig()]
95 else:
96 bm = [SysConfig()]
97
98test_sys = makeLinuxAlphaSystem(test_mem_mode, bm[0])
99np = options.num_cpus
100test_sys.cpu = [TestCPUClass(cpu_id=i) for i in xrange(np)]
101for i in xrange(np):
102 if options.caches and not options.standard_switch:
103 test_sys.cpu[i].addPrivateSplitL1Caches(L1Cache(size = '32kB'),
104 L2Cache(size = '64kB'))
105 test_sys.cpu[i].connectMemPorts(test_sys.membus)
106 test_sys.cpu[i].mem = test_sys.physmem
107
108if len(bm) == 2:
109 drive_sys = makeLinuxAlphaSystem(drive_mem_mode, bm[1])
110 drive_sys.cpu = DriveCPUClass(cpu_id=0)
111 drive_sys.cpu.connectMemPorts(drive_sys.membus)
112 drive_sys.cpu.mem = drive_sys.physmem
113 root = makeDualRoot(test_sys, drive_sys, options.etherdump)
114elif len(bm) == 1:
115 root = Root(clock = '1THz', system = test_sys)
116else:
117 print "Error I don't know how to create more than 2 systems."
118 sys.exit(1)
119
120Simulation.run(options, root, test_sys)
63(options, args) = parser.parse_args()
64
65if args:
66 print "Error: script doesn't take any positional arguments"
67 sys.exit(1)
68
69# driver system CPU is always simple... note this is an assignment of
70# a class, not an instance.
71DriveCPUClass = AtomicSimpleCPU
72drive_mem_mode = 'atomic'
73
74# system under test can be any of these CPUs
75if options.detailed:
76 TestCPUClass = DerivO3CPU
77 test_mem_mode = 'timing'
78elif options.timing:
79 TestCPUClass = TimingSimpleCPU
80 test_mem_mode = 'timing'
81else:
82 TestCPUClass = AtomicSimpleCPU
83 test_mem_mode = 'atomic'
84
85TestCPUClass.clock = '2GHz'
86DriveCPUClass.clock = '2GHz'
87
88if options.benchmark:
89 try:
90 bm = Benchmarks[options.benchmark]
91 except KeyError:
92 print "Error benchmark %s has not been defined." % options.benchmark
93 print "Valid benchmarks are: %s" % DefinedBenchmarks
94 sys.exit(1)
95else:
96 if options.dual:
97 bm = [SysConfig(), SysConfig()]
98 else:
99 bm = [SysConfig()]
100
101test_sys = makeLinuxAlphaSystem(test_mem_mode, bm[0])
102np = options.num_cpus
103test_sys.cpu = [TestCPUClass(cpu_id=i) for i in xrange(np)]
104for i in xrange(np):
105 if options.caches and not options.standard_switch:
106 test_sys.cpu[i].addPrivateSplitL1Caches(L1Cache(size = '32kB'),
107 L2Cache(size = '64kB'))
108 test_sys.cpu[i].connectMemPorts(test_sys.membus)
109 test_sys.cpu[i].mem = test_sys.physmem
110
111if len(bm) == 2:
112 drive_sys = makeLinuxAlphaSystem(drive_mem_mode, bm[1])
113 drive_sys.cpu = DriveCPUClass(cpu_id=0)
114 drive_sys.cpu.connectMemPorts(drive_sys.membus)
115 drive_sys.cpu.mem = drive_sys.physmem
116 root = makeDualRoot(test_sys, drive_sys, options.etherdump)
117elif len(bm) == 1:
118 root = Root(clock = '1THz', system = test_sys)
119else:
120 print "Error I don't know how to create more than 2 systems."
121 sys.exit(1)
122
123Simulation.run(options, root, test_sys)