Options.py revision 9800
16145SN/A# Copyright (c) 2013 ARM Limited 26386SN/A# All rights reserved. 37553SN/A# 46386SN/A# The license below extends only to copyright in the software and shall 56386SN/A# not be construed as granting a license to any other intellectual 66386SN/A# property including but not limited to intellectual property relating 76386SN/A# to a hardware implementation of the functionality of the software 86386SN/A# licensed hereunder. You may use the software subject to the license 96386SN/A# terms below provided that you ensure that this notice is replicated 106386SN/A# unmodified and in its entirety in all distributions of the software, 116386SN/A# modified or unmodified, in source code or in binary form. 126386SN/A# 136386SN/A# Copyright (c) 2006-2008 The Regents of The University of Michigan 146386SN/A# All rights reserved. 156386SN/A# 166386SN/A# Redistribution and use in source and binary forms, with or without 176386SN/A# modification, are permitted provided that the following conditions are 186386SN/A# met: redistributions of source code must retain the above copyright 196386SN/A# notice, this list of conditions and the following disclaimer; 206386SN/A# redistributions in binary form must reproduce the above copyright 216386SN/A# notice, this list of conditions and the following disclaimer in the 226386SN/A# documentation and/or other materials provided with the distribution; 236386SN/A# neither the name of the copyright holders nor the names of its 246386SN/A# contributors may be used to endorse or promote products derived from 256386SN/A# this software without specific prior written permission. 266386SN/A# 276386SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 286386SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 296145SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 307632SBrad.Beckmann@amd.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 317632SBrad.Beckmann@amd.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 327632SBrad.Beckmann@amd.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 338232Snate@binkert.org# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 346145SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 357553SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 367553SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 376145SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 387553SN/A# 397553SN/A# Authors: Lisa Hsu 407553SN/A 417553SN/Aimport m5 427553SN/Afrom m5.defines import buildEnv 436145SN/Afrom m5.objects import * 446145SN/Afrom Benchmarks import * 457553SN/A 466145SN/Aimport CpuConfig 476145SN/Aimport MemConfig 486145SN/A 497553SN/Adef _listCpuTypes(option, opt, value, parser): 507553SN/A CpuConfig.print_cpu_list() 516145SN/A sys.exit(0) 527553SN/A 537553SN/Adef _listMemTypes(option, opt, value, parser): 546145SN/A MemConfig.print_mem_list() 558950Sandreas.hansson@arm.com sys.exit(0) 567553SN/A 577553SN/Adef addCommonOptions(parser): 587553SN/A # system options 597553SN/A parser.add_option("--list-cpu-types", 608832SAli.Saidi@ARM.com action="callback", callback=_listCpuTypes, 617553SN/A help="List available CPU types") 627553SN/A parser.add_option("--cpu-type", type="choice", default="atomic", 637553SN/A choices=CpuConfig.cpu_names(), 647553SN/A help = "type of cpu to run with") 657553SN/A parser.add_option("--checker", action="store_true"); 667553SN/A parser.add_option("-n", "--num-cpus", type="int", default=1) 676145SN/A parser.add_option("--sys-clock", action="store", type="string", 688949Sandreas.hansson@arm.com default='1GHz', 697553SN/A help = """Top-level clock for blocks running at system 707553SN/A speed""") 717553SN/A parser.add_option("--cpu-clock", action="store", type="string", 726145SN/A default='2GHz', 738975Sandreas.hansson@arm.com help="Clock for blocks running at CPU speed") 747553SN/A parser.add_option("--smt", action="store_true", default=False, 757553SN/A help = """ 767553SN/A Only used if multiple programs are specified. If true, 777553SN/A then the number of threads per cpu is same as the 787553SN/A number of programs.""") 797553SN/A 807553SN/A # Memory Options 817553SN/A parser.add_option("--list-mem-types", 827553SN/A action="callback", callback=_listMemTypes, 837553SN/A help="List available memory types") 847553SN/A parser.add_option("--mem-type", type="choice", default="simple_mem", 857553SN/A choices=MemConfig.mem_names(), 867553SN/A help = "type of memory to use") 876145SN/A parser.add_option("--mem-size", action="store", type="string", 886145SN/A default="512MB", 897553SN/A help="Specify the physical memory size (single memory)") 908655Sandreas.hansson@arm.com 916145SN/A # Cache Options 927553SN/A parser.add_option("--caches", action="store_true") 937553SN/A parser.add_option("--l2cache", action="store_true") 947553SN/A parser.add_option("--fastmem", action="store_true") 956145SN/A parser.add_option("--num-dirs", type="int", default=1) 967553SN/A parser.add_option("--num-l2caches", type="int", default=1) 977553SN/A parser.add_option("--num-l3caches", type="int", default=1) 987553SN/A parser.add_option("--l1d_size", type="string", default="64kB") 997553SN/A parser.add_option("--l1i_size", type="string", default="32kB") 1007553SN/A parser.add_option("--l2_size", type="string", default="2MB") 1017553SN/A parser.add_option("--l3_size", type="string", default="16MB") 1027553SN/A parser.add_option("--l1d_assoc", type="int", default=2) 1037553SN/A parser.add_option("--l1i_assoc", type="int", default=2) 1047553SN/A parser.add_option("--l2_assoc", type="int", default=8) 1057553SN/A parser.add_option("--l3_assoc", type="int", default=16) 1067553SN/A parser.add_option("--cacheline_size", type="int", default=64) 1076145SN/A 1086145SN/A # Enable Ruby 1097553SN/A parser.add_option("--ruby", action="store_true") 1107553SN/A 1116145SN/A # Run duration options 1127553SN/A parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick, 1136145SN/A metavar="T", help="Stop after T ticks") 114 parser.add_option("--maxtime", type="float") 115 parser.add_option("-I", "--maxinsts", action="store", type="int", 116 default=None, help="""Total number of instructions to 117 simulate (default: run forever)""") 118 parser.add_option("--work-item-id", action="store", type="int", 119 help="the specific work id for exit & checkpointing") 120 parser.add_option("--work-begin-cpu-id-exit", action="store", type="int", 121 help="exit when work starts on the specified cpu") 122 parser.add_option("--work-end-exit-count", action="store", type="int", 123 help="exit at specified work end count") 124 parser.add_option("--work-begin-exit-count", action="store", type="int", 125 help="exit at specified work begin count") 126 parser.add_option("--init-param", action="store", type="int", default=0, 127 help="""Parameter available in simulation with m5 128 initparam""") 129 130 # Simpoint options 131 parser.add_option("--simpoint-profile", action="store_true", 132 help="Enable basic block profiling for SimPoints") 133 parser.add_option("--simpoint-interval", type="int", default=10000000, 134 help="SimPoint interval in num of instructions") 135 136 # Checkpointing options 137 ###Note that performing checkpointing via python script files will override 138 ###checkpoint instructions built into binaries. 139 parser.add_option("--take-checkpoints", action="store", type="string", 140 help="<M,N> take checkpoints at tick M and every N ticks thereafter") 141 parser.add_option("--max-checkpoints", action="store", type="int", 142 help="the maximum number of checkpoints to drop", default=5) 143 parser.add_option("--checkpoint-dir", action="store", type="string", 144 help="Place all checkpoints in this absolute directory") 145 parser.add_option("-r", "--checkpoint-restore", action="store", type="int", 146 help="restore from checkpoint <N>") 147 parser.add_option("--checkpoint-at-end", action="store_true", 148 help="take a checkpoint at end of run") 149 parser.add_option("--work-begin-checkpoint-count", action="store", type="int", 150 help="checkpoint at specified work begin count") 151 parser.add_option("--work-end-checkpoint-count", action="store", type="int", 152 help="checkpoint at specified work end count") 153 parser.add_option("--work-cpus-checkpoint-count", action="store", type="int", 154 help="checkpoint and exit when active cpu count is reached") 155 parser.add_option("--restore-with-cpu", action="store", type="choice", 156 default="atomic", choices=CpuConfig.cpu_names(), 157 help = "cpu type for restoring from a checkpoint") 158 159 160 # CPU Switching - default switch model goes from a checkpoint 161 # to a timing simple CPU with caches to warm up, then to detailed CPU for 162 # data measurement 163 parser.add_option("--repeat-switch", action="store", type="int", 164 default=None, 165 help="switch back and forth between CPUs with period <N>") 166 parser.add_option("-s", "--standard-switch", action="store", type="int", 167 default=None, 168 help="switch from timing to Detailed CPU after warmup period of <N>") 169 parser.add_option("-p", "--prog-interval", type="str", 170 help="CPU Progress Interval") 171 172 # Fastforwarding and simpoint related materials 173 parser.add_option("-W", "--warmup-insts", action="store", type="int", 174 default=None, 175 help="Warmup period in total instructions (requires --standard-switch)") 176 parser.add_option("--bench", action="store", type="string", default=None, 177 help="base names for --take-checkpoint and --checkpoint-restore") 178 parser.add_option("-F", "--fast-forward", action="store", type="string", 179 default=None, 180 help="Number of instructions to fast forward before switching") 181 parser.add_option("-S", "--simpoint", action="store_true", default=False, 182 help="""Use workload simpoints as an instruction offset for 183 --checkpoint-restore or --take-checkpoint.""") 184 parser.add_option("--at-instruction", action="store_true", default=False, 185 help="""Treat value of --checkpoint-restore or --take-checkpoint as a 186 number of instructions.""") 187 188def addSEOptions(parser): 189 # Benchmark options 190 parser.add_option("-c", "--cmd", default="", 191 help="The binary to run in syscall emulation mode.") 192 parser.add_option("-o", "--options", default="", 193 help="""The options to pass to the binary, use " " 194 around the entire string""") 195 parser.add_option("-i", "--input", default="", 196 help="Read stdin from a file.") 197 parser.add_option("--output", default="", 198 help="Redirect stdout to a file.") 199 parser.add_option("--errout", default="", 200 help="Redirect stderr to a file.") 201 202def addFSOptions(parser): 203 # Simulation options 204 parser.add_option("--timesync", action="store_true", 205 help="Prevent simulated time from getting ahead of real time") 206 207 # System options 208 parser.add_option("--kernel", action="store", type="string") 209 parser.add_option("--script", action="store", type="string") 210 parser.add_option("--frame-capture", action="store_true", 211 help="Stores changed frame buffers from the VNC server to compressed "\ 212 "files in the gem5 output directory") 213 214 if buildEnv['TARGET_ISA'] == "arm": 215 parser.add_option("--bare-metal", action="store_true", 216 help="Provide the raw system without the linux specific bits") 217 parser.add_option("--machine-type", action="store", type="choice", 218 choices=ArmMachineType.map.keys(), default="RealView_PBX") 219 parser.add_option("--dtb-filename", action="store", type="string", 220 help="Specifies device tree blob file to use with device-tree-"\ 221 "enabled kernels") 222 # Benchmark options 223 parser.add_option("--dual", action="store_true", 224 help="Simulate two systems attached with an ethernet link") 225 parser.add_option("-b", "--benchmark", action="store", type="string", 226 dest="benchmark", 227 help="Specify the benchmark to run. Available benchmarks: %s"\ 228 % DefinedBenchmarks) 229 230 # Metafile options 231 parser.add_option("--etherdump", action="store", type="string", dest="etherdump", 232 help="Specify the filename to dump a pcap capture of the" \ 233 "ethernet traffic") 234 235 # Disk Image Options 236 parser.add_option("--disk-image", action="store", type="string", default=None, 237 help="Path to the disk image to use.") 238