Options.py revision 9562
19793Sakash.bagdia@arm.com# Copyright (c) 2006-2008 The Regents of The University of Michigan
27586SAli.Saidi@arm.com# All rights reserved.
37586SAli.Saidi@arm.com#
47586SAli.Saidi@arm.com# Redistribution and use in source and binary forms, with or without
57586SAli.Saidi@arm.com# modification, are permitted provided that the following conditions are
67586SAli.Saidi@arm.com# met: redistributions of source code must retain the above copyright
77586SAli.Saidi@arm.com# notice, this list of conditions and the following disclaimer;
87586SAli.Saidi@arm.com# redistributions in binary form must reproduce the above copyright
97586SAli.Saidi@arm.com# notice, this list of conditions and the following disclaimer in the
107586SAli.Saidi@arm.com# documentation and/or other materials provided with the distribution;
117586SAli.Saidi@arm.com# neither the name of the copyright holders nor the names of its
127586SAli.Saidi@arm.com# contributors may be used to endorse or promote products derived from
1310118Snilay@cs.wisc.edu# this software without specific prior written permission.
1410118Snilay@cs.wisc.edu#
153970Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
163005Sstever@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
173005Sstever@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
183005Sstever@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
193005Sstever@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
203005Sstever@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
213005Sstever@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
223005Sstever@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
233005Sstever@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
243005Sstever@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
253005Sstever@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
263005Sstever@eecs.umich.edu#
273005Sstever@eecs.umich.edu# Authors: Lisa Hsu
283005Sstever@eecs.umich.edu
293005Sstever@eecs.umich.eduimport m5
303005Sstever@eecs.umich.edufrom m5.defines import buildEnv
313005Sstever@eecs.umich.edufrom m5.objects import *
323005Sstever@eecs.umich.edufrom Benchmarks import *
333005Sstever@eecs.umich.edu
343005Sstever@eecs.umich.eduimport CpuConfig
353005Sstever@eecs.umich.edu
363005Sstever@eecs.umich.edudef _listCpuTypes(option, opt, value, parser):
373005Sstever@eecs.umich.edu    CpuConfig.print_cpu_list()
383005Sstever@eecs.umich.edu    sys.exit(0)
393005Sstever@eecs.umich.edu
403005Sstever@eecs.umich.edudef addCommonOptions(parser):
413005Sstever@eecs.umich.edu    # system options
4210118Snilay@cs.wisc.edu    parser.add_option("--list-cpu-types",
433005Sstever@eecs.umich.edu                      action="callback", callback=_listCpuTypes,
446654Snate@binkert.org                      help="List available CPU types")
456654Snate@binkert.org    parser.add_option("--cpu-type", type="choice", default="atomic",
462889SN/A                      choices=CpuConfig.cpu_names(),
472710SN/A                      help = "type of cpu to run with")
486654Snate@binkert.org    parser.add_option("--checker", action="store_true");
496654Snate@binkert.org    parser.add_option("-n", "--num-cpus", type="int", default=1)
506654Snate@binkert.org    parser.add_option("--caches", action="store_true")
515457Ssaidi@eecs.umich.edu    parser.add_option("--l2cache", action="store_true")
526654Snate@binkert.org    parser.add_option("--fastmem", action="store_true")
5310118Snilay@cs.wisc.edu    parser.add_option("--clock", action="store", type="string", default='2GHz')
5410118Snilay@cs.wisc.edu    parser.add_option("--num-dirs", type="int", default=1)
5510118Snilay@cs.wisc.edu    parser.add_option("--num-l2caches", type="int", default=1)
566654Snate@binkert.org    parser.add_option("--num-l3caches", type="int", default=1)
572934SN/A    parser.add_option("--l1d_size", type="string", default="64kB")
582549SN/A    parser.add_option("--l1i_size", type="string", default="32kB")
592995SN/A    parser.add_option("--l2_size", type="string", default="2MB")
603395Shsul@eecs.umich.edu    parser.add_option("--l3_size", type="string", default="16MB")
616981SLisa.Hsu@amd.com    parser.add_option("--l1d_assoc", type="int", default=2)
629836Sandreas.hansson@arm.com    parser.add_option("--l1i_assoc", type="int", default=2)
633448Shsul@eecs.umich.edu    parser.add_option("--l2_assoc", type="int", default=8)
648920Snilay@cs.wisc.edu    parser.add_option("--l3_assoc", type="int", default=16)
653444Sktlim@umich.edu    parser.add_option("--cacheline_size", type="int", default=64)
663304Sstever@eecs.umich.edu    parser.add_option("--ruby", action="store_true")
679653SAndreas.Sandberg@ARM.com    parser.add_option("--smt", action="store_true", default=False,
689653SAndreas.Sandberg@ARM.com                      help = """
699653SAndreas.Sandberg@ARM.com                      Only used if multiple programs are specified. If true,
709653SAndreas.Sandberg@ARM.com                      then the number of threads per cpu is same as the
719653SAndreas.Sandberg@ARM.com                      number of programs.""")
729653SAndreas.Sandberg@ARM.com
739653SAndreas.Sandberg@ARM.com    # Run duration options
7410119Snilay@cs.wisc.edu    parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick,
7510119Snilay@cs.wisc.edu                      metavar="T", help="Stop after T ticks")
7610119Snilay@cs.wisc.edu    parser.add_option("--maxtime", type="float")
7710119Snilay@cs.wisc.edu    parser.add_option("-I", "--maxinsts", action="store", type="int",
7810119Snilay@cs.wisc.edu                      default=None, help="""Total number of instructions to
7910119Snilay@cs.wisc.edu                                            simulate (default: run forever)""")
8010119Snilay@cs.wisc.edu    parser.add_option("--work-item-id", action="store", type="int",
8110119Snilay@cs.wisc.edu                      help="the specific work id for exit & checkpointing")
8210119Snilay@cs.wisc.edu    parser.add_option("--work-begin-cpu-id-exit", action="store", type="int",
8310119Snilay@cs.wisc.edu                      help="exit when work starts on the specified cpu")
8410119Snilay@cs.wisc.edu    parser.add_option("--work-end-exit-count", action="store", type="int",
8510119Snilay@cs.wisc.edu                      help="exit at specified work end count")
8610119Snilay@cs.wisc.edu    parser.add_option("--work-begin-exit-count", action="store", type="int",
8710119Snilay@cs.wisc.edu                      help="exit at specified work begin count")
8810119Snilay@cs.wisc.edu    parser.add_option("--init-param", action="store", type="int", default=0,
8910119Snilay@cs.wisc.edu                      help="""Parameter available in simulation with m5
9010119Snilay@cs.wisc.edu                              initparam""")
9110119Snilay@cs.wisc.edu
922566SN/A    # Checkpointing options
9310119Snilay@cs.wisc.edu    ###Note that performing checkpointing via python script files will override
9410119Snilay@cs.wisc.edu    ###checkpoint instructions built into binaries.
959665Sandreas.hansson@arm.com    parser.add_option("--take-checkpoints", action="store", type="string",
9610119Snilay@cs.wisc.edu        help="<M,N> take checkpoints at tick M and every N ticks thereafter")
9710119Snilay@cs.wisc.edu    parser.add_option("--max-checkpoints", action="store", type="int",
9810119Snilay@cs.wisc.edu        help="the maximum number of checkpoints to drop", default=5)
9910119Snilay@cs.wisc.edu    parser.add_option("--checkpoint-dir", action="store", type="string",
10010119Snilay@cs.wisc.edu        help="Place all checkpoints in this absolute directory")
10110119Snilay@cs.wisc.edu    parser.add_option("-r", "--checkpoint-restore", action="store", type="int",
10210119Snilay@cs.wisc.edu        help="restore from checkpoint <N>")
10310119Snilay@cs.wisc.edu    parser.add_option("--checkpoint-at-end", action="store_true",
10410119Snilay@cs.wisc.edu                      help="take a checkpoint at end of run")
10510119Snilay@cs.wisc.edu    parser.add_option("--work-begin-checkpoint-count", action="store", type="int",
10610119Snilay@cs.wisc.edu                      help="checkpoint at specified work begin count")
10710119Snilay@cs.wisc.edu    parser.add_option("--work-end-checkpoint-count", action="store", type="int",
10810119Snilay@cs.wisc.edu                      help="checkpoint at specified work end count")
10910119Snilay@cs.wisc.edu    parser.add_option("--work-cpus-checkpoint-count", action="store", type="int",
11010119Snilay@cs.wisc.edu                      help="checkpoint and exit when active cpu count is reached")
11110119Snilay@cs.wisc.edu    parser.add_option("--restore-with-cpu", action="store", type="choice",
11210119Snilay@cs.wisc.edu                      default="atomic", choices = ["atomic", "timing",
11310119Snilay@cs.wisc.edu                                                   "detailed", "inorder"],
11410119Snilay@cs.wisc.edu                      help = "cpu type for restoring from a checkpoint")
11510119Snilay@cs.wisc.edu
11610119Snilay@cs.wisc.edu
11710119Snilay@cs.wisc.edu    # CPU Switching - default switch model goes from a checkpoint
11810119Snilay@cs.wisc.edu    # to a timing simple CPU with caches to warm up, then to detailed CPU for
11910119Snilay@cs.wisc.edu    # data measurement
12010119Snilay@cs.wisc.edu    parser.add_option("--repeat-switch", action="store", type="int",
12110119Snilay@cs.wisc.edu        default=None,
12210119Snilay@cs.wisc.edu        help="switch back and forth between CPUs with period <N>")
12310119Snilay@cs.wisc.edu    parser.add_option("-s", "--standard-switch", action="store", type="int",
12410119Snilay@cs.wisc.edu        default=None,
12510119Snilay@cs.wisc.edu        help="switch from timing to Detailed CPU after warmup period of <N>")
12610119Snilay@cs.wisc.edu    parser.add_option("-p", "--prog-interval", type="str",
12710119Snilay@cs.wisc.edu        help="CPU Progress Interval")
12810119Snilay@cs.wisc.edu
12910119Snilay@cs.wisc.edu    # Fastforwarding and simpoint related materials
13010119Snilay@cs.wisc.edu    parser.add_option("-W", "--warmup-insts", action="store", type="int",
13110119Snilay@cs.wisc.edu        default=None,
13210119Snilay@cs.wisc.edu        help="Warmup period in total instructions (requires --standard-switch)")
13310119Snilay@cs.wisc.edu    parser.add_option("--bench", action="store", type="string", default=None,
13410119Snilay@cs.wisc.edu        help="base names for --take-checkpoint and --checkpoint-restore")
13510119Snilay@cs.wisc.edu    parser.add_option("-F", "--fast-forward", action="store", type="string",
13610119Snilay@cs.wisc.edu        default=None,
13710119Snilay@cs.wisc.edu        help="Number of instructions to fast forward before switching")
13810119Snilay@cs.wisc.edu    parser.add_option("-S", "--simpoint", action="store_true", default=False,
13910119Snilay@cs.wisc.edu        help="""Use workload simpoints as an instruction offset for
14010119Snilay@cs.wisc.edu                --checkpoint-restore or --take-checkpoint.""")
14110119Snilay@cs.wisc.edu    parser.add_option("--at-instruction", action="store_true", default=False,
14210119Snilay@cs.wisc.edu        help="""Treat value of --checkpoint-restore or --take-checkpoint as a
14310119Snilay@cs.wisc.edu                number of instructions.""")
14410119Snilay@cs.wisc.edu
14510119Snilay@cs.wisc.edudef addSEOptions(parser):
14610119Snilay@cs.wisc.edu    # Benchmark options
14710119Snilay@cs.wisc.edu    parser.add_option("-c", "--cmd", default="",
14810119Snilay@cs.wisc.edu                      help="The binary to run in syscall emulation mode.")
14910119Snilay@cs.wisc.edu    parser.add_option("-o", "--options", default="",
15010119Snilay@cs.wisc.edu                      help="""The options to pass to the binary, use " "
15110119Snilay@cs.wisc.edu                              around the entire string""")
15210119Snilay@cs.wisc.edu    parser.add_option("-i", "--input", default="",
15310119Snilay@cs.wisc.edu                      help="Read stdin from a file.")
15410119Snilay@cs.wisc.edu    parser.add_option("--output", default="",
15510119Snilay@cs.wisc.edu                      help="Redirect stdout to a file.")
15610119Snilay@cs.wisc.edu    parser.add_option("--errout", default="",
15710119Snilay@cs.wisc.edu                      help="Redirect stderr to a file.")
15810119Snilay@cs.wisc.edu
15910119Snilay@cs.wisc.edudef addFSOptions(parser):
16010119Snilay@cs.wisc.edu    # Simulation options
16110119Snilay@cs.wisc.edu    parser.add_option("--timesync", action="store_true",
16210119Snilay@cs.wisc.edu            help="Prevent simulated time from getting ahead of real time")
16310119Snilay@cs.wisc.edu
16410119Snilay@cs.wisc.edu    # System options
16510119Snilay@cs.wisc.edu    parser.add_option("--kernel", action="store", type="string")
16610119Snilay@cs.wisc.edu    parser.add_option("--script", action="store", type="string")
16710119Snilay@cs.wisc.edu    parser.add_option("--frame-capture", action="store_true",
16810119Snilay@cs.wisc.edu            help="Stores changed frame buffers from the VNC server to compressed "\
16910119Snilay@cs.wisc.edu            "files in the gem5 output directory")
17010119Snilay@cs.wisc.edu
1712995SN/A    if buildEnv['TARGET_ISA'] == "arm":
17210119Snilay@cs.wisc.edu        parser.add_option("--bare-metal", action="store_true",
17310119Snilay@cs.wisc.edu                   help="Provide the raw system without the linux specific bits")
17410119Snilay@cs.wisc.edu        parser.add_option("--machine-type", action="store", type="choice",
17510119Snilay@cs.wisc.edu                choices=ArmMachineType.map.keys(), default="RealView_PBX")
17610119Snilay@cs.wisc.edu        parser.add_option("--dtb-filename", action="store", type="string",
17710119Snilay@cs.wisc.edu              help="Specifies device tree blob file to use with device-tree-"\
17810119Snilay@cs.wisc.edu              "enabled kernels")
17910119Snilay@cs.wisc.edu    # Benchmark options
18010119Snilay@cs.wisc.edu    parser.add_option("--dual", action="store_true",
1813304Sstever@eecs.umich.edu                      help="Simulate two systems attached with an ethernet link")
18210119Snilay@cs.wisc.edu    parser.add_option("-b", "--benchmark", action="store", type="string",
18310119Snilay@cs.wisc.edu                      dest="benchmark",
18410119Snilay@cs.wisc.edu                      help="Specify the benchmark to run. Available benchmarks: %s"\
18510119Snilay@cs.wisc.edu                      % DefinedBenchmarks)
18610119Snilay@cs.wisc.edu
18710119Snilay@cs.wisc.edu    # Metafile options
1886135Sgblack@eecs.umich.edu    parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
18910119Snilay@cs.wisc.edu                      help="Specify the filename to dump a pcap capture of the" \
19010119Snilay@cs.wisc.edu                      "ethernet traffic")
19110119Snilay@cs.wisc.edu
19210119Snilay@cs.wisc.edu    # Disk Image Options
19310119Snilay@cs.wisc.edu    parser.add_option("--disk-image", action="store", type="string", default=None,
19410119Snilay@cs.wisc.edu                      help="Path to the disk image to use.")
1953819Shsul@eecs.umich.edu
19610119Snilay@cs.wisc.edu    # Memory Size Options
19710119Snilay@cs.wisc.edu    parser.add_option("--mem-size", action="store", type="string", default=None,
19810118Snilay@cs.wisc.edu                      help="Specify the physical memory size (single memory)")
19910119Snilay@cs.wisc.edu