Options.py revision 11995
12292SN/A# Copyright (c) 2013 ARM Limited 22727Sktlim@umich.edu# All rights reserved. 32292SN/A# 42292SN/A# The license below extends only to copyright in the software and shall 52292SN/A# not be construed as granting a license to any other intellectual 62292SN/A# property including but not limited to intellectual property relating 72292SN/A# to a hardware implementation of the functionality of the software 82292SN/A# licensed hereunder. You may use the software subject to the license 92292SN/A# terms below provided that you ensure that this notice is replicated 102292SN/A# unmodified and in its entirety in all distributions of the software, 112292SN/A# modified or unmodified, in source code or in binary form. 122292SN/A# 132292SN/A# Copyright (c) 2006-2008 The Regents of The University of Michigan 142292SN/A# All rights reserved. 152292SN/A# 162292SN/A# Redistribution and use in source and binary forms, with or without 172292SN/A# modification, are permitted provided that the following conditions are 182292SN/A# met: redistributions of source code must retain the above copyright 192292SN/A# notice, this list of conditions and the following disclaimer; 202292SN/A# redistributions in binary form must reproduce the above copyright 212292SN/A# notice, this list of conditions and the following disclaimer in the 222292SN/A# documentation and/or other materials provided with the distribution; 232292SN/A# neither the name of the copyright holders nor the names of its 242292SN/A# contributors may be used to endorse or promote products derived from 252292SN/A# this software without specific prior written permission. 262292SN/A# 272689Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 282689Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 292292SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 302292SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 312329SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 322980Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 332329SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 342329SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 352292SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 362292SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 372292SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 382907Sktlim@umich.edu# 392907Sktlim@umich.edu# Authors: Lisa Hsu 402907Sktlim@umich.edu 412907Sktlim@umich.eduimport m5 422907Sktlim@umich.edufrom m5.defines import buildEnv 432907Sktlim@umich.edufrom m5.objects import * 442907Sktlim@umich.edufrom common.Benchmarks import * 452907Sktlim@umich.edu 462907Sktlim@umich.edufrom common import CpuConfig 472907Sktlim@umich.edufrom common import MemConfig 482907Sktlim@umich.edufrom common import PlatformConfig 493639Sktlim@umich.edu 502907Sktlim@umich.edudef _listCpuTypes(option, opt, value, parser): 512907Sktlim@umich.edu CpuConfig.print_cpu_list() 522907Sktlim@umich.edu sys.exit(0) 532907Sktlim@umich.edu 542907Sktlim@umich.edudef _listMemTypes(option, opt, value, parser): 552907Sktlim@umich.edu MemConfig.print_mem_list() 563647Srdreslin@umich.edu sys.exit(0) 573647Srdreslin@umich.edu 583647Srdreslin@umich.edudef _listPlatformTypes(option, opt, value, parser): 593647Srdreslin@umich.edu PlatformConfig.print_platform_list() 603647Srdreslin@umich.edu sys.exit(0) 612907Sktlim@umich.edu 623647Srdreslin@umich.edu# Add the very basic options that work also in the case of the no ISA 632907Sktlim@umich.edu# being used, and consequently no CPUs, but rather various types of 642907Sktlim@umich.edu# testers and traffic generators. 652907Sktlim@umich.edudef addNoISAOptions(parser): 662907Sktlim@umich.edu parser.add_option("-n", "--num-cpus", type="int", default=1) 672907Sktlim@umich.edu parser.add_option("--sys-voltage", action="store", type="string", 682907Sktlim@umich.edu default='1.0V', 692907Sktlim@umich.edu help = """Top-level voltage for blocks running at system 703310Srdreslin@umich.edu power supply""") 713310Srdreslin@umich.edu parser.add_option("--sys-clock", action="store", type="string", 723310Srdreslin@umich.edu default='1GHz', 733310Srdreslin@umich.edu help = """Top-level clock for blocks running at system 743310Srdreslin@umich.edu speed""") 753339Srdreslin@umich.edu 763310Srdreslin@umich.edu # Memory Options 773310Srdreslin@umich.edu parser.add_option("--list-mem-types", 782907Sktlim@umich.edu action="callback", callback=_listMemTypes, 792907Sktlim@umich.edu help="List available memory types") 802907Sktlim@umich.edu parser.add_option("--mem-type", type="choice", default="DDR3_1600_8x8", 812907Sktlim@umich.edu choices=MemConfig.mem_names(), 822907Sktlim@umich.edu help = "type of memory to use") 832907Sktlim@umich.edu parser.add_option("--mem-channels", type="int", default=1, 842907Sktlim@umich.edu help = "number of memory channels") 853014Srdreslin@umich.edu parser.add_option("--mem-ranks", type="int", default=None, 863014Srdreslin@umich.edu help = "number of memory ranks per channel") 873014Srdreslin@umich.edu parser.add_option("--mem-size", action="store", type="string", 883014Srdreslin@umich.edu default="512MB", 893014Srdreslin@umich.edu help="Specify the physical memory size (single memory)") 902907Sktlim@umich.edu 912907Sktlim@umich.edu 922907Sktlim@umich.edu parser.add_option("--memchecker", action="store_true") 932907Sktlim@umich.edu 942907Sktlim@umich.edu # Cache Options 952907Sktlim@umich.edu parser.add_option("--external-memory-system", type="string", 962907Sktlim@umich.edu help="use external ports of this port_type for caches") 972292SN/A parser.add_option("--tlm-memory", type="string", 982907Sktlim@umich.edu help="use external port for SystemC TLM cosimulation") 992907Sktlim@umich.edu parser.add_option("--caches", action="store_true") 1002907Sktlim@umich.edu parser.add_option("--l2cache", action="store_true") 1012292SN/A parser.add_option("--num-dirs", type="int", default=1) 1022292SN/A parser.add_option("--num-l2caches", type="int", default=1) 1032292SN/A parser.add_option("--num-l3caches", type="int", default=1) 1043647Srdreslin@umich.edu parser.add_option("--l1d_size", type="string", default="64kB") 1053647Srdreslin@umich.edu parser.add_option("--l1i_size", type="string", default="32kB") 1062292SN/A parser.add_option("--l2_size", type="string", default="2MB") 1072292SN/A parser.add_option("--l3_size", type="string", default="16MB") 1082292SN/A parser.add_option("--l1d_assoc", type="int", default=2) 1092980Sgblack@eecs.umich.edu parser.add_option("--l1i_assoc", type="int", default=2) 1102292SN/A parser.add_option("--l2_assoc", type="int", default=8) 1112292SN/A parser.add_option("--l3_assoc", type="int", default=16) 1122292SN/A parser.add_option("--cacheline_size", type="int", default=64) 1132292SN/A 1142292SN/A # Enable Ruby 1152292SN/A parser.add_option("--ruby", action="store_true") 1162292SN/A 1172292SN/A # Run duration options 1182292SN/A parser.add_option("-m", "--abs-max-tick", type="int", default=m5.MaxTick, 1192292SN/A metavar="TICKS", help="Run to absolute simulated tick " 1202292SN/A "specified including ticks from a restored checkpoint") 1212292SN/A parser.add_option("--rel-max-tick", type="int", default=None, 1222292SN/A metavar="TICKS", help="Simulate for specified number of" 1232292SN/A " ticks relative to the simulation start tick (e.g. if " 1242292SN/A "restoring a checkpoint)") 1252292SN/A parser.add_option("--maxtime", type="float", default=None, 1262292SN/A help="Run to the specified absolute simulated time in " 1272292SN/A "seconds") 1282292SN/A 1292292SN/A# Add common options that assume a non-NULL ISA. 1302292SN/Adef addCommonOptions(parser): 1312292SN/A # start by adding the base options that do not assume an ISA 1322292SN/A addNoISAOptions(parser) 1332292SN/A 1342292SN/A # system options 1352292SN/A parser.add_option("--list-cpu-types", 1362292SN/A action="callback", callback=_listCpuTypes, 1372292SN/A help="List available CPU types") 1382292SN/A parser.add_option("--cpu-type", type="choice", default="AtomicSimpleCPU", 1392292SN/A choices=CpuConfig.cpu_names(), 1402292SN/A help = "type of cpu to run with") 1412292SN/A parser.add_option("--checker", action="store_true"); 1422292SN/A parser.add_option("--cpu-clock", action="store", type="string", 1432292SN/A default='2GHz', 1442292SN/A help="Clock for blocks running at CPU speed") 1452292SN/A parser.add_option("--smt", action="store_true", default=False, 1462292SN/A help = """ 1472292SN/A Only used if multiple programs are specified. If true, 1482292SN/A then the number of threads per cpu is same as the 1492292SN/A number of programs.""") 1502292SN/A parser.add_option("--elastic-trace-en", action="store_true", 1512292SN/A help="""Enable capture of data dependency and instruction 1522292SN/A fetch traces using elastic trace probe.""") 1532292SN/A # Trace file paths input to trace probe in a capture simulation and input 1542292SN/A # to Trace CPU in a replay simulation 1552292SN/A parser.add_option("--inst-trace-file", action="store", type="string", 1562292SN/A help="""Instruction fetch trace file input to 1572292SN/A Elastic Trace probe in a capture simulation and 1582907Sktlim@umich.edu Trace CPU in a replay simulation""", default="") 1592907Sktlim@umich.edu parser.add_option("--data-trace-file", action="store", type="string", 1602292SN/A help="""Data dependency trace file input to 1612292SN/A Elastic Trace probe in a capture simulation and 1622292SN/A Trace CPU in a replay simulation""", default="") 1632292SN/A 1642292SN/A parser.add_option("-l", "--lpae", action="store_true") 1652292SN/A parser.add_option("-V", "--virtualisation", action="store_true") 1662292SN/A 1672292SN/A parser.add_option("--fastmem", action="store_true") 1682292SN/A 1692292SN/A # dist-gem5 options 1702292SN/A parser.add_option("--dist", action="store_true", 1712292SN/A help="Parallel distributed gem5 simulation.") 1722292SN/A parser.add_option("--dist-sync-on-pseudo-op", action="store_true", 1732727Sktlim@umich.edu help="Use a pseudo-op to start dist-gem5 synchronization.") 1742727Sktlim@umich.edu parser.add_option("--is-switch", action="store_true", 1752727Sktlim@umich.edu help="Select the network switch simulator process for a"\ 1762727Sktlim@umich.edu "distributed gem5 run") 1772727Sktlim@umich.edu parser.add_option("--dist-rank", default=0, action="store", type="int", 1782727Sktlim@umich.edu help="Rank of this system within the dist gem5 run.") 1792727Sktlim@umich.edu parser.add_option("--dist-size", default=0, action="store", type="int", 1802727Sktlim@umich.edu help="Number of gem5 processes within the dist gem5 run.") 1812727Sktlim@umich.edu parser.add_option("--dist-server-name", 1822727Sktlim@umich.edu default="127.0.0.1", 1832980Sgblack@eecs.umich.edu action="store", type="string", 1842292SN/A help="Name of the message server host\nDEFAULT: localhost") 1852292SN/A parser.add_option("--dist-server-port", 1862292SN/A default=2200, 1872292SN/A action="store", type="int", 1882292SN/A help="Message server listen port\nDEFAULT: 2200") 1892292SN/A parser.add_option("--dist-sync-repeat", 1902292SN/A default="0us", 1912733Sktlim@umich.edu action="store", type="string", 1922292SN/A help="Repeat interval for synchronisation barriers among dist-gem5 processes\nDEFAULT: --ethernet-linkdelay") 1932292SN/A parser.add_option("--dist-sync-start", 1942292SN/A default="5200000000000t", 1952907Sktlim@umich.edu action="store", type="string", 1962907Sktlim@umich.edu help="Time to schedule the first dist synchronisation barrier\nDEFAULT:5200000000000t") 1972292SN/A parser.add_option("--ethernet-linkspeed", default="10Gbps", 1982292SN/A action="store", type="string", 1992292SN/A help="Link speed in bps\nDEFAULT: 10Gbps") 2002292SN/A parser.add_option("--ethernet-linkdelay", default="10us", 2012292SN/A action="store", type="string", 2022292SN/A help="Link delay in seconds\nDEFAULT: 10us") 2032292SN/A 2042292SN/A # Run duration options 2052292SN/A parser.add_option("-I", "--maxinsts", action="store", type="int", 2062292SN/A default=None, help="""Total number of instructions to 2072292SN/A simulate (default: run forever)""") 2082292SN/A parser.add_option("--work-item-id", action="store", type="int", 2092292SN/A help="the specific work id for exit & checkpointing") 2102292SN/A parser.add_option("--num-work-ids", action="store", type="int", 2112292SN/A help="Number of distinct work item types") 2122292SN/A parser.add_option("--work-begin-cpu-id-exit", action="store", type="int", 2132292SN/A help="exit when work starts on the specified cpu") 2142307SN/A parser.add_option("--work-end-exit-count", action="store", type="int", 2152307SN/A help="exit at specified work end count") 2162307SN/A parser.add_option("--work-begin-exit-count", action="store", type="int", 2172307SN/A help="exit at specified work begin count") 2182307SN/A parser.add_option("--init-param", action="store", type="int", default=0, 2192307SN/A help="""Parameter available in simulation with m5 2202307SN/A initparam""") 2212307SN/A parser.add_option("--initialize-only", action="store_true", default=False, 2222307SN/A help="""Exit after initialization. Do not simulate time. 2232307SN/A Useful when gem5 is run as a library.""") 2242307SN/A 2252307SN/A # Simpoint options 2262307SN/A parser.add_option("--simpoint-profile", action="store_true", 2272307SN/A help="Enable basic block profiling for SimPoints") 2282307SN/A parser.add_option("--simpoint-interval", type="int", default=10000000, 2292307SN/A help="SimPoint interval in num of instructions") 2302307SN/A parser.add_option("--take-simpoint-checkpoints", action="store", type="string", 2312307SN/A help="<simpoint file,weight file,interval-length,warmup-length>") 2322292SN/A parser.add_option("--restore-simpoint-checkpoint", action="store_true", 2332292SN/A help="restore from a simpoint checkpoint taken with " + 2342292SN/A "--take-simpoint-checkpoints") 2352292SN/A 2362292SN/A # Checkpointing options 2372292SN/A ###Note that performing checkpointing via python script files will override 2382292SN/A ###checkpoint instructions built into binaries. 2392292SN/A parser.add_option("--take-checkpoints", action="store", type="string", 2402292SN/A help="<M,N> take checkpoints at tick M and every N ticks thereafter") 2412292SN/A parser.add_option("--max-checkpoints", action="store", type="int", 2422292SN/A help="the maximum number of checkpoints to drop", default=5) 2432292SN/A parser.add_option("--checkpoint-dir", action="store", type="string", 2442292SN/A help="Place all checkpoints in this absolute directory") 2452292SN/A parser.add_option("-r", "--checkpoint-restore", action="store", type="int", 2462292SN/A help="restore from checkpoint <N>") 2473867Sbinkertn@umich.edu parser.add_option("--checkpoint-at-end", action="store_true", 2482292SN/A help="take a checkpoint at end of run") 2492292SN/A parser.add_option("--work-begin-checkpoint-count", action="store", type="int", 2502292SN/A help="checkpoint at specified work begin count") 2512292SN/A parser.add_option("--work-end-checkpoint-count", action="store", type="int", 2522292SN/A help="checkpoint at specified work end count") 2532292SN/A parser.add_option("--work-cpus-checkpoint-count", action="store", type="int", 2542292SN/A help="checkpoint and exit when active cpu count is reached") 2552292SN/A parser.add_option("--restore-with-cpu", action="store", type="choice", 2562292SN/A default="AtomicSimpleCPU", choices=CpuConfig.cpu_names(), 2572292SN/A help = "cpu type for restoring from a checkpoint") 2582292SN/A 2593867Sbinkertn@umich.edu 2603867Sbinkertn@umich.edu # CPU Switching - default switch model goes from a checkpoint 2613867Sbinkertn@umich.edu # to a timing simple CPU with caches to warm up, then to detailed CPU for 2623867Sbinkertn@umich.edu # data measurement 2633867Sbinkertn@umich.edu parser.add_option("--repeat-switch", action="store", type="int", 2643867Sbinkertn@umich.edu default=None, 2653867Sbinkertn@umich.edu help="switch back and forth between CPUs with period <N>") 2662292SN/A parser.add_option("-s", "--standard-switch", action="store", type="int", 2672292SN/A default=None, 2682292SN/A help="switch from timing to Detailed CPU after warmup period of <N>") 2692292SN/A parser.add_option("-p", "--prog-interval", type="str", 2702292SN/A help="CPU Progress Interval") 2712292SN/A 2722292SN/A # Fastforwarding and simpoint related materials 2732292SN/A parser.add_option("-W", "--warmup-insts", action="store", type="int", 2742292SN/A default=None, 2752292SN/A help="Warmup period in total instructions (requires --standard-switch)") 2762292SN/A parser.add_option("--bench", action="store", type="string", default=None, 2772292SN/A help="base names for --take-checkpoint and --checkpoint-restore") 2782292SN/A parser.add_option("-F", "--fast-forward", action="store", type="string", 2792292SN/A default=None, 2802292SN/A help="Number of instructions to fast forward before switching") 2812292SN/A parser.add_option("-S", "--simpoint", action="store_true", default=False, 2822292SN/A help="""Use workload simpoints as an instruction offset for 2832292SN/A --checkpoint-restore or --take-checkpoint.""") 2842292SN/A parser.add_option("--at-instruction", action="store_true", default=False, 2852292SN/A help="""Treat value of --checkpoint-restore or --take-checkpoint as a 2862292SN/A number of instructions.""") 2872292SN/A parser.add_option("--spec-input", default="ref", type="choice", 2882292SN/A choices=["ref", "test", "train", "smred", "mdred", 2892292SN/A "lgred"], 2903867Sbinkertn@umich.edu help="Input set size for SPEC CPU2000 benchmarks.") 2913867Sbinkertn@umich.edu parser.add_option("--arm-iset", default="arm", type="choice", 2922292SN/A choices=["arm", "thumb", "aarch64"], 2933867Sbinkertn@umich.edu help="ARM instruction set.") 2943867Sbinkertn@umich.edu 2952292SN/A 2962292SN/Adef addSEOptions(parser): 2972292SN/A # Benchmark options 2982292SN/A parser.add_option("-c", "--cmd", default="", 2992292SN/A help="The binary to run in syscall emulation mode.") 3002292SN/A parser.add_option("-o", "--options", default="", 3012292SN/A help="""The options to pass to the binary, use " " 3022292SN/A around the entire string""") 3032292SN/A parser.add_option("-e", "--env", default="", 3042292SN/A help="Initialize workload environment from text file.") 3052292SN/A parser.add_option("-i", "--input", default="", 3062292SN/A help="Read stdin from a file.") 3072292SN/A parser.add_option("--output", default="", 3082292SN/A help="Redirect stdout to a file.") 3092292SN/A parser.add_option("--errout", default="", 3102292SN/A help="Redirect stderr to a file.") 3112292SN/A 3122292SN/Adef addFSOptions(parser): 3132292SN/A from FSConfig import os_types 3142292SN/A 3152292SN/A # Simulation options 3162292SN/A parser.add_option("--timesync", action="store_true", 3172292SN/A help="Prevent simulated time from getting ahead of real time") 3182292SN/A 3192292SN/A # System options 3202292SN/A parser.add_option("--kernel", action="store", type="string") 3212292SN/A parser.add_option("--os-type", action="store", type="choice", 3222292SN/A choices=os_types[buildEnv['TARGET_ISA']], default="linux", 3232292SN/A help="Specifies type of OS to boot") 3242292SN/A parser.add_option("--script", action="store", type="string") 3252292SN/A parser.add_option("--frame-capture", action="store_true", 3262292SN/A help="Stores changed frame buffers from the VNC server to compressed "\ 3272292SN/A "files in the gem5 output directory") 3282292SN/A 3292292SN/A if buildEnv['TARGET_ISA'] == "arm": 3302292SN/A parser.add_option("--bare-metal", action="store_true", 3312292SN/A help="Provide the raw system without the linux specific bits") 3322292SN/A parser.add_option("--list-machine-types", 3332292SN/A action="callback", callback=_listPlatformTypes, 3342292SN/A help="List available platform types") 3352292SN/A parser.add_option("--machine-type", action="store", type="choice", 3362292SN/A choices=PlatformConfig.platform_names(), 3372292SN/A default="VExpress_EMM") 3382292SN/A parser.add_option("--dtb-filename", action="store", type="string", 3392292SN/A help="Specifies device tree blob file to use with device-tree-"\ 3403867Sbinkertn@umich.edu "enabled kernels") 3413867Sbinkertn@umich.edu parser.add_option("--enable-context-switch-stats-dump", \ 3422292SN/A action="store_true", help="Enable stats dump at context "\ 3433867Sbinkertn@umich.edu "switches and dump tasks file (required for Streamline)") 3443867Sbinkertn@umich.edu 3452292SN/A # Benchmark options 3462292SN/A parser.add_option("--dual", action="store_true", 3472329SN/A help="Simulate two systems attached with an ethernet link") 3482329SN/A parser.add_option("-b", "--benchmark", action="store", type="string", 3492292SN/A dest="benchmark", 3502292SN/A help="Specify the benchmark to run. Available benchmarks: %s"\ 3512292SN/A % DefinedBenchmarks) 3522292SN/A 3532292SN/A # Metafile options 3542292SN/A parser.add_option("--etherdump", action="store", type="string", dest="etherdump", 3552292SN/A help="Specify the filename to dump a pcap capture of the" \ 3562292SN/A "ethernet traffic") 3572292SN/A 3582292SN/A # Disk Image Options 3592292SN/A parser.add_option("--disk-image", action="store", type="string", default=None, 3603867Sbinkertn@umich.edu help="Path to the disk image to use.") 3613867Sbinkertn@umich.edu parser.add_option("--root-device", action="store", type="string", default=None, 3622292SN/A help="OS device name for root partition") 3633867Sbinkertn@umich.edu 3643867Sbinkertn@umich.edu # Command line options 3653867Sbinkertn@umich.edu parser.add_option("--command-line", action="store", type="string", 3662292SN/A default=None, 3672292SN/A help="Template for the kernel command line.") 3682292SN/A parser.add_option("--command-line-file", action="store", 3692292SN/A default=None, type="string", 3702292SN/A help="File with a template for the kernel command line") 3712292SN/A