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 *
50 from FSConfig
import os_types
52 def _listCpuTypes(option
, opt
, value
, parser
):
53 CpuConfig
.print_cpu_list()
56 def _listMemTypes(option
, opt
, value
, parser
):
57 MemConfig
.print_mem_list()
60 def _listPlatformTypes(option
, opt
, value
, parser
):
61 PlatformConfig
.print_platform_list()
64 def addCommonOptions(parser
):
66 parser
.add_option("--list-cpu-types",
67 action
="callback", callback
=_listCpuTypes
,
68 help="List available CPU types")
69 parser
.add_option("--cpu-type", type="choice", default
="atomic",
70 choices
=CpuConfig
.cpu_names(),
71 help = "type of cpu to run with")
72 parser
.add_option("--checker", action
="store_true");
73 parser
.add_option("-n", "--num-cpus", type="int", default
=1)
74 parser
.add_option("--sys-voltage", action
="store", type="string",
76 help = """Top-level voltage for blocks running at system
78 parser
.add_option("--sys-clock", action
="store", type="string",
80 help = """Top-level clock for blocks running at system
82 parser
.add_option("--cpu-clock", action
="store", type="string",
84 help="Clock for blocks running at CPU speed")
85 parser
.add_option("--smt", action
="store_true", default
=False,
87 Only used if multiple programs are specified. If true,
88 then the number of threads per cpu is same as the
89 number of programs.""")
90 parser
.add_option("--elastic-trace-en", action
="store_true",
91 help="""Enable capture of data dependency and instruction
92 fetch traces using elastic trace probe.""")
93 # Trace file paths input to trace probe in a capture simulation and input
94 # to Trace CPU in a replay simulation
95 parser
.add_option("--inst-trace-file", action
="store", type="string",
96 help="""Instruction fetch trace file input to
97 Elastic Trace probe in a capture simulation and
98 Trace CPU in a replay simulation""", default
="")
99 parser
.add_option("--data-trace-file", action
="store", type="string",
100 help="""Data dependency trace file input to
101 Elastic Trace probe in a capture simulation and
102 Trace CPU in a replay simulation""", default
="")
105 parser
.add_option("--list-mem-types",
106 action
="callback", callback
=_listMemTypes
,
107 help="List available memory types")
108 parser
.add_option("--mem-type", type="choice", default
="DDR3_1600_x64",
109 choices
=MemConfig
.mem_names(),
110 help = "type of memory to use")
111 parser
.add_option("--mem-channels", type="int", default
=1,
112 help = "number of memory channels")
113 parser
.add_option("--mem-ranks", type="int", default
=None,
114 help = "number of memory ranks per channel")
115 parser
.add_option("--mem-size", action
="store", type="string",
117 help="Specify the physical memory size (single memory)")
119 parser
.add_option("-l", "--lpae", action
="store_true")
120 parser
.add_option("-V", "--virtualisation", action
="store_true")
122 parser
.add_option("--memchecker", action
="store_true")
125 parser
.add_option("--external-memory-system", type="string",
126 help="use external ports of this port_type for caches")
127 parser
.add_option("--tlm-memory", type="string",
128 help="use external port for SystemC TLM cosimulation")
129 parser
.add_option("--caches", action
="store_true")
130 parser
.add_option("--l2cache", action
="store_true")
131 parser
.add_option("--fastmem", action
="store_true")
132 parser
.add_option("--num-dirs", type="int", default
=1)
133 parser
.add_option("--num-l2caches", type="int", default
=1)
134 parser
.add_option("--num-l3caches", type="int", default
=1)
135 parser
.add_option("--l1d_size", type="string", default
="64kB")
136 parser
.add_option("--l1i_size", type="string", default
="32kB")
137 parser
.add_option("--l2_size", type="string", default
="2MB")
138 parser
.add_option("--l3_size", type="string", default
="16MB")
139 parser
.add_option("--l1d_assoc", type="int", default
=2)
140 parser
.add_option("--l1i_assoc", type="int", default
=2)
141 parser
.add_option("--l2_assoc", type="int", default
=8)
142 parser
.add_option("--l3_assoc", type="int", default
=16)
143 parser
.add_option("--cacheline_size", type="int", default
=64)
146 parser
.add_option("--ruby", action
="store_true")
148 # Run duration options
149 parser
.add_option("-m", "--abs-max-tick", type="int", default
=m5
.MaxTick
,
150 metavar
="TICKS", help="Run to absolute simulated tick " \
151 "specified including ticks from a restored checkpoint")
152 parser
.add_option("--rel-max-tick", type="int", default
=None,
153 metavar
="TICKS", help="Simulate for specified number of" \
154 " ticks relative to the simulation start tick (e.g. if " \
155 "restoring a checkpoint)")
156 parser
.add_option("--maxtime", type="float", default
=None,
157 help="Run to the specified absolute simulated time in " \
159 parser
.add_option("-I", "--maxinsts", action
="store", type="int",
160 default
=None, help="""Total number of instructions to
161 simulate (default: run forever)""")
162 parser
.add_option("--work-item-id", action
="store", type="int",
163 help="the specific work id for exit & checkpointing")
164 parser
.add_option("--num-work-ids", action
="store", type="int",
165 help="Number of distinct work item types")
166 parser
.add_option("--work-begin-cpu-id-exit", action
="store", type="int",
167 help="exit when work starts on the specified cpu")
168 parser
.add_option("--work-end-exit-count", action
="store", type="int",
169 help="exit at specified work end count")
170 parser
.add_option("--work-begin-exit-count", action
="store", type="int",
171 help="exit at specified work begin count")
172 parser
.add_option("--init-param", action
="store", type="int", default
=0,
173 help="""Parameter available in simulation with m5
175 parser
.add_option("--initialize-only", action
="store_true", default
=False,
176 help="""Exit after initialization. Do not simulate time.
177 Useful when gem5 is run as a library.""")
180 parser
.add_option("--simpoint-profile", action
="store_true",
181 help="Enable basic block profiling for SimPoints")
182 parser
.add_option("--simpoint-interval", type="int", default
=10000000,
183 help="SimPoint interval in num of instructions")
184 parser
.add_option("--take-simpoint-checkpoints", action
="store", type="string",
185 help="<simpoint file,weight file,interval-length,warmup-length>")
186 parser
.add_option("--restore-simpoint-checkpoint", action
="store_true",
187 help="restore from a simpoint checkpoint taken with " +
188 "--take-simpoint-checkpoints")
190 # Checkpointing options
191 ###Note that performing checkpointing via python script files will override
192 ###checkpoint instructions built into binaries.
193 parser
.add_option("--take-checkpoints", action
="store", type="string",
194 help="<M,N> take checkpoints at tick M and every N ticks thereafter")
195 parser
.add_option("--max-checkpoints", action
="store", type="int",
196 help="the maximum number of checkpoints to drop", default
=5)
197 parser
.add_option("--checkpoint-dir", action
="store", type="string",
198 help="Place all checkpoints in this absolute directory")
199 parser
.add_option("-r", "--checkpoint-restore", action
="store", type="int",
200 help="restore from checkpoint <N>")
201 parser
.add_option("--checkpoint-at-end", action
="store_true",
202 help="take a checkpoint at end of run")
203 parser
.add_option("--work-begin-checkpoint-count", action
="store", type="int",
204 help="checkpoint at specified work begin count")
205 parser
.add_option("--work-end-checkpoint-count", action
="store", type="int",
206 help="checkpoint at specified work end count")
207 parser
.add_option("--work-cpus-checkpoint-count", action
="store", type="int",
208 help="checkpoint and exit when active cpu count is reached")
209 parser
.add_option("--restore-with-cpu", action
="store", type="choice",
210 default
="atomic", choices
=CpuConfig
.cpu_names(),
211 help = "cpu type for restoring from a checkpoint")
214 # CPU Switching - default switch model goes from a checkpoint
215 # to a timing simple CPU with caches to warm up, then to detailed CPU for
217 parser
.add_option("--repeat-switch", action
="store", type="int",
219 help="switch back and forth between CPUs with period <N>")
220 parser
.add_option("-s", "--standard-switch", action
="store", type="int",
222 help="switch from timing to Detailed CPU after warmup period of <N>")
223 parser
.add_option("-p", "--prog-interval", type="str",
224 help="CPU Progress Interval")
226 # Fastforwarding and simpoint related materials
227 parser
.add_option("-W", "--warmup-insts", action
="store", type="int",
229 help="Warmup period in total instructions (requires --standard-switch)")
230 parser
.add_option("--bench", action
="store", type="string", default
=None,
231 help="base names for --take-checkpoint and --checkpoint-restore")
232 parser
.add_option("-F", "--fast-forward", action
="store", type="string",
234 help="Number of instructions to fast forward before switching")
235 parser
.add_option("-S", "--simpoint", action
="store_true", default
=False,
236 help="""Use workload simpoints as an instruction offset for
237 --checkpoint-restore or --take-checkpoint.""")
238 parser
.add_option("--at-instruction", action
="store_true", default
=False,
239 help="""Treat value of --checkpoint-restore or --take-checkpoint as a
240 number of instructions.""")
241 parser
.add_option("--spec-input", default
="ref", type="choice",
242 choices
=["ref", "test", "train", "smred", "mdred",
244 help="Input set size for SPEC CPU2000 benchmarks.")
245 parser
.add_option("--arm-iset", default
="arm", type="choice",
246 choices
=["arm", "thumb", "aarch64"],
247 help="ARM instruction set.")
250 def addSEOptions(parser
):
252 parser
.add_option("-c", "--cmd", default
="",
253 help="The binary to run in syscall emulation mode.")
254 parser
.add_option("-o", "--options", default
="",
255 help="""The options to pass to the binary, use " "
256 around the entire string""")
257 parser
.add_option("-e", "--env", default
="",
258 help="Initialize workload environment from text file.")
259 parser
.add_option("-i", "--input", default
="",
260 help="Read stdin from a file.")
261 parser
.add_option("--output", default
="",
262 help="Redirect stdout to a file.")
263 parser
.add_option("--errout", default
="",
264 help="Redirect stderr to a file.")
266 def addFSOptions(parser
):
268 parser
.add_option("--timesync", action
="store_true",
269 help="Prevent simulated time from getting ahead of real time")
272 parser
.add_option("--kernel", action
="store", type="string")
273 parser
.add_option("--os-type", action
="store", type="choice",
274 choices
=os_types
[buildEnv
['TARGET_ISA']], default
="linux",
275 help="Specifies type of OS to boot")
276 parser
.add_option("--script", action
="store", type="string")
277 parser
.add_option("--frame-capture", action
="store_true",
278 help="Stores changed frame buffers from the VNC server to compressed "\
279 "files in the gem5 output directory")
281 if buildEnv
['TARGET_ISA'] == "arm":
282 parser
.add_option("--bare-metal", action
="store_true",
283 help="Provide the raw system without the linux specific bits")
284 parser
.add_option("--list-machine-types",
285 action
="callback", callback
=_listPlatformTypes
,
286 help="List available platform types")
287 parser
.add_option("--machine-type", action
="store", type="choice",
288 choices
=PlatformConfig
.platform_names(),
289 default
="VExpress_EMM")
290 parser
.add_option("--dtb-filename", action
="store", type="string",
291 help="Specifies device tree blob file to use with device-tree-"\
293 parser
.add_option("--enable-context-switch-stats-dump", \
294 action
="store_true", help="Enable stats dump at context "\
295 "switches and dump tasks file (required for Streamline)")
298 parser
.add_option("--dual", action
="store_true",
299 help="Simulate two systems attached with an ethernet link")
300 parser
.add_option("-b", "--benchmark", action
="store", type="string",
302 help="Specify the benchmark to run. Available benchmarks: %s"\
306 parser
.add_option("--etherdump", action
="store", type="string", dest
="etherdump",
307 help="Specify the filename to dump a pcap capture of the" \
311 parser
.add_option("--disk-image", action
="store", type="string", default
=None,
312 help="Path to the disk image to use.")
313 parser
.add_option("--root-device", action
="store", type="string", default
=None,
314 help="OS device name for root partition")
316 # Command line options
317 parser
.add_option("--command-line", action
="store", type="string",
319 help="Template for the kernel command line.")
320 parser
.add_option("--command-line-file", action
="store",
321 default
=None, type="string",
322 help="File with a template for the kernel command line")