Options.py revision 9791:39c75548bcd4
17927SN/A# Copyright (c) 2013 ARM Limited 27927SN/A# All rights reserved. 37927SN/A# 410036SAli.Saidi@ARM.com# The license below extends only to copyright in the software and shall 58835SAli.Saidi@ARM.com# not be construed as granting a license to any other intellectual 610036SAli.Saidi@ARM.com# property including but not limited to intellectual property relating 77927SN/A# to a hardware implementation of the functionality of the software 87927SN/A# licensed hereunder. You may use the software subject to the license 97927SN/A# terms below provided that you ensure that this notice is replicated 107927SN/A# unmodified and in its entirety in all distributions of the software, 117927SN/A# modified or unmodified, in source code or in binary form. 127927SN/A# 1310315Snilay@cs.wisc.edu# Copyright (c) 2006-2008 The Regents of The University of Michigan 147927SN/A# All rights reserved. 157927SN/A# 169885Sstever@gmail.com# Redistribution and use in source and binary forms, with or without 179885Sstever@gmail.com# modification, are permitted provided that the following conditions are 187927SN/A# met: redistributions of source code must retain the above copyright 1910036SAli.Saidi@ARM.com# notice, this list of conditions and the following disclaimer; 207927SN/A# redistributions in binary form must reproduce the above copyright 217927SN/A# notice, this list of conditions and the following disclaimer in the 227927SN/A# documentation and/or other materials provided with the distribution; 2310736Snilay@cs.wisc.edu# neither the name of the copyright holders nor the names of its 2410315Snilay@cs.wisc.edu# contributors may be used to endorse or promote products derived from 257927SN/A# this software without specific prior written permission. 2610315Snilay@cs.wisc.edu# 277927SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 289474Snilay@cs.wisc.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 298673SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 3010736Snilay@cs.wisc.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 318673SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 3210736Snilay@cs.wisc.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 337927SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 347927SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 357927SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 367927SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 377927SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 387927SN/A# 397927SN/A# Authors: Lisa Hsu 407927SN/A 417927SN/Aimport m5 428983Snate@binkert.orgfrom m5.defines import buildEnv 437927SN/Afrom m5.objects import * 447927SN/Afrom Benchmarks import * 457927SN/A 467927SN/Aimport CpuConfig 4710036SAli.Saidi@ARM.comimport MemConfig 487927SN/A 497927SN/Adef _listCpuTypes(option, opt, value, parser): 507927SN/A CpuConfig.print_cpu_list() 517927SN/A sys.exit(0) 527927SN/A 537927SN/Adef _listMemTypes(option, opt, value, parser): 547927SN/A MemConfig.print_mem_list() 557927SN/A sys.exit(0) 567927SN/A 577927SN/Adef addCommonOptions(parser): 5810036SAli.Saidi@ARM.com # system options 597927SN/A parser.add_option("--list-cpu-types", 607927SN/A action="callback", callback=_listCpuTypes, 617927SN/A help="List available CPU types") 627927SN/A parser.add_option("--cpu-type", type="choice", default="atomic", 638835SAli.Saidi@ARM.com choices=CpuConfig.cpu_names(), 648835SAli.Saidi@ARM.com help = "type of cpu to run with") 659885Sstever@gmail.com parser.add_option("--list-mem-types", 668835SAli.Saidi@ARM.com action="callback", callback=_listMemTypes, 6710036SAli.Saidi@ARM.com help="List available memory types") 688835SAli.Saidi@ARM.com parser.add_option("--mem-type", type="choice", default="simple_mem", 698835SAli.Saidi@ARM.com choices=MemConfig.mem_names(), 708835SAli.Saidi@ARM.com help = "type of memory to use") 718983Snate@binkert.org parser.add_option("--checker", action="store_true"); 728983Snate@binkert.org parser.add_option("-n", "--num-cpus", type="int", default=1) 738835SAli.Saidi@ARM.com parser.add_option("--caches", action="store_true") 747927SN/A parser.add_option("--l2cache", action="store_true") 757927SN/A parser.add_option("--fastmem", action="store_true") 769885Sstever@gmail.com parser.add_option("--simpoint-profile", action="store_true", 777927SN/A help="Enable basic block profiling for SimPoints") 7810036SAli.Saidi@ARM.com parser.add_option("--simpoint-interval", type="int", default=10000000, 7910451Snilay@cs.wisc.edu help="SimPoint interval in num of instructions") 808721SN/A parser.add_option("--sys-clock", action="store", type="string", 818721SN/A default='1GHz', 828983Snate@binkert.org help = """Top-level clock for blocks running at system 839885Sstever@gmail.com speed""") 849885Sstever@gmail.com parser.add_option("--cpu-clock", action="store", type="string", 859885Sstever@gmail.com default='2GHz', 869885Sstever@gmail.com help="Clock for blocks running at CPU speed") 879885Sstever@gmail.com parser.add_option("--num-dirs", type="int", default=1) 8810315Snilay@cs.wisc.edu parser.add_option("--num-l2caches", type="int", default=1) 8910036SAli.Saidi@ARM.com parser.add_option("--num-l3caches", type="int", default=1) 9010315Snilay@cs.wisc.edu parser.add_option("--l1d_size", type="string", default="64kB") 919885Sstever@gmail.com parser.add_option("--l1i_size", type="string", default="32kB") 927927SN/A parser.add_option("--l2_size", type="string", default="2MB") 937927SN/A parser.add_option("--l3_size", type="string", default="16MB") 947927SN/A parser.add_option("--l1d_assoc", type="int", default=2) 959885Sstever@gmail.com parser.add_option("--l1i_assoc", type="int", default=2) 9610315Snilay@cs.wisc.edu parser.add_option("--l2_assoc", type="int", default=8) 977927SN/A parser.add_option("--l3_assoc", type="int", default=16) 989885Sstever@gmail.com parser.add_option("--cacheline_size", type="int", default=64) 997927SN/A parser.add_option("--ruby", action="store_true") 1007927SN/A parser.add_option("--smt", action="store_true", default=False, 1017927SN/A help = """ 1027927SN/A Only used if multiple programs are specified. If true, 1037927SN/A then the number of threads per cpu is same as the 10410036SAli.Saidi@ARM.com number of programs.""") 1057927SN/A 1067927SN/A # Run duration options 1077927SN/A parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick, 1089474Snilay@cs.wisc.edu metavar="T", help="Stop after T ticks") 1097927SN/A parser.add_option("--maxtime", type="float") 1107927SN/A parser.add_option("-I", "--maxinsts", action="store", type="int", 1117927SN/A default=None, help="""Total number of instructions to 1127927SN/A simulate (default: run forever)""") 1137927SN/A parser.add_option("--work-item-id", action="store", type="int", 1147927SN/A help="the specific work id for exit & checkpointing") 1157927SN/A parser.add_option("--work-begin-cpu-id-exit", action="store", type="int", 1167927SN/A help="exit when work starts on the specified cpu") 1179885Sstever@gmail.com parser.add_option("--work-end-exit-count", action="store", type="int", 11810315Snilay@cs.wisc.edu help="exit at specified work end count") 1199474Snilay@cs.wisc.edu parser.add_option("--work-begin-exit-count", action="store", type="int", 1207927SN/A help="exit at specified work begin count") 1217927SN/A parser.add_option("--init-param", action="store", type="int", default=0, 1228835SAli.Saidi@ARM.com help="""Parameter available in simulation with m5 1237927SN/A initparam""") 1247927SN/A 1257927SN/A # Checkpointing options 1269885Sstever@gmail.com ###Note that performing checkpointing via python script files will override 1279885Sstever@gmail.com ###checkpoint instructions built into binaries. 1289885Sstever@gmail.com parser.add_option("--take-checkpoints", action="store", type="string", 1299885Sstever@gmail.com help="<M,N> take checkpoints at tick M and every N ticks thereafter") 13010036SAli.Saidi@ARM.com parser.add_option("--max-checkpoints", action="store", type="int", 1319885Sstever@gmail.com help="the maximum number of checkpoints to drop", default=5) 1327927SN/A parser.add_option("--checkpoint-dir", action="store", type="string", 1337927SN/A help="Place all checkpoints in this absolute directory") 1349885Sstever@gmail.com parser.add_option("-r", "--checkpoint-restore", action="store", type="int", 1358983Snate@binkert.org help="restore from checkpoint <N>") 1367927SN/A parser.add_option("--checkpoint-at-end", action="store_true", 1379885Sstever@gmail.com help="take a checkpoint at end of run") 13810636Snilay@cs.wisc.edu parser.add_option("--work-begin-checkpoint-count", action="store", type="int", 13910036SAli.Saidi@ARM.com help="checkpoint at specified work begin count") 1407927SN/A parser.add_option("--work-end-checkpoint-count", action="store", type="int", 1419361Snilay@cs.wisc.edu help="checkpoint at specified work end count") 14210901Snilay@cs.wisc.edu parser.add_option("--work-cpus-checkpoint-count", action="store", type="int", 1437927SN/A help="checkpoint and exit when active cpu count is reached") 1447927SN/A parser.add_option("--restore-with-cpu", action="store", type="choice", 1457927SN/A default="atomic", choices=CpuConfig.cpu_names(), 1468835SAli.Saidi@ARM.com help = "cpu type for restoring from a checkpoint") 1479361Snilay@cs.wisc.edu 14810036SAli.Saidi@ARM.com 1497927SN/A # CPU Switching - default switch model goes from a checkpoint 1508835SAli.Saidi@ARM.com # to a timing simple CPU with caches to warm up, then to detailed CPU for 1519885Sstever@gmail.com # data measurement 1529361Snilay@cs.wisc.edu parser.add_option("--repeat-switch", action="store", type="int", 1537927SN/A default=None, 1547927SN/A help="switch back and forth between CPUs with period <N>") 1559361Snilay@cs.wisc.edu parser.add_option("-s", "--standard-switch", action="store", type="int", 1567927SN/A default=None, 1579885Sstever@gmail.com help="switch from timing to Detailed CPU after warmup period of <N>") 1589885Sstever@gmail.com parser.add_option("-p", "--prog-interval", type="str", 1599885Sstever@gmail.com help="CPU Progress Interval") 1609885Sstever@gmail.com 1619885Sstever@gmail.com # Fastforwarding and simpoint related materials 16210036SAli.Saidi@ARM.com parser.add_option("-W", "--warmup-insts", action="store", type="int", 1639885Sstever@gmail.com default=None, 16410036SAli.Saidi@ARM.com help="Warmup period in total instructions (requires --standard-switch)") 1659885Sstever@gmail.com parser.add_option("--bench", action="store", type="string", default=None, 1669885Sstever@gmail.com help="base names for --take-checkpoint and --checkpoint-restore") 1677927SN/A parser.add_option("-F", "--fast-forward", action="store", type="string", 1687927SN/A default=None, 1697927SN/A help="Number of instructions to fast forward before switching") 17010036SAli.Saidi@ARM.com parser.add_option("-S", "--simpoint", action="store_true", default=False, 1717927SN/A help="""Use workload simpoints as an instruction offset for 1727927SN/A --checkpoint-restore or --take-checkpoint.""") 1737927SN/A parser.add_option("--at-instruction", action="store_true", default=False, 1747927SN/A help="""Treat value of --checkpoint-restore or --take-checkpoint as a 1757927SN/A number of instructions.""") 1769885Sstever@gmail.com 17710036SAli.Saidi@ARM.comdef addSEOptions(parser): 1789885Sstever@gmail.com # Benchmark options 1797927SN/A parser.add_option("-c", "--cmd", default="", 1807927SN/A help="The binary to run in syscall emulation mode.") 1817927SN/A parser.add_option("-o", "--options", default="", 1827927SN/A help="""The options to pass to the binary, use " " 1837927SN/A around the entire string""") 1849885Sstever@gmail.com parser.add_option("-i", "--input", default="", 1858983Snate@binkert.org help="Read stdin from a file.") 1867927SN/A parser.add_option("--output", default="", 1879885Sstever@gmail.com help="Redirect stdout to a file.") 18810636Snilay@cs.wisc.edu parser.add_option("--errout", default="", 18910036SAli.Saidi@ARM.com help="Redirect stderr to a file.") 19010901Snilay@cs.wisc.edu 1919361Snilay@cs.wisc.edudef addFSOptions(parser): 19210901Snilay@cs.wisc.edu # Simulation options 1937927SN/A parser.add_option("--timesync", action="store_true", 1947927SN/A help="Prevent simulated time from getting ahead of real time") 1957927SN/A 1968835SAli.Saidi@ARM.com # System options 1979361Snilay@cs.wisc.edu parser.add_option("--kernel", action="store", type="string") 19810036SAli.Saidi@ARM.com parser.add_option("--script", action="store", type="string") 1997927SN/A parser.add_option("--frame-capture", action="store_true", 2008835SAli.Saidi@ARM.com help="Stores changed frame buffers from the VNC server to compressed "\ 2019885Sstever@gmail.com "files in the gem5 output directory") 2027927SN/A 2037927SN/A if buildEnv['TARGET_ISA'] == "arm": 2047927SN/A parser.add_option("--bare-metal", action="store_true", 2059361Snilay@cs.wisc.edu help="Provide the raw system without the linux specific bits") 2067927SN/A parser.add_option("--machine-type", action="store", type="choice", 2079885Sstever@gmail.com choices=ArmMachineType.map.keys(), default="RealView_PBX") 2089885Sstever@gmail.com parser.add_option("--dtb-filename", action="store", type="string", 2099885Sstever@gmail.com help="Specifies device tree blob file to use with device-tree-"\ 2109885Sstever@gmail.com "enabled kernels") 2119885Sstever@gmail.com # Benchmark options 21210036SAli.Saidi@ARM.com parser.add_option("--dual", action="store_true", 2139885Sstever@gmail.com help="Simulate two systems attached with an ethernet link") 21410036SAli.Saidi@ARM.com parser.add_option("-b", "--benchmark", action="store", type="string", 2159885Sstever@gmail.com dest="benchmark", 2169885Sstever@gmail.com help="Specify the benchmark to run. Available benchmarks: %s"\ 2177927SN/A % DefinedBenchmarks) 2187927SN/A 2199885Sstever@gmail.com # Metafile options 2208983Snate@binkert.org parser.add_option("--etherdump", action="store", type="string", dest="etherdump", 2217927SN/A help="Specify the filename to dump a pcap capture of the" \ 2229885Sstever@gmail.com "ethernet traffic") 22310636Snilay@cs.wisc.edu 22410036SAli.Saidi@ARM.com # Disk Image Options 2257927SN/A parser.add_option("--disk-image", action="store", type="string", default=None, 2269361Snilay@cs.wisc.edu help="Path to the disk image to use.") 22710901Snilay@cs.wisc.edu 2287927SN/A # Memory Size Options 2297927SN/A parser.add_option("--mem-size", action="store", type="string", default=None, 2307927SN/A help="Specify the physical memory size (single memory)") 2318835SAli.Saidi@ARM.com