2cca4ef57619e782da3c260223c673c74f014ac4
1 # Copyright (c) 2013 ARM Limited
4 # The license below extends only to copyright in the software and shall
5 # not be construed as granting a license to any other intellectual
6 # property including but not limited to intellectual property relating
7 # to a hardware implementation of the functionality of the software
8 # licensed hereunder. You may use the software subject to the license
9 # terms below provided that you ensure that this notice is replicated
10 # unmodified and in its entirety in all distributions of the software,
11 # modified or unmodified, in source code or in binary form.
13 # Copyright (c) 2006-2008 The Regents of The University of Michigan
14 # All rights reserved.
16 # Redistribution and use in source and binary forms, with or without
17 # modification, are permitted provided that the following conditions are
18 # met: redistributions of source code must retain the above copyright
19 # notice, this list of conditions and the following disclaimer;
20 # redistributions in binary form must reproduce the above copyright
21 # notice, this list of conditions and the following disclaimer in the
22 # documentation and/or other materials provided with the distribution;
23 # neither the name of the copyright holders nor the names of its
24 # contributors may be used to endorse or promote products derived from
25 # this software without specific prior written permission.
27 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
30 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
32 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
33 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
34 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
35 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
36 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
37 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 from m5
.defines
import buildEnv
43 from m5
.objects
import *
44 from Benchmarks
import *
49 def _listCpuTypes(option
, opt
, value
, parser
):
50 CpuConfig
.print_cpu_list()
53 def _listMemTypes(option
, opt
, value
, parser
):
54 MemConfig
.print_mem_list()
57 def addCommonOptions(parser
):
59 parser
.add_option("--list-cpu-types",
60 action
="callback", callback
=_listCpuTypes
,
61 help="List available CPU types")
62 parser
.add_option("--cpu-type", type="choice", default
="atomic",
63 choices
=CpuConfig
.cpu_names(),
64 help = "type of cpu to run with")
65 parser
.add_option("--checker", action
="store_true");
66 parser
.add_option("-n", "--num-cpus", type="int", default
=1)
67 parser
.add_option("--sys-voltage", action
="store", type="string",
69 help = """Top-level voltage for blocks running at system
71 parser
.add_option("--sys-clock", action
="store", type="string",
73 help = """Top-level clock for blocks running at system
75 parser
.add_option("--cpu-clock", action
="store", type="string",
77 help="Clock for blocks running at CPU speed")
78 parser
.add_option("--smt", action
="store_true", default
=False,
80 Only used if multiple programs are specified. If true,
81 then the number of threads per cpu is same as the
82 number of programs.""")
85 parser
.add_option("--list-mem-types",
86 action
="callback", callback
=_listMemTypes
,
87 help="List available memory types")
88 parser
.add_option("--mem-type", type="choice", default
="simple_mem",
89 choices
=MemConfig
.mem_names(),
90 help = "type of memory to use")
91 parser
.add_option("--mem-channels", type="int", default
=1,
92 help = "number of memory channels")
93 parser
.add_option("--mem-size", action
="store", type="string",
95 help="Specify the physical memory size (single memory)")
98 parser
.add_option("--caches", action
="store_true")
99 parser
.add_option("--l2cache", action
="store_true")
100 parser
.add_option("--fastmem", action
="store_true")
101 parser
.add_option("--num-dirs", type="int", default
=1)
102 parser
.add_option("--num-l2caches", type="int", default
=1)
103 parser
.add_option("--num-l3caches", type="int", default
=1)
104 parser
.add_option("--l1d_size", type="string", default
="64kB")
105 parser
.add_option("--l1i_size", type="string", default
="32kB")
106 parser
.add_option("--l2_size", type="string", default
="2MB")
107 parser
.add_option("--l3_size", type="string", default
="16MB")
108 parser
.add_option("--l1d_assoc", type="int", default
=2)
109 parser
.add_option("--l1i_assoc", type="int", default
=2)
110 parser
.add_option("--l2_assoc", type="int", default
=8)
111 parser
.add_option("--l3_assoc", type="int", default
=16)
112 parser
.add_option("--cacheline_size", type="int", default
=64)
115 parser
.add_option("--ruby", action
="store_true")
117 # Run duration options
118 parser
.add_option("-m", "--abs-max-tick", type="int", default
=m5
.MaxTick
,
119 metavar
="TICKS", help="Run to absolute simulated tick " \
120 "specified including ticks from a restored checkpoint")
121 parser
.add_option("--rel-max-tick", type="int", default
=None,
122 metavar
="TICKS", help="Simulate for specified number of" \
123 " ticks relative to the simulation start tick (e.g. if " \
124 "restoring a checkpoint)")
125 parser
.add_option("--maxtime", type="float", default
=None,
126 help="Run to the specified absolute simulated time in " \
128 parser
.add_option("-I", "--maxinsts", action
="store", type="int",
129 default
=None, help="""Total number of instructions to
130 simulate (default: run forever)""")
131 parser
.add_option("--work-item-id", action
="store", type="int",
132 help="the specific work id for exit & checkpointing")
133 parser
.add_option("--work-begin-cpu-id-exit", action
="store", type="int",
134 help="exit when work starts on the specified cpu")
135 parser
.add_option("--work-end-exit-count", action
="store", type="int",
136 help="exit at specified work end count")
137 parser
.add_option("--work-begin-exit-count", action
="store", type="int",
138 help="exit at specified work begin count")
139 parser
.add_option("--init-param", action
="store", type="int", default
=0,
140 help="""Parameter available in simulation with m5
144 parser
.add_option("--simpoint-profile", action
="store_true",
145 help="Enable basic block profiling for SimPoints")
146 parser
.add_option("--simpoint-interval", type="int", default
=10000000,
147 help="SimPoint interval in num of instructions")
149 # Checkpointing options
150 ###Note that performing checkpointing via python script files will override
151 ###checkpoint instructions built into binaries.
152 parser
.add_option("--take-checkpoints", action
="store", type="string",
153 help="<M,N> take checkpoints at tick M and every N ticks thereafter")
154 parser
.add_option("--max-checkpoints", action
="store", type="int",
155 help="the maximum number of checkpoints to drop", default
=5)
156 parser
.add_option("--checkpoint-dir", action
="store", type="string",
157 help="Place all checkpoints in this absolute directory")
158 parser
.add_option("-r", "--checkpoint-restore", action
="store", type="int",
159 help="restore from checkpoint <N>")
160 parser
.add_option("--checkpoint-at-end", action
="store_true",
161 help="take a checkpoint at end of run")
162 parser
.add_option("--work-begin-checkpoint-count", action
="store", type="int",
163 help="checkpoint at specified work begin count")
164 parser
.add_option("--work-end-checkpoint-count", action
="store", type="int",
165 help="checkpoint at specified work end count")
166 parser
.add_option("--work-cpus-checkpoint-count", action
="store", type="int",
167 help="checkpoint and exit when active cpu count is reached")
168 parser
.add_option("--restore-with-cpu", action
="store", type="choice",
169 default
="atomic", choices
=CpuConfig
.cpu_names(),
170 help = "cpu type for restoring from a checkpoint")
173 # CPU Switching - default switch model goes from a checkpoint
174 # to a timing simple CPU with caches to warm up, then to detailed CPU for
176 parser
.add_option("--repeat-switch", action
="store", type="int",
178 help="switch back and forth between CPUs with period <N>")
179 parser
.add_option("-s", "--standard-switch", action
="store", type="int",
181 help="switch from timing to Detailed CPU after warmup period of <N>")
182 parser
.add_option("-p", "--prog-interval", type="str",
183 help="CPU Progress Interval")
185 # Fastforwarding and simpoint related materials
186 parser
.add_option("-W", "--warmup-insts", action
="store", type="int",
188 help="Warmup period in total instructions (requires --standard-switch)")
189 parser
.add_option("--bench", action
="store", type="string", default
=None,
190 help="base names for --take-checkpoint and --checkpoint-restore")
191 parser
.add_option("-F", "--fast-forward", action
="store", type="string",
193 help="Number of instructions to fast forward before switching")
194 parser
.add_option("-S", "--simpoint", action
="store_true", default
=False,
195 help="""Use workload simpoints as an instruction offset for
196 --checkpoint-restore or --take-checkpoint.""")
197 parser
.add_option("--at-instruction", action
="store_true", default
=False,
198 help="""Treat value of --checkpoint-restore or --take-checkpoint as a
199 number of instructions.""")
201 def addSEOptions(parser
):
203 parser
.add_option("-c", "--cmd", default
="",
204 help="The binary to run in syscall emulation mode.")
205 parser
.add_option("-o", "--options", default
="",
206 help="""The options to pass to the binary, use " "
207 around the entire string""")
208 parser
.add_option("-i", "--input", default
="",
209 help="Read stdin from a file.")
210 parser
.add_option("--output", default
="",
211 help="Redirect stdout to a file.")
212 parser
.add_option("--errout", default
="",
213 help="Redirect stderr to a file.")
215 def addFSOptions(parser
):
217 parser
.add_option("--timesync", action
="store_true",
218 help="Prevent simulated time from getting ahead of real time")
221 parser
.add_option("--kernel", action
="store", type="string")
222 parser
.add_option("--script", action
="store", type="string")
223 parser
.add_option("--frame-capture", action
="store_true",
224 help="Stores changed frame buffers from the VNC server to compressed "\
225 "files in the gem5 output directory")
227 if buildEnv
['TARGET_ISA'] == "arm":
228 parser
.add_option("--bare-metal", action
="store_true",
229 help="Provide the raw system without the linux specific bits")
230 parser
.add_option("--machine-type", action
="store", type="choice",
231 choices
=ArmMachineType
.map.keys(), default
="RealView_PBX")
232 parser
.add_option("--dtb-filename", action
="store", type="string",
233 help="Specifies device tree blob file to use with device-tree-"\
235 parser
.add_option("--enable-context-switch-stats-dump", \
236 action
="store_true", help="Enable stats dump at context "\
237 "switches and dump tasks file (required for Streamline)")
240 parser
.add_option("--dual", action
="store_true",
241 help="Simulate two systems attached with an ethernet link")
242 parser
.add_option("-b", "--benchmark", action
="store", type="string",
244 help="Specify the benchmark to run. Available benchmarks: %s"\
248 parser
.add_option("--etherdump", action
="store", type="string", dest
="etherdump",
249 help="Specify the filename to dump a pcap capture of the" \
253 parser
.add_option("--disk-image", action
="store", type="string", default
=None,
254 help="Path to the disk image to use.")