Options.py revision 9736
110260SAndrew.Bardsley@arm.com# Copyright (c) 2013 ARM Limited 210260SAndrew.Bardsley@arm.com# All rights reserved. 310260SAndrew.Bardsley@arm.com# 410260SAndrew.Bardsley@arm.com# The license below extends only to copyright in the software and shall 510260SAndrew.Bardsley@arm.com# not be construed as granting a license to any other intellectual 610260SAndrew.Bardsley@arm.com# property including but not limited to intellectual property relating 710260SAndrew.Bardsley@arm.com# to a hardware implementation of the functionality of the software 810260SAndrew.Bardsley@arm.com# licensed hereunder. You may use the software subject to the license 910260SAndrew.Bardsley@arm.com# terms below provided that you ensure that this notice is replicated 1010260SAndrew.Bardsley@arm.com# unmodified and in its entirety in all distributions of the software, 1110260SAndrew.Bardsley@arm.com# modified or unmodified, in source code or in binary form. 1210260SAndrew.Bardsley@arm.com# 1310315Snilay@cs.wisc.edu# Copyright (c) 2006-2008 The Regents of The University of Michigan 1410260SAndrew.Bardsley@arm.com# All rights reserved. 1510260SAndrew.Bardsley@arm.com# 1610260SAndrew.Bardsley@arm.com# Redistribution and use in source and binary forms, with or without 1711570SCurtis.Dunham@arm.com# modification, are permitted provided that the following conditions are 1810260SAndrew.Bardsley@arm.com# met: redistributions of source code must retain the above copyright 1911570SCurtis.Dunham@arm.com# notice, this list of conditions and the following disclaimer; 2010260SAndrew.Bardsley@arm.com# redistributions in binary form must reproduce the above copyright 2110260SAndrew.Bardsley@arm.com# notice, this list of conditions and the following disclaimer in the 2210315Snilay@cs.wisc.edu# documentation and/or other materials provided with the distribution; 2310260SAndrew.Bardsley@arm.com# neither the name of the copyright holders nor the names of its 2410260SAndrew.Bardsley@arm.com# contributors may be used to endorse or promote products derived from 2510260SAndrew.Bardsley@arm.com# this software without specific prior written permission. 2610260SAndrew.Bardsley@arm.com# 2710260SAndrew.Bardsley@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 2810753Sstever@gmail.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 2911570SCurtis.Dunham@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3010260SAndrew.Bardsley@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 3111570SCurtis.Dunham@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3211570SCurtis.Dunham@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 3311570SCurtis.Dunham@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 3411570SCurtis.Dunham@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 3510260SAndrew.Bardsley@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 3610260SAndrew.Bardsley@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 3711570SCurtis.Dunham@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 3811570SCurtis.Dunham@arm.com# 3910260SAndrew.Bardsley@arm.com# Authors: Lisa Hsu 4010260SAndrew.Bardsley@arm.com 4110260SAndrew.Bardsley@arm.comimport m5 4210260SAndrew.Bardsley@arm.comfrom m5.defines import buildEnv 4310260SAndrew.Bardsley@arm.comfrom m5.objects import * 4410260SAndrew.Bardsley@arm.comfrom Benchmarks import * 4510260SAndrew.Bardsley@arm.com 4610260SAndrew.Bardsley@arm.comimport CpuConfig 4710260SAndrew.Bardsley@arm.comimport MemConfig 4810260SAndrew.Bardsley@arm.com 4910260SAndrew.Bardsley@arm.comdef _listCpuTypes(option, opt, value, parser): 5010260SAndrew.Bardsley@arm.com CpuConfig.print_cpu_list() 5110315Snilay@cs.wisc.edu sys.exit(0) 5210260SAndrew.Bardsley@arm.com 5310315Snilay@cs.wisc.edudef _listMemTypes(option, opt, value, parser): 5410260SAndrew.Bardsley@arm.com MemConfig.print_mem_list() 5510260SAndrew.Bardsley@arm.com sys.exit(0) 5610260SAndrew.Bardsley@arm.com 5710260SAndrew.Bardsley@arm.comdef addCommonOptions(parser): 5810260SAndrew.Bardsley@arm.com # system options 5910260SAndrew.Bardsley@arm.com parser.add_option("--list-cpu-types", 6010260SAndrew.Bardsley@arm.com action="callback", callback=_listCpuTypes, 6110260SAndrew.Bardsley@arm.com help="List available CPU types") 6210260SAndrew.Bardsley@arm.com parser.add_option("--cpu-type", type="choice", default="atomic", 6310260SAndrew.Bardsley@arm.com choices=CpuConfig.cpu_names(), 6410260SAndrew.Bardsley@arm.com help = "type of cpu to run with") 6510260SAndrew.Bardsley@arm.com parser.add_option("--list-mem-types", 6610260SAndrew.Bardsley@arm.com action="callback", callback=_listMemTypes, 6711570SCurtis.Dunham@arm.com help="List available memory types") 6810260SAndrew.Bardsley@arm.com parser.add_option("--mem-type", type="choice", default="simple_mem", 6910260SAndrew.Bardsley@arm.com choices=MemConfig.mem_names(), 7010260SAndrew.Bardsley@arm.com help = "type of memory to use") 7110260SAndrew.Bardsley@arm.com parser.add_option("--checker", action="store_true"); 7210260SAndrew.Bardsley@arm.com parser.add_option("-n", "--num-cpus", type="int", default=1) 7310260SAndrew.Bardsley@arm.com parser.add_option("--caches", action="store_true") 7410260SAndrew.Bardsley@arm.com parser.add_option("--l2cache", action="store_true") 7510260SAndrew.Bardsley@arm.com parser.add_option("--fastmem", action="store_true") 7610260SAndrew.Bardsley@arm.com parser.add_option("--simpoint-profile", action="store_true", 7710260SAndrew.Bardsley@arm.com help="Enable basic block profiling for SimPoints") 7810260SAndrew.Bardsley@arm.com parser.add_option("--simpoint-interval", type="int", default=10000000, 7910260SAndrew.Bardsley@arm.com help="SimPoint interval in num of instructions") 8010260SAndrew.Bardsley@arm.com parser.add_option("--clock", action="store", type="string", default='2GHz') 8110260SAndrew.Bardsley@arm.com parser.add_option("--num-dirs", type="int", default=1) 8210260SAndrew.Bardsley@arm.com parser.add_option("--num-l2caches", type="int", default=1) 8310260SAndrew.Bardsley@arm.com parser.add_option("--num-l3caches", type="int", default=1) 8410260SAndrew.Bardsley@arm.com parser.add_option("--l1d_size", type="string", default="64kB") 8510260SAndrew.Bardsley@arm.com parser.add_option("--l1i_size", type="string", default="32kB") 8610260SAndrew.Bardsley@arm.com parser.add_option("--l2_size", type="string", default="2MB") 8710260SAndrew.Bardsley@arm.com parser.add_option("--l3_size", type="string", default="16MB") 8810260SAndrew.Bardsley@arm.com parser.add_option("--l1d_assoc", type="int", default=2) 8910260SAndrew.Bardsley@arm.com parser.add_option("--l1i_assoc", type="int", default=2) 9010260SAndrew.Bardsley@arm.com parser.add_option("--l2_assoc", type="int", default=8) 9110260SAndrew.Bardsley@arm.com parser.add_option("--l3_assoc", type="int", default=16) 9210260SAndrew.Bardsley@arm.com parser.add_option("--cacheline_size", type="int", default=64) 9310260SAndrew.Bardsley@arm.com parser.add_option("--ruby", action="store_true") 9410260SAndrew.Bardsley@arm.com parser.add_option("--smt", action="store_true", default=False, 9510260SAndrew.Bardsley@arm.com help = """ 9610260SAndrew.Bardsley@arm.com Only used if multiple programs are specified. If true, 9710260SAndrew.Bardsley@arm.com then the number of threads per cpu is same as the 9810260SAndrew.Bardsley@arm.com number of programs.""") 9910260SAndrew.Bardsley@arm.com 10010260SAndrew.Bardsley@arm.com # Run duration options 10110260SAndrew.Bardsley@arm.com parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick, 10210260SAndrew.Bardsley@arm.com metavar="T", help="Stop after T ticks") 10310260SAndrew.Bardsley@arm.com parser.add_option("--maxtime", type="float") 10410260SAndrew.Bardsley@arm.com parser.add_option("-I", "--maxinsts", action="store", type="int", 10510260SAndrew.Bardsley@arm.com default=None, help="""Total number of instructions to 10610260SAndrew.Bardsley@arm.com simulate (default: run forever)""") 10710260SAndrew.Bardsley@arm.com parser.add_option("--work-item-id", action="store", type="int", 10810260SAndrew.Bardsley@arm.com help="the specific work id for exit & checkpointing") 10910260SAndrew.Bardsley@arm.com parser.add_option("--work-begin-cpu-id-exit", action="store", type="int", 11010260SAndrew.Bardsley@arm.com help="exit when work starts on the specified cpu") 11110260SAndrew.Bardsley@arm.com parser.add_option("--work-end-exit-count", action="store", type="int", 11211570SCurtis.Dunham@arm.com help="exit at specified work end count") 11311570SCurtis.Dunham@arm.com parser.add_option("--work-begin-exit-count", action="store", type="int", 11411570SCurtis.Dunham@arm.com help="exit at specified work begin count") 11511570SCurtis.Dunham@arm.com parser.add_option("--init-param", action="store", type="int", default=0, 11610260SAndrew.Bardsley@arm.com help="""Parameter available in simulation with m5 11710260SAndrew.Bardsley@arm.com initparam""") 11810260SAndrew.Bardsley@arm.com 11910315Snilay@cs.wisc.edu # Checkpointing options 12010260SAndrew.Bardsley@arm.com ###Note that performing checkpointing via python script files will override 12110260SAndrew.Bardsley@arm.com ###checkpoint instructions built into binaries. 12211570SCurtis.Dunham@arm.com parser.add_option("--take-checkpoints", action="store", type="string", 12310260SAndrew.Bardsley@arm.com help="<M,N> take checkpoints at tick M and every N ticks thereafter") 12410260SAndrew.Bardsley@arm.com parser.add_option("--max-checkpoints", action="store", type="int", 12510260SAndrew.Bardsley@arm.com help="the maximum number of checkpoints to drop", default=5) 12610260SAndrew.Bardsley@arm.com parser.add_option("--checkpoint-dir", action="store", type="string", 12710260SAndrew.Bardsley@arm.com help="Place all checkpoints in this absolute directory") 12810260SAndrew.Bardsley@arm.com parser.add_option("-r", "--checkpoint-restore", action="store", type="int", 12910900Snilay@cs.wisc.edu help="restore from checkpoint <N>") 13010260SAndrew.Bardsley@arm.com parser.add_option("--checkpoint-at-end", action="store_true", 13110260SAndrew.Bardsley@arm.com help="take a checkpoint at end of run") 13210260SAndrew.Bardsley@arm.com parser.add_option("--work-begin-checkpoint-count", action="store", type="int", 13310260SAndrew.Bardsley@arm.com help="checkpoint at specified work begin count") 13410260SAndrew.Bardsley@arm.com parser.add_option("--work-end-checkpoint-count", action="store", type="int", 13510260SAndrew.Bardsley@arm.com help="checkpoint at specified work end count") 13610260SAndrew.Bardsley@arm.com parser.add_option("--work-cpus-checkpoint-count", action="store", type="int", 13710260SAndrew.Bardsley@arm.com help="checkpoint and exit when active cpu count is reached") 13811570SCurtis.Dunham@arm.com parser.add_option("--restore-with-cpu", action="store", type="choice", 13911570SCurtis.Dunham@arm.com default="atomic", choices=CpuConfig.cpu_names(), 14011570SCurtis.Dunham@arm.com help = "cpu type for restoring from a checkpoint") 14111570SCurtis.Dunham@arm.com 14211570SCurtis.Dunham@arm.com 14311570SCurtis.Dunham@arm.com # CPU Switching - default switch model goes from a checkpoint 14410260SAndrew.Bardsley@arm.com # to a timing simple CPU with caches to warm up, then to detailed CPU for 14510260SAndrew.Bardsley@arm.com # data measurement 14610260SAndrew.Bardsley@arm.com parser.add_option("--repeat-switch", action="store", type="int", 14710260SAndrew.Bardsley@arm.com default=None, 14810260SAndrew.Bardsley@arm.com help="switch back and forth between CPUs with period <N>") 14911570SCurtis.Dunham@arm.com parser.add_option("-s", "--standard-switch", action="store", type="int", 15010260SAndrew.Bardsley@arm.com default=None, 15110260SAndrew.Bardsley@arm.com help="switch from timing to Detailed CPU after warmup period of <N>") 15211103Snilay@cs.wisc.edu parser.add_option("-p", "--prog-interval", type="str", 15310260SAndrew.Bardsley@arm.com help="CPU Progress Interval") 15410260SAndrew.Bardsley@arm.com 15510260SAndrew.Bardsley@arm.com # Fastforwarding and simpoint related materials 15610260SAndrew.Bardsley@arm.com parser.add_option("-W", "--warmup-insts", action="store", type="int", 15711570SCurtis.Dunham@arm.com default=None, 15811570SCurtis.Dunham@arm.com help="Warmup period in total instructions (requires --standard-switch)") 15910753Sstever@gmail.com parser.add_option("--bench", action="store", type="string", default=None, 16010260SAndrew.Bardsley@arm.com help="base names for --take-checkpoint and --checkpoint-restore") 16110260SAndrew.Bardsley@arm.com parser.add_option("-F", "--fast-forward", action="store", type="string", 16210900Snilay@cs.wisc.edu default=None, 16310260SAndrew.Bardsley@arm.com help="Number of instructions to fast forward before switching") 16410260SAndrew.Bardsley@arm.com parser.add_option("-S", "--simpoint", action="store_true", default=False, 16511570SCurtis.Dunham@arm.com help="""Use workload simpoints as an instruction offset for 16611570SCurtis.Dunham@arm.com --checkpoint-restore or --take-checkpoint.""") 16711570SCurtis.Dunham@arm.com parser.add_option("--at-instruction", action="store_true", default=False, 16811570SCurtis.Dunham@arm.com help="""Treat value of --checkpoint-restore or --take-checkpoint as a 16910260SAndrew.Bardsley@arm.com number of instructions.""") 17010260SAndrew.Bardsley@arm.com 17110260SAndrew.Bardsley@arm.comdef addSEOptions(parser): 17210260SAndrew.Bardsley@arm.com # Benchmark options 17310260SAndrew.Bardsley@arm.com parser.add_option("-c", "--cmd", default="", 17410260SAndrew.Bardsley@arm.com help="The binary to run in syscall emulation mode.") 17510260SAndrew.Bardsley@arm.com parser.add_option("-o", "--options", default="", 17610260SAndrew.Bardsley@arm.com help="""The options to pass to the binary, use " " 17710260SAndrew.Bardsley@arm.com around the entire string""") 17811570SCurtis.Dunham@arm.com parser.add_option("-i", "--input", default="", 17910260SAndrew.Bardsley@arm.com help="Read stdin from a file.") 18010260SAndrew.Bardsley@arm.com parser.add_option("--output", default="", 18110260SAndrew.Bardsley@arm.com help="Redirect stdout to a file.") 18210260SAndrew.Bardsley@arm.com parser.add_option("--errout", default="", 18310260SAndrew.Bardsley@arm.com help="Redirect stderr to a file.") 18410260SAndrew.Bardsley@arm.com 18510260SAndrew.Bardsley@arm.comdef addFSOptions(parser): 18610260SAndrew.Bardsley@arm.com # Simulation options 18711570SCurtis.Dunham@arm.com parser.add_option("--timesync", action="store_true", 18810260SAndrew.Bardsley@arm.com help="Prevent simulated time from getting ahead of real time") 18910260SAndrew.Bardsley@arm.com 19011570SCurtis.Dunham@arm.com # System options 19111570SCurtis.Dunham@arm.com parser.add_option("--kernel", action="store", type="string") 19211570SCurtis.Dunham@arm.com parser.add_option("--script", action="store", type="string") 19311570SCurtis.Dunham@arm.com parser.add_option("--frame-capture", action="store_true", 19410260SAndrew.Bardsley@arm.com help="Stores changed frame buffers from the VNC server to compressed "\ 19510260SAndrew.Bardsley@arm.com "files in the gem5 output directory") 19610260SAndrew.Bardsley@arm.com 19710260SAndrew.Bardsley@arm.com if buildEnv['TARGET_ISA'] == "arm": 19810260SAndrew.Bardsley@arm.com parser.add_option("--bare-metal", action="store_true", 19910260SAndrew.Bardsley@arm.com help="Provide the raw system without the linux specific bits") 20010260SAndrew.Bardsley@arm.com parser.add_option("--machine-type", action="store", type="choice", 20110260SAndrew.Bardsley@arm.com choices=ArmMachineType.map.keys(), default="RealView_PBX") 20210753Sstever@gmail.com parser.add_option("--dtb-filename", action="store", type="string", 20310260SAndrew.Bardsley@arm.com help="Specifies device tree blob file to use with device-tree-"\ 20410260SAndrew.Bardsley@arm.com "enabled kernels") 20510260SAndrew.Bardsley@arm.com # Benchmark options 20610260SAndrew.Bardsley@arm.com parser.add_option("--dual", action="store_true", 20710260SAndrew.Bardsley@arm.com help="Simulate two systems attached with an ethernet link") 20810260SAndrew.Bardsley@arm.com parser.add_option("-b", "--benchmark", action="store", type="string", 20910260SAndrew.Bardsley@arm.com dest="benchmark", 21010260SAndrew.Bardsley@arm.com help="Specify the benchmark to run. Available benchmarks: %s"\ 21110260SAndrew.Bardsley@arm.com % DefinedBenchmarks) 21210260SAndrew.Bardsley@arm.com 21310260SAndrew.Bardsley@arm.com # Metafile options 21410260SAndrew.Bardsley@arm.com parser.add_option("--etherdump", action="store", type="string", dest="etherdump", 21510260SAndrew.Bardsley@arm.com help="Specify the filename to dump a pcap capture of the" \ 21611570SCurtis.Dunham@arm.com "ethernet traffic") 21710260SAndrew.Bardsley@arm.com 21810260SAndrew.Bardsley@arm.com # Disk Image Options 21910260SAndrew.Bardsley@arm.com parser.add_option("--disk-image", action="store", type="string", default=None, 22011570SCurtis.Dunham@arm.com help="Path to the disk image to use.") 22111570SCurtis.Dunham@arm.com 22211570SCurtis.Dunham@arm.com # Memory Size Options 22311570SCurtis.Dunham@arm.com parser.add_option("--mem-size", action="store", type="string", default=None, 22410260SAndrew.Bardsley@arm.com help="Specify the physical memory size (single memory)") 22510260SAndrew.Bardsley@arm.com