Options.py revision 9791:39c75548bcd4
1# Copyright (c) 2013 ARM Limited 2# All rights reserved. 3# 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. 12# 13# Copyright (c) 2006-2008 The Regents of The University of Michigan 14# All rights reserved. 15# 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. 26# 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. 38# 39# Authors: Lisa Hsu 40 41import m5 42from m5.defines import buildEnv 43from m5.objects import * 44from Benchmarks import * 45 46import CpuConfig 47import MemConfig 48 49def _listCpuTypes(option, opt, value, parser): 50 CpuConfig.print_cpu_list() 51 sys.exit(0) 52 53def _listMemTypes(option, opt, value, parser): 54 MemConfig.print_mem_list() 55 sys.exit(0) 56 57def addCommonOptions(parser): 58 # system options 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("--list-mem-types", 66 action="callback", callback=_listMemTypes, 67 help="List available memory types") 68 parser.add_option("--mem-type", type="choice", default="simple_mem", 69 choices=MemConfig.mem_names(), 70 help = "type of memory to use") 71 parser.add_option("--checker", action="store_true"); 72 parser.add_option("-n", "--num-cpus", type="int", default=1) 73 parser.add_option("--caches", action="store_true") 74 parser.add_option("--l2cache", action="store_true") 75 parser.add_option("--fastmem", action="store_true") 76 parser.add_option("--simpoint-profile", action="store_true", 77 help="Enable basic block profiling for SimPoints") 78 parser.add_option("--simpoint-interval", type="int", default=10000000, 79 help="SimPoint interval in num of instructions") 80 parser.add_option("--sys-clock", action="store", type="string", 81 default='1GHz', 82 help = """Top-level clock for blocks running at system 83 speed""") 84 parser.add_option("--cpu-clock", action="store", type="string", 85 default='2GHz', 86 help="Clock for blocks running at CPU speed") 87 parser.add_option("--num-dirs", type="int", default=1) 88 parser.add_option("--num-l2caches", type="int", default=1) 89 parser.add_option("--num-l3caches", type="int", default=1) 90 parser.add_option("--l1d_size", type="string", default="64kB") 91 parser.add_option("--l1i_size", type="string", default="32kB") 92 parser.add_option("--l2_size", type="string", default="2MB") 93 parser.add_option("--l3_size", type="string", default="16MB") 94 parser.add_option("--l1d_assoc", type="int", default=2) 95 parser.add_option("--l1i_assoc", type="int", default=2) 96 parser.add_option("--l2_assoc", type="int", default=8) 97 parser.add_option("--l3_assoc", type="int", default=16) 98 parser.add_option("--cacheline_size", type="int", default=64) 99 parser.add_option("--ruby", action="store_true") 100 parser.add_option("--smt", action="store_true", default=False, 101 help = """ 102 Only used if multiple programs are specified. If true, 103 then the number of threads per cpu is same as the 104 number of programs.""") 105 106 # Run duration options 107 parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick, 108 metavar="T", help="Stop after T ticks") 109 parser.add_option("--maxtime", type="float") 110 parser.add_option("-I", "--maxinsts", action="store", type="int", 111 default=None, help="""Total number of instructions to 112 simulate (default: run forever)""") 113 parser.add_option("--work-item-id", action="store", type="int", 114 help="the specific work id for exit & checkpointing") 115 parser.add_option("--work-begin-cpu-id-exit", action="store", type="int", 116 help="exit when work starts on the specified cpu") 117 parser.add_option("--work-end-exit-count", action="store", type="int", 118 help="exit at specified work end count") 119 parser.add_option("--work-begin-exit-count", action="store", type="int", 120 help="exit at specified work begin count") 121 parser.add_option("--init-param", action="store", type="int", default=0, 122 help="""Parameter available in simulation with m5 123 initparam""") 124 125 # Checkpointing options 126 ###Note that performing checkpointing via python script files will override 127 ###checkpoint instructions built into binaries. 128 parser.add_option("--take-checkpoints", action="store", type="string", 129 help="<M,N> take checkpoints at tick M and every N ticks thereafter") 130 parser.add_option("--max-checkpoints", action="store", type="int", 131 help="the maximum number of checkpoints to drop", default=5) 132 parser.add_option("--checkpoint-dir", action="store", type="string", 133 help="Place all checkpoints in this absolute directory") 134 parser.add_option("-r", "--checkpoint-restore", action="store", type="int", 135 help="restore from checkpoint <N>") 136 parser.add_option("--checkpoint-at-end", action="store_true", 137 help="take a checkpoint at end of run") 138 parser.add_option("--work-begin-checkpoint-count", action="store", type="int", 139 help="checkpoint at specified work begin count") 140 parser.add_option("--work-end-checkpoint-count", action="store", type="int", 141 help="checkpoint at specified work end count") 142 parser.add_option("--work-cpus-checkpoint-count", action="store", type="int", 143 help="checkpoint and exit when active cpu count is reached") 144 parser.add_option("--restore-with-cpu", action="store", type="choice", 145 default="atomic", choices=CpuConfig.cpu_names(), 146 help = "cpu type for restoring from a checkpoint") 147 148 149 # CPU Switching - default switch model goes from a checkpoint 150 # to a timing simple CPU with caches to warm up, then to detailed CPU for 151 # data measurement 152 parser.add_option("--repeat-switch", action="store", type="int", 153 default=None, 154 help="switch back and forth between CPUs with period <N>") 155 parser.add_option("-s", "--standard-switch", action="store", type="int", 156 default=None, 157 help="switch from timing to Detailed CPU after warmup period of <N>") 158 parser.add_option("-p", "--prog-interval", type="str", 159 help="CPU Progress Interval") 160 161 # Fastforwarding and simpoint related materials 162 parser.add_option("-W", "--warmup-insts", action="store", type="int", 163 default=None, 164 help="Warmup period in total instructions (requires --standard-switch)") 165 parser.add_option("--bench", action="store", type="string", default=None, 166 help="base names for --take-checkpoint and --checkpoint-restore") 167 parser.add_option("-F", "--fast-forward", action="store", type="string", 168 default=None, 169 help="Number of instructions to fast forward before switching") 170 parser.add_option("-S", "--simpoint", action="store_true", default=False, 171 help="""Use workload simpoints as an instruction offset for 172 --checkpoint-restore or --take-checkpoint.""") 173 parser.add_option("--at-instruction", action="store_true", default=False, 174 help="""Treat value of --checkpoint-restore or --take-checkpoint as a 175 number of instructions.""") 176 177def addSEOptions(parser): 178 # Benchmark options 179 parser.add_option("-c", "--cmd", default="", 180 help="The binary to run in syscall emulation mode.") 181 parser.add_option("-o", "--options", default="", 182 help="""The options to pass to the binary, use " " 183 around the entire string""") 184 parser.add_option("-i", "--input", default="", 185 help="Read stdin from a file.") 186 parser.add_option("--output", default="", 187 help="Redirect stdout to a file.") 188 parser.add_option("--errout", default="", 189 help="Redirect stderr to a file.") 190 191def addFSOptions(parser): 192 # Simulation options 193 parser.add_option("--timesync", action="store_true", 194 help="Prevent simulated time from getting ahead of real time") 195 196 # System options 197 parser.add_option("--kernel", action="store", type="string") 198 parser.add_option("--script", action="store", type="string") 199 parser.add_option("--frame-capture", action="store_true", 200 help="Stores changed frame buffers from the VNC server to compressed "\ 201 "files in the gem5 output directory") 202 203 if buildEnv['TARGET_ISA'] == "arm": 204 parser.add_option("--bare-metal", action="store_true", 205 help="Provide the raw system without the linux specific bits") 206 parser.add_option("--machine-type", action="store", type="choice", 207 choices=ArmMachineType.map.keys(), default="RealView_PBX") 208 parser.add_option("--dtb-filename", action="store", type="string", 209 help="Specifies device tree blob file to use with device-tree-"\ 210 "enabled kernels") 211 # Benchmark options 212 parser.add_option("--dual", action="store_true", 213 help="Simulate two systems attached with an ethernet link") 214 parser.add_option("-b", "--benchmark", action="store", type="string", 215 dest="benchmark", 216 help="Specify the benchmark to run. Available benchmarks: %s"\ 217 % DefinedBenchmarks) 218 219 # Metafile options 220 parser.add_option("--etherdump", action="store", type="string", dest="etherdump", 221 help="Specify the filename to dump a pcap capture of the" \ 222 "ethernet traffic") 223 224 # Disk Image Options 225 parser.add_option("--disk-image", action="store", type="string", default=None, 226 help="Path to the disk image to use.") 227 228 # Memory Size Options 229 parser.add_option("--mem-size", action="store", type="string", default=None, 230 help="Specify the physical memory size (single memory)") 231