Options.py revision 9789:233420718e61
17639Sgblack@eecs.umich.edu# Copyright (c) 2013 ARM Limited 27639Sgblack@eecs.umich.edu# All rights reserved. 311513Sandreas.sandberg@arm.com# 47639Sgblack@eecs.umich.edu# The license below extends only to copyright in the software and shall 57639Sgblack@eecs.umich.edu# not be construed as granting a license to any other intellectual 67639Sgblack@eecs.umich.edu# property including but not limited to intellectual property relating 77639Sgblack@eecs.umich.edu# to a hardware implementation of the functionality of the software 87639Sgblack@eecs.umich.edu# licensed hereunder. You may use the software subject to the license 97639Sgblack@eecs.umich.edu# terms below provided that you ensure that this notice is replicated 107639Sgblack@eecs.umich.edu# unmodified and in its entirety in all distributions of the software, 117639Sgblack@eecs.umich.edu# modified or unmodified, in source code or in binary form. 127639Sgblack@eecs.umich.edu# 137639Sgblack@eecs.umich.edu# Copyright (c) 2006-2008 The Regents of The University of Michigan 147639Sgblack@eecs.umich.edu# All rights reserved. 157639Sgblack@eecs.umich.edu# 167639Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 177639Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 187639Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 197639Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 207639Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 217639Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 227639Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 237639Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 247639Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from 257639Sgblack@eecs.umich.edu# this software without specific prior written permission. 267639Sgblack@eecs.umich.edu# 277639Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 287639Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 297639Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 307639Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 317639Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 327639Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 337639Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 347639Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 357639Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 367639Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 377639Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 387639Sgblack@eecs.umich.edu# 397639Sgblack@eecs.umich.edu# Authors: Lisa Hsu 407644Sali.saidi@arm.com 417644Sali.saidi@arm.comimport m5 4210037SARM gem5 Developersfrom m5.defines import buildEnv 4311513Sandreas.sandberg@arm.comfrom m5.objects import * 4411513Sandreas.sandberg@arm.comfrom Benchmarks import * 4511513Sandreas.sandberg@arm.com 4611513Sandreas.sandberg@arm.comimport CpuConfig 4711513Sandreas.sandberg@arm.comimport MemConfig 4810037SARM gem5 Developers 497644Sali.saidi@arm.comdef _listCpuTypes(option, opt, value, parser): 507644Sali.saidi@arm.com CpuConfig.print_cpu_list() 517644Sali.saidi@arm.com sys.exit(0) 527644Sali.saidi@arm.com 537639Sgblack@eecs.umich.edudef _listMemTypes(option, opt, value, parser): 547639Sgblack@eecs.umich.edu MemConfig.print_mem_list() 557639Sgblack@eecs.umich.edu sys.exit(0) 567639Sgblack@eecs.umich.edu 577639Sgblack@eecs.umich.edudef addCommonOptions(parser): 587639Sgblack@eecs.umich.edu # system options 597639Sgblack@eecs.umich.edu parser.add_option("--list-cpu-types", 607639Sgblack@eecs.umich.edu action="callback", callback=_listCpuTypes, 617639Sgblack@eecs.umich.edu help="List available CPU types") 627639Sgblack@eecs.umich.edu parser.add_option("--cpu-type", type="choice", default="atomic", 637639Sgblack@eecs.umich.edu choices=CpuConfig.cpu_names(), 647639Sgblack@eecs.umich.edu help = "type of cpu to run with") 657639Sgblack@eecs.umich.edu parser.add_option("--list-mem-types", 667639Sgblack@eecs.umich.edu action="callback", callback=_listMemTypes, 677848SAli.Saidi@ARM.com help="List available memory types") 687848SAli.Saidi@ARM.com parser.add_option("--mem-type", type="choice", default="simple_mem", 697848SAli.Saidi@ARM.com choices=MemConfig.mem_names(), 707848SAli.Saidi@ARM.com help = "type of memory to use") 717848SAli.Saidi@ARM.com parser.add_option("--checker", action="store_true"); 727639Sgblack@eecs.umich.edu parser.add_option("-n", "--num-cpus", type="int", default=1) 737639Sgblack@eecs.umich.edu parser.add_option("--caches", action="store_true") 7412616Sgabeblack@google.com parser.add_option("--l2cache", action="store_true") 757639Sgblack@eecs.umich.edu parser.add_option("--fastmem", action="store_true") 767639Sgblack@eecs.umich.edu parser.add_option("--simpoint-profile", action="store_true", 777639Sgblack@eecs.umich.edu help="Enable basic block profiling for SimPoints") 787639Sgblack@eecs.umich.edu parser.add_option("--simpoint-interval", type="int", default=10000000, 797639Sgblack@eecs.umich.edu help="SimPoint interval in num of instructions") 807639Sgblack@eecs.umich.edu parser.add_option("--clock", action="store", type="string", default='2GHz') 817639Sgblack@eecs.umich.edu parser.add_option("--cpu-clock", action="store", type="string", 827639Sgblack@eecs.umich.edu default='2GHz', 837639Sgblack@eecs.umich.edu help="Clock for blocks running at CPU speed") 847639Sgblack@eecs.umich.edu parser.add_option("--num-dirs", type="int", default=1) 857639Sgblack@eecs.umich.edu parser.add_option("--num-l2caches", type="int", default=1) 867639Sgblack@eecs.umich.edu parser.add_option("--num-l3caches", type="int", default=1) 877639Sgblack@eecs.umich.edu parser.add_option("--l1d_size", type="string", default="64kB") 887639Sgblack@eecs.umich.edu parser.add_option("--l1i_size", type="string", default="32kB") 897639Sgblack@eecs.umich.edu parser.add_option("--l2_size", type="string", default="2MB") 907639Sgblack@eecs.umich.edu parser.add_option("--l3_size", type="string", default="16MB") 917639Sgblack@eecs.umich.edu parser.add_option("--l1d_assoc", type="int", default=2) 927639Sgblack@eecs.umich.edu parser.add_option("--l1i_assoc", type="int", default=2) 937848SAli.Saidi@ARM.com parser.add_option("--l2_assoc", type="int", default=8) 947848SAli.Saidi@ARM.com parser.add_option("--l3_assoc", type="int", default=16) 957848SAli.Saidi@ARM.com parser.add_option("--cacheline_size", type="int", default=64) 967848SAli.Saidi@ARM.com parser.add_option("--ruby", action="store_true") 977848SAli.Saidi@ARM.com parser.add_option("--smt", action="store_true", default=False, 987639Sgblack@eecs.umich.edu help = """ 997639Sgblack@eecs.umich.edu Only used if multiple programs are specified. If true, 10012616Sgabeblack@google.com then the number of threads per cpu is same as the 1017639Sgblack@eecs.umich.edu number of programs.""") 1027639Sgblack@eecs.umich.edu 1037639Sgblack@eecs.umich.edu # Run duration options 1047639Sgblack@eecs.umich.edu parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick, 1057639Sgblack@eecs.umich.edu metavar="T", help="Stop after T ticks") 1067639Sgblack@eecs.umich.edu parser.add_option("--maxtime", type="float") 1077639Sgblack@eecs.umich.edu parser.add_option("-I", "--maxinsts", action="store", type="int", 1087639Sgblack@eecs.umich.edu default=None, help="""Total number of instructions to 1097639Sgblack@eecs.umich.edu simulate (default: run forever)""") 1107639Sgblack@eecs.umich.edu parser.add_option("--work-item-id", action="store", type="int", 1117639Sgblack@eecs.umich.edu help="the specific work id for exit & checkpointing") 1127639Sgblack@eecs.umich.edu parser.add_option("--work-begin-cpu-id-exit", action="store", type="int", 1137639Sgblack@eecs.umich.edu help="exit when work starts on the specified cpu") 1147639Sgblack@eecs.umich.edu parser.add_option("--work-end-exit-count", action="store", type="int", 1157639Sgblack@eecs.umich.edu help="exit at specified work end count") 1167639Sgblack@eecs.umich.edu parser.add_option("--work-begin-exit-count", action="store", type="int", 1177639Sgblack@eecs.umich.edu help="exit at specified work begin count") 1187848SAli.Saidi@ARM.com parser.add_option("--init-param", action="store", type="int", default=0, 1197848SAli.Saidi@ARM.com help="""Parameter available in simulation with m5 1207848SAli.Saidi@ARM.com initparam""") 1217848SAli.Saidi@ARM.com 1227848SAli.Saidi@ARM.com # Checkpointing options 1237639Sgblack@eecs.umich.edu ###Note that performing checkpointing via python script files will override 1247639Sgblack@eecs.umich.edu ###checkpoint instructions built into binaries. 12512616Sgabeblack@google.com parser.add_option("--take-checkpoints", action="store", type="string", 1267639Sgblack@eecs.umich.edu help="<M,N> take checkpoints at tick M and every N ticks thereafter") 1277639Sgblack@eecs.umich.edu parser.add_option("--max-checkpoints", action="store", type="int", 1287639Sgblack@eecs.umich.edu help="the maximum number of checkpoints to drop", default=5) 1297639Sgblack@eecs.umich.edu parser.add_option("--checkpoint-dir", action="store", type="string", 1307639Sgblack@eecs.umich.edu help="Place all checkpoints in this absolute directory") 1317639Sgblack@eecs.umich.edu parser.add_option("-r", "--checkpoint-restore", action="store", type="int", 1327639Sgblack@eecs.umich.edu help="restore from checkpoint <N>") 1337639Sgblack@eecs.umich.edu parser.add_option("--checkpoint-at-end", action="store_true", 1347639Sgblack@eecs.umich.edu help="take a checkpoint at end of run") 1357639Sgblack@eecs.umich.edu parser.add_option("--work-begin-checkpoint-count", action="store", type="int", 1367639Sgblack@eecs.umich.edu help="checkpoint at specified work begin count") 1377639Sgblack@eecs.umich.edu parser.add_option("--work-end-checkpoint-count", action="store", type="int", 1387639Sgblack@eecs.umich.edu help="checkpoint at specified work end count") 1397639Sgblack@eecs.umich.edu parser.add_option("--work-cpus-checkpoint-count", action="store", type="int", 1407639Sgblack@eecs.umich.edu help="checkpoint and exit when active cpu count is reached") 1417848SAli.Saidi@ARM.com parser.add_option("--restore-with-cpu", action="store", type="choice", 1427848SAli.Saidi@ARM.com default="atomic", choices=CpuConfig.cpu_names(), 1437848SAli.Saidi@ARM.com help = "cpu type for restoring from a checkpoint") 1447848SAli.Saidi@ARM.com 1457848SAli.Saidi@ARM.com 1467639Sgblack@eecs.umich.edu # CPU Switching - default switch model goes from a checkpoint 1477639Sgblack@eecs.umich.edu # to a timing simple CPU with caches to warm up, then to detailed CPU for 14812616Sgabeblack@google.com # data measurement 1497639Sgblack@eecs.umich.edu parser.add_option("--repeat-switch", action="store", type="int", 1507639Sgblack@eecs.umich.edu default=None, 1517639Sgblack@eecs.umich.edu help="switch back and forth between CPUs with period <N>") 1527639Sgblack@eecs.umich.edu parser.add_option("-s", "--standard-switch", action="store", type="int", 1537639Sgblack@eecs.umich.edu default=None, 1547639Sgblack@eecs.umich.edu help="switch from timing to Detailed CPU after warmup period of <N>") 1557639Sgblack@eecs.umich.edu parser.add_option("-p", "--prog-interval", type="str", 1567639Sgblack@eecs.umich.edu help="CPU Progress Interval") 1577639Sgblack@eecs.umich.edu 1587639Sgblack@eecs.umich.edu # Fastforwarding and simpoint related materials 1597639Sgblack@eecs.umich.edu parser.add_option("-W", "--warmup-insts", action="store", type="int", 1607639Sgblack@eecs.umich.edu default=None, 1617639Sgblack@eecs.umich.edu help="Warmup period in total instructions (requires --standard-switch)") 1627639Sgblack@eecs.umich.edu parser.add_option("--bench", action="store", type="string", default=None, 1637639Sgblack@eecs.umich.edu help="base names for --take-checkpoint and --checkpoint-restore") 1647639Sgblack@eecs.umich.edu parser.add_option("-F", "--fast-forward", action="store", type="string", 1657639Sgblack@eecs.umich.edu default=None, 1667848SAli.Saidi@ARM.com help="Number of instructions to fast forward before switching") 1677848SAli.Saidi@ARM.com parser.add_option("-S", "--simpoint", action="store_true", default=False, 1687848SAli.Saidi@ARM.com help="""Use workload simpoints as an instruction offset for 1697848SAli.Saidi@ARM.com --checkpoint-restore or --take-checkpoint.""") 1707848SAli.Saidi@ARM.com parser.add_option("--at-instruction", action="store_true", default=False, 1717639Sgblack@eecs.umich.edu help="""Treat value of --checkpoint-restore or --take-checkpoint as a 1727639Sgblack@eecs.umich.edu number of instructions.""") 17312616Sgabeblack@google.com 1747639Sgblack@eecs.umich.edudef addSEOptions(parser): 1757639Sgblack@eecs.umich.edu # Benchmark options 1767639Sgblack@eecs.umich.edu parser.add_option("-c", "--cmd", default="", 1777639Sgblack@eecs.umich.edu help="The binary to run in syscall emulation mode.") 1787639Sgblack@eecs.umich.edu parser.add_option("-o", "--options", default="", 1797639Sgblack@eecs.umich.edu help="""The options to pass to the binary, use " " 18012234Sgabeblack@google.com around the entire string""") 1817639Sgblack@eecs.umich.edu parser.add_option("-i", "--input", default="", 1827639Sgblack@eecs.umich.edu help="Read stdin from a file.") 1837641Sgblack@eecs.umich.edu parser.add_option("--output", default="", 1847641Sgblack@eecs.umich.edu help="Redirect stdout to a file.") 1857641Sgblack@eecs.umich.edu parser.add_option("--errout", default="", 1867641Sgblack@eecs.umich.edu help="Redirect stderr to a file.") 1877641Sgblack@eecs.umich.edu 1887641Sgblack@eecs.umich.edudef addFSOptions(parser): 1897641Sgblack@eecs.umich.edu # Simulation options 1907641Sgblack@eecs.umich.edu parser.add_option("--timesync", action="store_true", 1917641Sgblack@eecs.umich.edu help="Prevent simulated time from getting ahead of real time") 1927641Sgblack@eecs.umich.edu 1937641Sgblack@eecs.umich.edu # System options 1947641Sgblack@eecs.umich.edu parser.add_option("--kernel", action="store", type="string") 1957641Sgblack@eecs.umich.edu parser.add_option("--script", action="store", type="string") 1967641Sgblack@eecs.umich.edu parser.add_option("--frame-capture", action="store_true", 1977641Sgblack@eecs.umich.edu help="Stores changed frame buffers from the VNC server to compressed "\ 1987641Sgblack@eecs.umich.edu "files in the gem5 output directory") 1997641Sgblack@eecs.umich.edu 2007641Sgblack@eecs.umich.edu if buildEnv['TARGET_ISA'] == "arm": 2017641Sgblack@eecs.umich.edu parser.add_option("--bare-metal", action="store_true", 2027641Sgblack@eecs.umich.edu help="Provide the raw system without the linux specific bits") 2037641Sgblack@eecs.umich.edu parser.add_option("--machine-type", action="store", type="choice", 2047641Sgblack@eecs.umich.edu choices=ArmMachineType.map.keys(), default="RealView_PBX") 2057641Sgblack@eecs.umich.edu parser.add_option("--dtb-filename", action="store", type="string", 2067641Sgblack@eecs.umich.edu help="Specifies device tree blob file to use with device-tree-"\ 2077641Sgblack@eecs.umich.edu "enabled kernels") 2087641Sgblack@eecs.umich.edu # Benchmark options 2097639Sgblack@eecs.umich.edu parser.add_option("--dual", action="store_true", 2107639Sgblack@eecs.umich.edu help="Simulate two systems attached with an ethernet link") 21112234Sgabeblack@google.com parser.add_option("-b", "--benchmark", action="store", type="string", 2127639Sgblack@eecs.umich.edu dest="benchmark", 2137639Sgblack@eecs.umich.edu help="Specify the benchmark to run. Available benchmarks: %s"\ 2147639Sgblack@eecs.umich.edu % DefinedBenchmarks) 2157639Sgblack@eecs.umich.edu 2167639Sgblack@eecs.umich.edu # Metafile options 2177639Sgblack@eecs.umich.edu parser.add_option("--etherdump", action="store", type="string", dest="etherdump", 2187639Sgblack@eecs.umich.edu help="Specify the filename to dump a pcap capture of the" \ 2197639Sgblack@eecs.umich.edu "ethernet traffic") 2207639Sgblack@eecs.umich.edu 2217639Sgblack@eecs.umich.edu # Disk Image Options 2227639Sgblack@eecs.umich.edu parser.add_option("--disk-image", action="store", type="string", default=None, 2237639Sgblack@eecs.umich.edu help="Path to the disk image to use.") 2247639Sgblack@eecs.umich.edu 2257639Sgblack@eecs.umich.edu # Memory Size Options 2267639Sgblack@eecs.umich.edu parser.add_option("--mem-size", action="store", type="string", default=None, 2277639Sgblack@eecs.umich.edu help="Specify the physical memory size (single memory)") 2287639Sgblack@eecs.umich.edu