Options.py revision 11251:a15c86af004a
11689SN/A# Copyright (c) 2013 ARM Limited 210596Sgabeblack@google.com# All rights reserved. 312216Snikos.nikoleris@arm.com# 47783SGiacomo.Gabrielli@arm.com# The license below extends only to copyright in the software and shall 57783SGiacomo.Gabrielli@arm.com# not be construed as granting a license to any other intellectual 67783SGiacomo.Gabrielli@arm.com# property including but not limited to intellectual property relating 77783SGiacomo.Gabrielli@arm.com# to a hardware implementation of the functionality of the software 87783SGiacomo.Gabrielli@arm.com# licensed hereunder. You may use the software subject to the license 97783SGiacomo.Gabrielli@arm.com# terms below provided that you ensure that this notice is replicated 107783SGiacomo.Gabrielli@arm.com# unmodified and in its entirety in all distributions of the software, 117783SGiacomo.Gabrielli@arm.com# modified or unmodified, in source code or in binary form. 127783SGiacomo.Gabrielli@arm.com# 137783SGiacomo.Gabrielli@arm.com# Copyright (c) 2006-2008 The Regents of The University of Michigan 147783SGiacomo.Gabrielli@arm.com# All rights reserved. 152316SN/A# 161689SN/A# Redistribution and use in source and binary forms, with or without 171689SN/A# modification, are permitted provided that the following conditions are 181689SN/A# met: redistributions of source code must retain the above copyright 191689SN/A# notice, this list of conditions and the following disclaimer; 201689SN/A# redistributions in binary form must reproduce the above copyright 211689SN/A# notice, this list of conditions and the following disclaimer in the 221689SN/A# documentation and/or other materials provided with the distribution; 231689SN/A# neither the name of the copyright holders nor the names of its 241689SN/A# contributors may be used to endorse or promote products derived from 251689SN/A# this software without specific prior written permission. 261689SN/A# 271689SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 281689SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 291689SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 301689SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 311689SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 321689SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 331689SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 341689SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 351689SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 361689SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 371689SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 381689SN/A# 391689SN/A# Authors: Lisa Hsu 402665Ssaidi@eecs.umich.edu 412665Ssaidi@eecs.umich.eduimport m5 422965Sksewell@umich.edufrom m5.defines import buildEnv 431689SN/Afrom m5.objects import * 449944Smatt.horsnell@ARM.comfrom Benchmarks import * 459944Smatt.horsnell@ARM.com 461689SN/Aimport CpuConfig 472292SN/Aimport MemConfig 489516SAli.Saidi@ARM.comimport PlatformConfig 492329SN/A 502292SN/Afrom FSConfig import os_types 513577Sgblack@eecs.umich.edu 5213449Sgabeblack@google.comdef _listCpuTypes(option, opt, value, parser): 538229Snate@binkert.org CpuConfig.print_cpu_list() 5413449Sgabeblack@google.com sys.exit(0) 556658Snate@binkert.org 568887Sgeoffrey.blake@arm.comdef _listMemTypes(option, opt, value, parser): 571717SN/A MemConfig.print_mem_list() 582292SN/A sys.exit(0) 598662SAli.Saidi@ARM.com 608229Snate@binkert.orgdef _listPlatformTypes(option, opt, value, parser): 618229Snate@binkert.org PlatformConfig.print_platform_list() 628232Snate@binkert.org sys.exit(0) 638232Snate@binkert.org 648232Snate@binkert.orgdef addCommonOptions(parser): 659444SAndreas.Sandberg@ARM.com # system options 668232Snate@binkert.org parser.add_option("--list-cpu-types", 679527SMatt.Horsnell@arm.com action="callback", callback=_listCpuTypes, 686221Snate@binkert.org help="List available CPU types") 698230Snate@binkert.org parser.add_option("--cpu-type", type="choice", default="atomic", 708793Sgblack@eecs.umich.edu choices=CpuConfig.cpu_names(), 712292SN/A help = "type of cpu to run with") 726221Snate@binkert.org parser.add_option("--checker", action="store_true"); 735529Snate@binkert.org parser.add_option("-n", "--num-cpus", type="int", default=1) 741061SN/A parser.add_option("--sys-voltage", action="store", type="string", 751060SN/A default='1.0V', 7612127Sspwilson2@wisc.edu help = """Top-level voltage for blocks running at system 771062SN/A power supply""") 782316SN/A parser.add_option("--sys-clock", action="store", type="string", 792316SN/A default='1GHz', 8012127Sspwilson2@wisc.edu help = """Top-level clock for blocks running at system 812292SN/A speed""") 822292SN/A parser.add_option("--cpu-clock", action="store", type="string", 832292SN/A default='2GHz', 845529Snate@binkert.org help="Clock for blocks running at CPU speed") 8513563Snikos.nikoleris@arm.com parser.add_option("--smt", action="store_true", default=False, 8613563Snikos.nikoleris@arm.com help = """ 872292SN/A Only used if multiple programs are specified. If true, 882292SN/A then the number of threads per cpu is same as the 892292SN/A number of programs.""") 902292SN/A parser.add_option("--elastic-trace-en", action="store_true", 912292SN/A help="""Enable capture of data dependency and instruction 922292SN/A fetch traces using elastic trace probe.""") 935529Snate@binkert.org # Trace file paths input to trace probe in a capture simulation and input 942843Sktlim@umich.edu # to Trace CPU in a replay simulation 9510340Smitch.hayenga@arm.com parser.add_option("--inst-trace-file", action="store", type="string", 968823Snilay@cs.wisc.edu help="""Instruction fetch trace file input to 979513SAli.Saidi@ARM.com Elastic Trace probe in a capture simulation and 989513SAli.Saidi@ARM.com Trace CPU in a replay simulation""", default="") 992292SN/A parser.add_option("--data-trace-file", action="store", type="string", 10010172Sdam.sunwoo@arm.com help="""Data dependency trace file input to 10110172Sdam.sunwoo@arm.com Elastic Trace probe in a capture simulation and 10210172Sdam.sunwoo@arm.com Trace CPU in a replay simulation""", default="") 10310172Sdam.sunwoo@arm.com 10410172Sdam.sunwoo@arm.com # Memory Options 1052292SN/A parser.add_option("--list-mem-types", 1062292SN/A action="callback", callback=_listMemTypes, 1072292SN/A help="List available memory types") 10813563Snikos.nikoleris@arm.com parser.add_option("--mem-type", type="choice", default="DDR3_1600_x64", 1092292SN/A choices=MemConfig.mem_names(), 1106221Snate@binkert.org help = "type of memory to use") 1112292SN/A parser.add_option("--mem-channels", type="int", default=1, 1122292SN/A help = "number of memory channels") 1132292SN/A parser.add_option("--mem-ranks", type="int", default=None, 1142292SN/A help = "number of memory ranks per channel") 11513453Srekai.gonzalezalberquilla@arm.com parser.add_option("--mem-size", action="store", type="string", 1166221Snate@binkert.org default="512MB", 1176221Snate@binkert.org help="Specify the physical memory size (single memory)") 11813453Srekai.gonzalezalberquilla@arm.com 11913453Srekai.gonzalezalberquilla@arm.com parser.add_option("-l", "--lpae", action="store_true") 12013453Srekai.gonzalezalberquilla@arm.com parser.add_option("-V", "--virtualisation", action="store_true") 12113453Srekai.gonzalezalberquilla@arm.com 12213453Srekai.gonzalezalberquilla@arm.com parser.add_option("--memchecker", action="store_true") 12313453Srekai.gonzalezalberquilla@arm.com 1246221Snate@binkert.org # Cache Options 1256221Snate@binkert.org parser.add_option("--external-memory-system", type="string", 12613453Srekai.gonzalezalberquilla@arm.com help="use external ports of this port_type for caches") 12713453Srekai.gonzalezalberquilla@arm.com parser.add_option("--tlm-memory", type="string", 1282292SN/A help="use external port for SystemC TLM cosimulation") 1293640Sktlim@umich.edu parser.add_option("--caches", action="store_true") 1302292SN/A parser.add_option("--l2cache", action="store_true") 1312292SN/A parser.add_option("--fastmem", action="store_true") 1322292SN/A parser.add_option("--num-dirs", type="int", default=1) 1332292SN/A parser.add_option("--num-l2caches", type="int", default=1) 1342292SN/A parser.add_option("--num-l3caches", type="int", default=1) 1352292SN/A parser.add_option("--l1d_size", type="string", default="64kB") 1362292SN/A parser.add_option("--l1i_size", type="string", default="32kB") 1372292SN/A parser.add_option("--l2_size", type="string", default="2MB") 1382292SN/A parser.add_option("--l3_size", type="string", default="16MB") 1392292SN/A parser.add_option("--l1d_assoc", type="int", default=2) 1402292SN/A parser.add_option("--l1i_assoc", type="int", default=2) 14110023Smatt.horsnell@ARM.com parser.add_option("--l2_assoc", type="int", default=8) 14210023Smatt.horsnell@ARM.com parser.add_option("--l3_assoc", type="int", default=16) 14310023Smatt.horsnell@ARM.com parser.add_option("--cacheline_size", type="int", default=64) 14410023Smatt.horsnell@ARM.com 14511246Sradhika.jagtap@ARM.com # Enable Ruby 14610023Smatt.horsnell@ARM.com parser.add_option("--ruby", action="store_true") 14710023Smatt.horsnell@ARM.com 14810023Smatt.horsnell@ARM.com # Run duration options 14910023Smatt.horsnell@ARM.com parser.add_option("-m", "--abs-max-tick", type="int", default=m5.MaxTick, 1502292SN/A metavar="TICKS", help="Run to absolute simulated tick " \ 1512132SN/A "specified including ticks from a restored checkpoint") 1522301SN/A parser.add_option("--rel-max-tick", type="int", default=None, 1531062SN/A metavar="TICKS", help="Simulate for specified number of" \ 1541062SN/A " ticks relative to the simulation start tick (e.g. if " \ 1551062SN/A "restoring a checkpoint)") 1561062SN/A parser.add_option("--maxtime", type="float", default=None, 15710731Snilay@cs.wisc.edu help="Run to the specified absolute simulated time in " \ 1581062SN/A "seconds") 1591062SN/A parser.add_option("-I", "--maxinsts", action="store", type="int", 1601062SN/A default=None, help="""Total number of instructions to 1611062SN/A simulate (default: run forever)""") 1621062SN/A parser.add_option("--work-item-id", action="store", type="int", 16310731Snilay@cs.wisc.edu help="the specific work id for exit & checkpointing") 1641062SN/A parser.add_option("--num-work-ids", action="store", type="int", 1651062SN/A help="Number of distinct work item types") 1661062SN/A parser.add_option("--work-begin-cpu-id-exit", action="store", type="int", 1671062SN/A help="exit when work starts on the specified cpu") 16810731Snilay@cs.wisc.edu parser.add_option("--work-end-exit-count", action="store", type="int", 1692292SN/A help="exit at specified work end count") 1701062SN/A parser.add_option("--work-begin-exit-count", action="store", type="int", 1718240Snate@binkert.org help="exit at specified work begin count") 1721062SN/A parser.add_option("--init-param", action="store", type="int", default=0, 1731062SN/A help="""Parameter available in simulation with m5 1741062SN/A initparam""") 1752301SN/A parser.add_option("--initialize-only", action="store_true", default=False, 1768834Satgutier@umich.edu help="""Exit after initialization. Do not simulate time. 1776221Snate@binkert.org Useful when gem5 is run as a library.""") 1788834Satgutier@umich.edu 1792301SN/A # Simpoint options 1802301SN/A parser.add_option("--simpoint-profile", action="store_true", 1812301SN/A help="Enable basic block profiling for SimPoints") 1822301SN/A parser.add_option("--simpoint-interval", type="int", default=10000000, 1838834Satgutier@umich.edu help="SimPoint interval in num of instructions") 1848834Satgutier@umich.edu parser.add_option("--take-simpoint-checkpoints", action="store", type="string", 1858834Satgutier@umich.edu help="<simpoint file,weight file,interval-length,warmup-length>") 1868834Satgutier@umich.edu parser.add_option("--restore-simpoint-checkpoint", action="store_true", 1878834Satgutier@umich.edu help="restore from a simpoint checkpoint taken with " + 1888834Satgutier@umich.edu "--take-simpoint-checkpoints") 1898834Satgutier@umich.edu 1902316SN/A # Checkpointing options 1916221Snate@binkert.org ###Note that performing checkpointing via python script files will override 1928240Snate@binkert.org ###checkpoint instructions built into binaries. 1932301SN/A parser.add_option("--take-checkpoints", action="store", type="string", 1942301SN/A help="<M,N> take checkpoints at tick M and every N ticks thereafter") 1952301SN/A parser.add_option("--max-checkpoints", action="store", type="int", 1962301SN/A help="the maximum number of checkpoints to drop", default=5) 1972316SN/A parser.add_option("--checkpoint-dir", action="store", type="string", 1986221Snate@binkert.org help="Place all checkpoints in this absolute directory") 1998240Snate@binkert.org parser.add_option("-r", "--checkpoint-restore", action="store", type="int", 2002301SN/A help="restore from checkpoint <N>") 2012301SN/A parser.add_option("--checkpoint-at-end", action="store_true", 2022301SN/A help="take a checkpoint at end of run") 2032301SN/A parser.add_option("--work-begin-checkpoint-count", action="store", type="int", 2042316SN/A help="checkpoint at specified work begin count") 2056221Snate@binkert.org parser.add_option("--work-end-checkpoint-count", action="store", type="int", 2068240Snate@binkert.org help="checkpoint at specified work end count") 2072301SN/A parser.add_option("--work-cpus-checkpoint-count", action="store", type="int", 2082301SN/A help="checkpoint and exit when active cpu count is reached") 2092301SN/A parser.add_option("--restore-with-cpu", action="store", type="choice", 2102301SN/A default="atomic", choices=CpuConfig.cpu_names(), 2112316SN/A help = "cpu type for restoring from a checkpoint") 2126221Snate@binkert.org 2138240Snate@binkert.org 2142301SN/A # CPU Switching - default switch model goes from a checkpoint 2152301SN/A # to a timing simple CPU with caches to warm up, then to detailed CPU for 2162301SN/A # data measurement 2172301SN/A parser.add_option("--repeat-switch", action="store", type="int", 2182316SN/A default=None, 2196221Snate@binkert.org help="switch back and forth between CPUs with period <N>") 2208240Snate@binkert.org parser.add_option("-s", "--standard-switch", action="store", type="int", 2212301SN/A default=None, 2222301SN/A help="switch from timing to Detailed CPU after warmup period of <N>") 2232301SN/A parser.add_option("-p", "--prog-interval", type="str", 2242301SN/A help="CPU Progress Interval") 2257897Shestness@cs.utexas.edu 2267897Shestness@cs.utexas.edu # Fastforwarding and simpoint related materials 2278240Snate@binkert.org parser.add_option("-W", "--warmup-insts", action="store", type="int", 2287897Shestness@cs.utexas.edu default=None, 2297897Shestness@cs.utexas.edu help="Warmup period in total instructions (requires --standard-switch)") 2307897Shestness@cs.utexas.edu parser.add_option("--bench", action="store", type="string", default=None, 2317897Shestness@cs.utexas.edu help="base names for --take-checkpoint and --checkpoint-restore") 23212110SRekai.GonzalezAlberquilla@arm.com parser.add_option("-F", "--fast-forward", action="store", type="string", 23312110SRekai.GonzalezAlberquilla@arm.com default=None, 23412110SRekai.GonzalezAlberquilla@arm.com help="Number of instructions to fast forward before switching") 23512110SRekai.GonzalezAlberquilla@arm.com parser.add_option("-S", "--simpoint", action="store_true", default=False, 23612110SRekai.GonzalezAlberquilla@arm.com help="""Use workload simpoints as an instruction offset for 23712110SRekai.GonzalezAlberquilla@arm.com --checkpoint-restore or --take-checkpoint.""") 23812110SRekai.GonzalezAlberquilla@arm.com parser.add_option("--at-instruction", action="store_true", default=False, 2397897Shestness@cs.utexas.edu help="""Treat value of --checkpoint-restore or --take-checkpoint as a 2407897Shestness@cs.utexas.edu number of instructions.""") 2418240Snate@binkert.org parser.add_option("--spec-input", default="ref", type="choice", 2427897Shestness@cs.utexas.edu choices=["ref", "test", "train", "smred", "mdred", 2437897Shestness@cs.utexas.edu "lgred"], 2447897Shestness@cs.utexas.edu help="Input set size for SPEC CPU2000 benchmarks.") 2457897Shestness@cs.utexas.edu parser.add_option("--arm-iset", default="arm", type="choice", 2467897Shestness@cs.utexas.edu choices=["arm", "thumb", "aarch64"], 2477897Shestness@cs.utexas.edu help="ARM instruction set.") 2488240Snate@binkert.org 2497897Shestness@cs.utexas.edu 2507897Shestness@cs.utexas.edudef addSEOptions(parser): 2517897Shestness@cs.utexas.edu # Benchmark options 2527897Shestness@cs.utexas.edu parser.add_option("-c", "--cmd", default="", 25310193SCurtis.Dunham@arm.com help="The binary to run in syscall emulation mode.") 25410193SCurtis.Dunham@arm.com parser.add_option("-o", "--options", default="", 25510193SCurtis.Dunham@arm.com help="""The options to pass to the binary, use " " 25610193SCurtis.Dunham@arm.com around the entire string""") 25710193SCurtis.Dunham@arm.com parser.add_option("-e", "--env", default="", 25810193SCurtis.Dunham@arm.com help="Initialize workload environment from text file.") 25910193SCurtis.Dunham@arm.com parser.add_option("-i", "--input", default="", 26010193SCurtis.Dunham@arm.com help="Read stdin from a file.") 2612316SN/A parser.add_option("--output", default="", 2628240Snate@binkert.org help="Redirect stdout to a file.") 2632301SN/A parser.add_option("--errout", default="", 2642301SN/A help="Redirect stderr to a file.") 2651062SN/A 2661062SN/Adef addFSOptions(parser): 2671062SN/A # Simulation options 2681062SN/A parser.add_option("--timesync", action="store_true", 2692980Sgblack@eecs.umich.edu help="Prevent simulated time from getting ahead of real time") 2702292SN/A 2712292SN/A # System options 2722292SN/A parser.add_option("--kernel", action="store", type="string") 2732292SN/A parser.add_option("--os-type", action="store", type="choice", 2742292SN/A choices=os_types[buildEnv['TARGET_ISA']], default="linux", 2752292SN/A help="Specifies type of OS to boot") 2762292SN/A parser.add_option("--script", action="store", type="string") 2771060SN/A parser.add_option("--frame-capture", action="store_true", 2781060SN/A help="Stores changed frame buffers from the VNC server to compressed "\ 2791060SN/A "files in the gem5 output directory") 2801060SN/A 2811060SN/A if buildEnv['TARGET_ISA'] == "arm": 2821060SN/A parser.add_option("--bare-metal", action="store_true", 2831060SN/A help="Provide the raw system without the linux specific bits") 2841060SN/A parser.add_option("--list-machine-types", 2851060SN/A action="callback", callback=_listPlatformTypes, 2861060SN/A help="List available platform types") 2871061SN/A parser.add_option("--machine-type", action="store", type="choice", 2881060SN/A choices=PlatformConfig.platform_names(), 2892292SN/A default="VExpress_EMM") 2902292SN/A parser.add_option("--dtb-filename", action="store", type="string", 2912292SN/A help="Specifies device tree blob file to use with device-tree-"\ 2922292SN/A "enabled kernels") 2932292SN/A parser.add_option("--enable-context-switch-stats-dump", \ 2942292SN/A action="store_true", help="Enable stats dump at context "\ 2952292SN/A "switches and dump tasks file (required for Streamline)") 2962292SN/A 2972292SN/A # Benchmark options 2982292SN/A parser.add_option("--dual", action="store_true", 2992292SN/A help="Simulate two systems attached with an ethernet link") 3001060SN/A parser.add_option("-b", "--benchmark", action="store", type="string", 3011060SN/A dest="benchmark", 3021060SN/A help="Specify the benchmark to run. Available benchmarks: %s"\ 3031060SN/A % DefinedBenchmarks) 3041060SN/A 3051060SN/A # Metafile options 3061060SN/A parser.add_option("--etherdump", action="store", type="string", dest="etherdump", 3071061SN/A help="Specify the filename to dump a pcap capture of the" \ 3081060SN/A "ethernet traffic") 3092292SN/A 3101060SN/A # Disk Image Options 3111060SN/A parser.add_option("--disk-image", action="store", type="string", default=None, 3121060SN/A help="Path to the disk image to use.") 3131060SN/A parser.add_option("--root-device", action="store", type="string", default=None, 3141060SN/A help="OS device name for root partition") 3151060SN/A 3161060SN/A # Command line options 3171061SN/A parser.add_option("--command-line", action="store", type="string", 3181060SN/A default=None, 3192292SN/A help="Template for the kernel command line.") 3202292SN/A parser.add_option("--command-line-file", action="store", 3212292SN/A default=None, type="string", 3222292SN/A help="File with a template for the kernel command line") 3232292SN/A