Options.py revision 10697
111598Sandreas.sandberg@arm.com# Copyright (c) 2013 ARM Limited
27586SAli.Saidi@arm.com# All rights reserved.
37586SAli.Saidi@arm.com#
47586SAli.Saidi@arm.com# The license below extends only to copyright in the software and shall
57586SAli.Saidi@arm.com# not be construed as granting a license to any other intellectual
67586SAli.Saidi@arm.com# property including but not limited to intellectual property relating
77586SAli.Saidi@arm.com# to a hardware implementation of the functionality of the software
87586SAli.Saidi@arm.com# licensed hereunder.  You may use the software subject to the license
97586SAli.Saidi@arm.com# terms below provided that you ensure that this notice is replicated
107586SAli.Saidi@arm.com# unmodified and in its entirety in all distributions of the software,
117586SAli.Saidi@arm.com# modified or unmodified, in source code or in binary form.
127586SAli.Saidi@arm.com#
1310118Snilay@cs.wisc.edu# Copyright (c) 2006-2008 The Regents of The University of Michigan
1410118Snilay@cs.wisc.edu# All rights reserved.
153970Sgblack@eecs.umich.edu#
163005Sstever@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
173005Sstever@eecs.umich.edu# modification, are permitted provided that the following conditions are
183005Sstever@eecs.umich.edu# met: redistributions of source code must retain the above copyright
193005Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
203005Sstever@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
213005Sstever@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
223005Sstever@eecs.umich.edu# documentation and/or other materials provided with the distribution;
233005Sstever@eecs.umich.edu# neither the name of the copyright holders nor the names of its
243005Sstever@eecs.umich.edu# contributors may be used to endorse or promote products derived from
253005Sstever@eecs.umich.edu# this software without specific prior written permission.
263005Sstever@eecs.umich.edu#
273005Sstever@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
283005Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
293005Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
303005Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
313005Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
323005Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
333005Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
343005Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
353005Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
363005Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
373005Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
383005Sstever@eecs.umich.edu#
393005Sstever@eecs.umich.edu# Authors: Lisa Hsu
403005Sstever@eecs.umich.edu
413005Sstever@eecs.umich.eduimport m5
4210118Snilay@cs.wisc.edufrom m5.defines import buildEnv
433005Sstever@eecs.umich.edufrom m5.objects import *
446654Snate@binkert.orgfrom Benchmarks import *
456654Snate@binkert.org
462889SN/Aimport CpuConfig
472710SN/Aimport MemConfig
486654Snate@binkert.org
496654Snate@binkert.orgdef _listCpuTypes(option, opt, value, parser):
506654Snate@binkert.org    CpuConfig.print_cpu_list()
515457Ssaidi@eecs.umich.edu    sys.exit(0)
5211670Sandreas.hansson@arm.com
5310118Snilay@cs.wisc.edudef _listMemTypes(option, opt, value, parser):
5411670Sandreas.hansson@arm.com    MemConfig.print_mem_list()
556654Snate@binkert.org    sys.exit(0)
5611682Sandreas.hansson@arm.com
5711682Sandreas.hansson@arm.comdef addCommonOptions(parser):
5811682Sandreas.hansson@arm.com    # system options
5911682Sandreas.hansson@arm.com    parser.add_option("--list-cpu-types",
6011682Sandreas.hansson@arm.com                      action="callback", callback=_listCpuTypes,
6111682Sandreas.hansson@arm.com                      help="List available CPU types")
6211790Sjungma@eit.uni-kl.de    parser.add_option("--cpu-type", type="choice", default="atomic",
6311682Sandreas.hansson@arm.com                      choices=CpuConfig.cpu_names(),
6411682Sandreas.hansson@arm.com                      help = "type of cpu to run with")
653444Sktlim@umich.edu    parser.add_option("--checker", action="store_true");
663304Sstever@eecs.umich.edu    parser.add_option("-n", "--num-cpus", type="int", default=1)
679653SAndreas.Sandberg@ARM.com    parser.add_option("--sys-voltage", action="store", type="string",
689653SAndreas.Sandberg@ARM.com                      default='1.0V',
699653SAndreas.Sandberg@ARM.com                      help = """Top-level voltage for blocks running at system
709653SAndreas.Sandberg@ARM.com                      power supply""")
719653SAndreas.Sandberg@ARM.com    parser.add_option("--sys-clock", action="store", type="string",
729653SAndreas.Sandberg@ARM.com                      default='1GHz',
739653SAndreas.Sandberg@ARM.com                      help = """Top-level clock for blocks running at system
7410594Sgabeblack@google.com                      speed""")
7510594Sgabeblack@google.com    parser.add_option("--cpu-clock", action="store", type="string",
7610594Sgabeblack@google.com                      default='2GHz',
7710594Sgabeblack@google.com                      help="Clock for blocks running at CPU speed")
7810594Sgabeblack@google.com    parser.add_option("--smt", action="store_true", default=False,
7910594Sgabeblack@google.com                      help = """
8010594Sgabeblack@google.com                      Only used if multiple programs are specified. If true,
8110594Sgabeblack@google.com                      then the number of threads per cpu is same as the
8210594Sgabeblack@google.com                      number of programs.""")
8310594Sgabeblack@google.com
8410594Sgabeblack@google.com    # Memory Options
8510119Snilay@cs.wisc.edu    parser.add_option("--list-mem-types",
8610594Sgabeblack@google.com                      action="callback", callback=_listMemTypes,
8710119Snilay@cs.wisc.edu                      help="List available memory types")
8810594Sgabeblack@google.com    parser.add_option("--mem-type", type="choice", default="ddr3_1600_x64",
8910594Sgabeblack@google.com                      choices=MemConfig.mem_names(),
9010119Snilay@cs.wisc.edu                      help = "type of memory to use")
9110594Sgabeblack@google.com    parser.add_option("--mem-channels", type="int", default=1,
9210119Snilay@cs.wisc.edu                      help = "number of memory channels")
9310594Sgabeblack@google.com    parser.add_option("--mem-ranks", type="int", default=None,
9410119Snilay@cs.wisc.edu                      help = "number of memory ranks per channel")
9510119Snilay@cs.wisc.edu    parser.add_option("--mem-size", action="store", type="string",
9610594Sgabeblack@google.com                      default="512MB",
9710119Snilay@cs.wisc.edu                      help="Specify the physical memory size (single memory)")
9810512SAli.Saidi@ARM.com
9910512SAli.Saidi@ARM.com    parser.add_option("-l", "--lpae", action="store_true")
10010594Sgabeblack@google.com    parser.add_option("-V", "--virtualisation", action="store_true")
10110780SCurtis.Dunham@arm.com
10211598Sandreas.sandberg@arm.com    parser.add_option("--memchecker", action="store_true")
10311598Sandreas.sandberg@arm.com
10410119Snilay@cs.wisc.edu    # Cache Options
10510119Snilay@cs.wisc.edu    parser.add_option("--caches", action="store_true")
10610119Snilay@cs.wisc.edu    parser.add_option("--l2cache", action="store_true")
10710119Snilay@cs.wisc.edu    parser.add_option("--fastmem", action="store_true")
1082566SN/A    parser.add_option("--num-dirs", type="int", default=1)
10910119Snilay@cs.wisc.edu    parser.add_option("--num-l2caches", type="int", default=1)
11010119Snilay@cs.wisc.edu    parser.add_option("--num-l3caches", type="int", default=1)
1119665Sandreas.hansson@arm.com    parser.add_option("--l1d_size", type="string", default="64kB")
11210119Snilay@cs.wisc.edu    parser.add_option("--l1i_size", type="string", default="32kB")
11310119Snilay@cs.wisc.edu    parser.add_option("--l2_size", type="string", default="2MB")
11410119Snilay@cs.wisc.edu    parser.add_option("--l3_size", type="string", default="16MB")
11510119Snilay@cs.wisc.edu    parser.add_option("--l1d_assoc", type="int", default=2)
11610119Snilay@cs.wisc.edu    parser.add_option("--l1i_assoc", type="int", default=2)
11710119Snilay@cs.wisc.edu    parser.add_option("--l2_assoc", type="int", default=8)
11810119Snilay@cs.wisc.edu    parser.add_option("--l3_assoc", type="int", default=16)
11910119Snilay@cs.wisc.edu    parser.add_option("--cacheline_size", type="int", default=64)
12010119Snilay@cs.wisc.edu
12110119Snilay@cs.wisc.edu    # Enable Ruby
12210119Snilay@cs.wisc.edu    parser.add_option("--ruby", action="store_true")
12310119Snilay@cs.wisc.edu
12410119Snilay@cs.wisc.edu    # Run duration options
12510119Snilay@cs.wisc.edu    parser.add_option("-m", "--abs-max-tick", type="int", default=m5.MaxTick,
12610119Snilay@cs.wisc.edu                      metavar="TICKS", help="Run to absolute simulated tick " \
12710119Snilay@cs.wisc.edu                      "specified including ticks from a restored checkpoint")
12810119Snilay@cs.wisc.edu    parser.add_option("--rel-max-tick", type="int", default=None,
12910119Snilay@cs.wisc.edu                      metavar="TICKS", help="Simulate for specified number of" \
13010119Snilay@cs.wisc.edu                      " ticks relative to the simulation start tick (e.g. if " \
13110119Snilay@cs.wisc.edu                      "restoring a checkpoint)")
13210119Snilay@cs.wisc.edu    parser.add_option("--maxtime", type="float", default=None,
13310119Snilay@cs.wisc.edu                      help="Run to the specified absolute simulated time in " \
13410119Snilay@cs.wisc.edu                      "seconds")
13510119Snilay@cs.wisc.edu    parser.add_option("-I", "--maxinsts", action="store", type="int",
13610119Snilay@cs.wisc.edu                      default=None, help="""Total number of instructions to
13710119Snilay@cs.wisc.edu                                            simulate (default: run forever)""")
13810119Snilay@cs.wisc.edu    parser.add_option("--work-item-id", action="store", type="int",
13910119Snilay@cs.wisc.edu                      help="the specific work id for exit & checkpointing")
14010119Snilay@cs.wisc.edu    parser.add_option("--num-work-ids", action="store", type="int",
14110119Snilay@cs.wisc.edu                      help="Number of distinct work item types")
14210119Snilay@cs.wisc.edu    parser.add_option("--work-begin-cpu-id-exit", action="store", type="int",
14310119Snilay@cs.wisc.edu                      help="exit when work starts on the specified cpu")
14410119Snilay@cs.wisc.edu    parser.add_option("--work-end-exit-count", action="store", type="int",
14510119Snilay@cs.wisc.edu                      help="exit at specified work end count")
14611839SCurtis.Dunham@arm.com    parser.add_option("--work-begin-exit-count", action="store", type="int",
14710119Snilay@cs.wisc.edu                      help="exit at specified work begin count")
14810119Snilay@cs.wisc.edu    parser.add_option("--init-param", action="store", type="int", default=0,
14910119Snilay@cs.wisc.edu                      help="""Parameter available in simulation with m5
15010119Snilay@cs.wisc.edu                              initparam""")
15110119Snilay@cs.wisc.edu
15210119Snilay@cs.wisc.edu    # Simpoint options
15310119Snilay@cs.wisc.edu    parser.add_option("--simpoint-profile", action="store_true",
15410519Snilay@cs.wisc.edu                      help="Enable basic block profiling for SimPoints")
15510519Snilay@cs.wisc.edu    parser.add_option("--simpoint-interval", type="int", default=10000000,
15610119Snilay@cs.wisc.edu                      help="SimPoint interval in num of instructions")
15710119Snilay@cs.wisc.edu    parser.add_option("--take-simpoint-checkpoints", action="store", type="string",
15810119Snilay@cs.wisc.edu        help="<simpoint file,weight file,interval-length,warmup-length>")
15910119Snilay@cs.wisc.edu    parser.add_option("--restore-simpoint-checkpoint", action="store_true",
16010119Snilay@cs.wisc.edu        help="restore from a simpoint checkpoint taken with " +
16110547Snilay@cs.wisc.edu             "--take-simpoint-checkpoints")
16210547Snilay@cs.wisc.edu
16310547Snilay@cs.wisc.edu    # Checkpointing options
16410547Snilay@cs.wisc.edu    ###Note that performing checkpointing via python script files will override
16510119Snilay@cs.wisc.edu    ###checkpoint instructions built into binaries.
16610119Snilay@cs.wisc.edu    parser.add_option("--take-checkpoints", action="store", type="string",
16710119Snilay@cs.wisc.edu        help="<M,N> take checkpoints at tick M and every N ticks thereafter")
16810119Snilay@cs.wisc.edu    parser.add_option("--max-checkpoints", action="store", type="int",
16910119Snilay@cs.wisc.edu        help="the maximum number of checkpoints to drop", default=5)
17010119Snilay@cs.wisc.edu    parser.add_option("--checkpoint-dir", action="store", type="string",
17110119Snilay@cs.wisc.edu        help="Place all checkpoints in this absolute directory")
17210119Snilay@cs.wisc.edu    parser.add_option("-r", "--checkpoint-restore", action="store", type="int",
17310120Snilay@cs.wisc.edu        help="restore from checkpoint <N>")
17410120Snilay@cs.wisc.edu    parser.add_option("--checkpoint-at-end", action="store_true",
17510119Snilay@cs.wisc.edu                      help="take a checkpoint at end of run")
17611598Sandreas.sandberg@arm.com    parser.add_option("--work-begin-checkpoint-count", action="store", type="int",
17710120Snilay@cs.wisc.edu                      help="checkpoint at specified work begin count")
17810120Snilay@cs.wisc.edu    parser.add_option("--work-end-checkpoint-count", action="store", type="int",
17910119Snilay@cs.wisc.edu                      help="checkpoint at specified work end count")
18011598Sandreas.sandberg@arm.com    parser.add_option("--work-cpus-checkpoint-count", action="store", type="int",
18111150Smitch.hayenga@arm.com                      help="checkpoint and exit when active cpu count is reached")
18211150Smitch.hayenga@arm.com    parser.add_option("--restore-with-cpu", action="store", type="choice",
18311150Smitch.hayenga@arm.com                      default="atomic", choices=CpuConfig.cpu_names(),
18410119Snilay@cs.wisc.edu                      help = "cpu type for restoring from a checkpoint")
1852995SN/A
18610119Snilay@cs.wisc.edu
18710119Snilay@cs.wisc.edu    # CPU Switching - default switch model goes from a checkpoint
18810119Snilay@cs.wisc.edu    # to a timing simple CPU with caches to warm up, then to detailed CPU for
18910119Snilay@cs.wisc.edu    # data measurement
19010119Snilay@cs.wisc.edu    parser.add_option("--repeat-switch", action="store", type="int",
19110780SCurtis.Dunham@arm.com        default=None,
19210119Snilay@cs.wisc.edu        help="switch back and forth between CPUs with period <N>")
19310119Snilay@cs.wisc.edu    parser.add_option("-s", "--standard-switch", action="store", type="int",
19410119Snilay@cs.wisc.edu        default=None,
1953304Sstever@eecs.umich.edu        help="switch from timing to Detailed CPU after warmup period of <N>")
19610119Snilay@cs.wisc.edu    parser.add_option("-p", "--prog-interval", type="str",
19710119Snilay@cs.wisc.edu        help="CPU Progress Interval")
19810119Snilay@cs.wisc.edu
19910119Snilay@cs.wisc.edu    # Fastforwarding and simpoint related materials
20010119Snilay@cs.wisc.edu    parser.add_option("-W", "--warmup-insts", action="store", type="int",
20110119Snilay@cs.wisc.edu        default=None,
2026135Sgblack@eecs.umich.edu        help="Warmup period in total instructions (requires --standard-switch)")
20310608Sdam.sunwoo@arm.com    parser.add_option("--bench", action="store", type="string", default=None,
20410608Sdam.sunwoo@arm.com        help="base names for --take-checkpoint and --checkpoint-restore")
20510608Sdam.sunwoo@arm.com    parser.add_option("-F", "--fast-forward", action="store", type="string",
20610608Sdam.sunwoo@arm.com        default=None,
20710608Sdam.sunwoo@arm.com        help="Number of instructions to fast forward before switching")
20810608Sdam.sunwoo@arm.com    parser.add_option("-S", "--simpoint", action="store_true", default=False,
20910608Sdam.sunwoo@arm.com        help="""Use workload simpoints as an instruction offset for
21010119Snilay@cs.wisc.edu                --checkpoint-restore or --take-checkpoint.""")
21110119Snilay@cs.wisc.edu    parser.add_option("--at-instruction", action="store_true", default=False,
21210119Snilay@cs.wisc.edu        help="""Treat value of --checkpoint-restore or --take-checkpoint as a
21310608Sdam.sunwoo@arm.com                number of instructions.""")
21410608Sdam.sunwoo@arm.com    parser.add_option("--spec-input", default="ref", type="choice",
21510119Snilay@cs.wisc.edu                      choices=["ref", "test", "train", "smred", "mdred",
21610119Snilay@cs.wisc.edu                               "lgred"],
21710119Snilay@cs.wisc.edu                      help="Input set size for SPEC CPU2000 benchmarks.")
2183819Shsul@eecs.umich.edu    parser.add_option("--arm-iset", default="arm", type="choice",
21911251Sradhika.jagtap@ARM.com                      choices=["arm", "thumb", "aarch64"],
22011251Sradhika.jagtap@ARM.com                      help="ARM instruction set.")
22111251Sradhika.jagtap@ARM.com
22211251Sradhika.jagtap@ARM.com
22311251Sradhika.jagtap@ARM.comdef addSEOptions(parser):
22411251Sradhika.jagtap@ARM.com    # Benchmark options
22511251Sradhika.jagtap@ARM.com    parser.add_option("-c", "--cmd", default="",
22611251Sradhika.jagtap@ARM.com                      help="The binary to run in syscall emulation mode.")
22711251Sradhika.jagtap@ARM.com    parser.add_option("-o", "--options", default="",
22811251Sradhika.jagtap@ARM.com                      help="""The options to pass to the binary, use " "
22911251Sradhika.jagtap@ARM.com                              around the entire string""")
23010119Snilay@cs.wisc.edu    parser.add_option("-i", "--input", default="",
23111183Serfan.azarkhish@unibo.it                      help="Read stdin from a file.")
23210119Snilay@cs.wisc.edu    parser.add_option("--output", default="",
23310118Snilay@cs.wisc.edu                      help="Redirect stdout to a file.")
23410119Snilay@cs.wisc.edu    parser.add_option("--errout", default="",
2359827Sakash.bagdia@arm.com                      help="Redirect stderr to a file.")
23610119Snilay@cs.wisc.edu
23710119Snilay@cs.wisc.edudef addFSOptions(parser):
23810119Snilay@cs.wisc.edu    # Simulation options
23910119Snilay@cs.wisc.edu    parser.add_option("--timesync", action="store_true",
24010119Snilay@cs.wisc.edu            help="Prevent simulated time from getting ahead of real time")
24110119Snilay@cs.wisc.edu
2429827Sakash.bagdia@arm.com    # System options
24310594Sgabeblack@google.com    parser.add_option("--kernel", action="store", type="string")
2446654Snate@binkert.org    parser.add_option("--script", action="store", type="string")
24510594Sgabeblack@google.com    parser.add_option("--frame-capture", action="store_true",
2466654Snate@binkert.org            help="Stores changed frame buffers from the VNC server to compressed "\
24710594Sgabeblack@google.com            "files in the gem5 output directory")
2486654Snate@binkert.org
24910594Sgabeblack@google.com    if buildEnv['TARGET_ISA'] == "arm":
2506654Snate@binkert.org        parser.add_option("--bare-metal", action="store_true",
25110594Sgabeblack@google.com                   help="Provide the raw system without the linux specific bits")
25210594Sgabeblack@google.com        parser.add_option("--machine-type", action="store", type="choice",
2537586SAli.Saidi@arm.com                choices=ArmMachineType.map.keys(), default="VExpress_EMM")
25410635Satgutier@umich.edu        parser.add_option("--dtb-filename", action="store", type="string",
25510635Satgutier@umich.edu              help="Specifies device tree blob file to use with device-tree-"\
2568661SAli.Saidi@ARM.com              "enabled kernels")
2579827Sakash.bagdia@arm.com        parser.add_option("--enable-context-switch-stats-dump", \
2589827Sakash.bagdia@arm.com                action="store_true", help="Enable stats dump at context "\
2599827Sakash.bagdia@arm.com                "switches and dump tasks file (required for Streamline)")
2609793Sakash.bagdia@arm.com
26110119Snilay@cs.wisc.edu    # Benchmark options
26210119Snilay@cs.wisc.edu    parser.add_option("--dual", action="store_true",
2639790Sakash.bagdia@arm.com                      help="Simulate two systems attached with an ethernet link")
2649827Sakash.bagdia@arm.com    parser.add_option("-b", "--benchmark", action="store", type="string",
2659827Sakash.bagdia@arm.com                      dest="benchmark",
2669827Sakash.bagdia@arm.com                      help="Specify the benchmark to run. Available benchmarks: %s"\
2679793Sakash.bagdia@arm.com                      % DefinedBenchmarks)
2689827Sakash.bagdia@arm.com
2699827Sakash.bagdia@arm.com    # Metafile options
2709827Sakash.bagdia@arm.com    parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
2719793Sakash.bagdia@arm.com                      help="Specify the filename to dump a pcap capture of the" \
2729793Sakash.bagdia@arm.com                      "ethernet traffic")
2739793Sakash.bagdia@arm.com
2749384SAndreas.Sandberg@arm.com    # Disk Image Options
2758863Snilay@cs.wisc.edu    parser.add_option("--disk-image", action="store", type="string", default=None,
2767876Sgblack@eecs.umich.edu                      help="Path to the disk image to use.")
2774968Sacolyte@umich.edu    parser.add_option("--root-device", action="store", type="string", default=None,
2788926Sandreas.hansson@arm.com                      help="OS device name for root partition")
2794837Ssaidi@eecs.umich.edu
2804837Ssaidi@eecs.umich.edu    # Command line options
2819408Sandreas.hansson@arm.com    parser.add_option("--command-line", action="store", type="string",
2829653SAndreas.Sandberg@ARM.com                      default=None,
28311839SCurtis.Dunham@arm.com                      help="Template for the kernel command line.")
2849653SAndreas.Sandberg@ARM.com    parser.add_option("--command-line-file", action="store",
2859164Sandreas.hansson@arm.com                      default=None, type="string",
2869408Sandreas.hansson@arm.com                      help="File with a template for the kernel command line")
2878845Sandreas.hansson@arm.com