Options.py revision 9647
15353Svilas.sridharan@gmail.com# Copyright (c) 2006-2008 The Regents of The University of Michigan
23395Shsul@eecs.umich.edu# All rights reserved.
33395Shsul@eecs.umich.edu#
43395Shsul@eecs.umich.edu# Redistribution and use in source and binary forms, with or without
53395Shsul@eecs.umich.edu# modification, are permitted provided that the following conditions are
63395Shsul@eecs.umich.edu# met: redistributions of source code must retain the above copyright
73395Shsul@eecs.umich.edu# notice, this list of conditions and the following disclaimer;
83395Shsul@eecs.umich.edu# redistributions in binary form must reproduce the above copyright
93395Shsul@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the
103395Shsul@eecs.umich.edu# documentation and/or other materials provided with the distribution;
113395Shsul@eecs.umich.edu# neither the name of the copyright holders nor the names of its
123395Shsul@eecs.umich.edu# contributors may be used to endorse or promote products derived from
133395Shsul@eecs.umich.edu# this software without specific prior written permission.
143395Shsul@eecs.umich.edu#
153395Shsul@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
163395Shsul@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
173395Shsul@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
183395Shsul@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
193395Shsul@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
203395Shsul@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
213395Shsul@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
223395Shsul@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
233395Shsul@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
243395Shsul@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
253395Shsul@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
263395Shsul@eecs.umich.edu#
273395Shsul@eecs.umich.edu# Authors: Lisa Hsu
283395Shsul@eecs.umich.edu
298920Snilay@cs.wisc.eduimport m5
308920Snilay@cs.wisc.edufrom m5.defines import buildEnv
318920Snilay@cs.wisc.edufrom m5.objects import *
328920Snilay@cs.wisc.edufrom Benchmarks import *
337025SBrad.Beckmann@amd.com
349520SAndreas.Sandberg@ARM.comimport CpuConfig
359520SAndreas.Sandberg@ARM.com
369520SAndreas.Sandberg@ARM.comdef _listCpuTypes(option, opt, value, parser):
379520SAndreas.Sandberg@ARM.com    CpuConfig.print_cpu_list()
389520SAndreas.Sandberg@ARM.com    sys.exit(0)
399520SAndreas.Sandberg@ARM.com
408920Snilay@cs.wisc.edudef addCommonOptions(parser):
418920Snilay@cs.wisc.edu    # system options
429520SAndreas.Sandberg@ARM.com    parser.add_option("--list-cpu-types",
439520SAndreas.Sandberg@ARM.com                      action="callback", callback=_listCpuTypes,
449520SAndreas.Sandberg@ARM.com                      help="List available CPU types")
458920Snilay@cs.wisc.edu    parser.add_option("--cpu-type", type="choice", default="atomic",
469520SAndreas.Sandberg@ARM.com                      choices=CpuConfig.cpu_names(),
478920Snilay@cs.wisc.edu                      help = "type of cpu to run with")
488920Snilay@cs.wisc.edu    parser.add_option("--checker", action="store_true");
498920Snilay@cs.wisc.edu    parser.add_option("-n", "--num-cpus", type="int", default=1)
508920Snilay@cs.wisc.edu    parser.add_option("--caches", action="store_true")
518920Snilay@cs.wisc.edu    parser.add_option("--l2cache", action="store_true")
528920Snilay@cs.wisc.edu    parser.add_option("--fastmem", action="store_true")
539647Sdam.sunwoo@arm.com    parser.add_option("--simpoint-profile", action="store_true",
549647Sdam.sunwoo@arm.com                      help="Enable basic block profiling for SimPoints")
559647Sdam.sunwoo@arm.com    parser.add_option("--simpoint-interval", type="int", default=10000000,
569647Sdam.sunwoo@arm.com                      help="SimPoint interval in num of instructions")
578920Snilay@cs.wisc.edu    parser.add_option("--clock", action="store", type="string", default='2GHz')
588920Snilay@cs.wisc.edu    parser.add_option("--num-dirs", type="int", default=1)
598920Snilay@cs.wisc.edu    parser.add_option("--num-l2caches", type="int", default=1)
608920Snilay@cs.wisc.edu    parser.add_option("--num-l3caches", type="int", default=1)
618920Snilay@cs.wisc.edu    parser.add_option("--l1d_size", type="string", default="64kB")
628920Snilay@cs.wisc.edu    parser.add_option("--l1i_size", type="string", default="32kB")
638920Snilay@cs.wisc.edu    parser.add_option("--l2_size", type="string", default="2MB")
648920Snilay@cs.wisc.edu    parser.add_option("--l3_size", type="string", default="16MB")
658920Snilay@cs.wisc.edu    parser.add_option("--l1d_assoc", type="int", default=2)
668920Snilay@cs.wisc.edu    parser.add_option("--l1i_assoc", type="int", default=2)
678920Snilay@cs.wisc.edu    parser.add_option("--l2_assoc", type="int", default=8)
688920Snilay@cs.wisc.edu    parser.add_option("--l3_assoc", type="int", default=16)
698920Snilay@cs.wisc.edu    parser.add_option("--cacheline_size", type="int", default=64)
708920Snilay@cs.wisc.edu    parser.add_option("--ruby", action="store_true")
719197Snilay@cs.wisc.edu    parser.add_option("--smt", action="store_true", default=False,
729197Snilay@cs.wisc.edu                      help = """
739197Snilay@cs.wisc.edu                      Only used if multiple programs are specified. If true,
749197Snilay@cs.wisc.edu                      then the number of threads per cpu is same as the
759197Snilay@cs.wisc.edu                      number of programs.""")
763395Shsul@eecs.umich.edu
778920Snilay@cs.wisc.edu    # Run duration options
788920Snilay@cs.wisc.edu    parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick,
798920Snilay@cs.wisc.edu                      metavar="T", help="Stop after T ticks")
808920Snilay@cs.wisc.edu    parser.add_option("--maxtime", type="float")
818920Snilay@cs.wisc.edu    parser.add_option("-I", "--maxinsts", action="store", type="int",
828920Snilay@cs.wisc.edu                      default=None, help="""Total number of instructions to
838920Snilay@cs.wisc.edu                                            simulate (default: run forever)""")
848920Snilay@cs.wisc.edu    parser.add_option("--work-item-id", action="store", type="int",
858920Snilay@cs.wisc.edu                      help="the specific work id for exit & checkpointing")
868920Snilay@cs.wisc.edu    parser.add_option("--work-begin-cpu-id-exit", action="store", type="int",
878920Snilay@cs.wisc.edu                      help="exit when work starts on the specified cpu")
888920Snilay@cs.wisc.edu    parser.add_option("--work-end-exit-count", action="store", type="int",
898920Snilay@cs.wisc.edu                      help="exit at specified work end count")
908920Snilay@cs.wisc.edu    parser.add_option("--work-begin-exit-count", action="store", type="int",
918920Snilay@cs.wisc.edu                      help="exit at specified work begin count")
928920Snilay@cs.wisc.edu    parser.add_option("--init-param", action="store", type="int", default=0,
938920Snilay@cs.wisc.edu                      help="""Parameter available in simulation with m5
948920Snilay@cs.wisc.edu                              initparam""")
956776SBrad.Beckmann@amd.com
968920Snilay@cs.wisc.edu    # Checkpointing options
978920Snilay@cs.wisc.edu    ###Note that performing checkpointing via python script files will override
988920Snilay@cs.wisc.edu    ###checkpoint instructions built into binaries.
998920Snilay@cs.wisc.edu    parser.add_option("--take-checkpoints", action="store", type="string",
1009357Sandreas.hansson@arm.com        help="<M,N> take checkpoints at tick M and every N ticks thereafter")
1018920Snilay@cs.wisc.edu    parser.add_option("--max-checkpoints", action="store", type="int",
1028920Snilay@cs.wisc.edu        help="the maximum number of checkpoints to drop", default=5)
1038920Snilay@cs.wisc.edu    parser.add_option("--checkpoint-dir", action="store", type="string",
1048920Snilay@cs.wisc.edu        help="Place all checkpoints in this absolute directory")
1058920Snilay@cs.wisc.edu    parser.add_option("-r", "--checkpoint-restore", action="store", type="int",
1068920Snilay@cs.wisc.edu        help="restore from checkpoint <N>")
1078920Snilay@cs.wisc.edu    parser.add_option("--checkpoint-at-end", action="store_true",
1088920Snilay@cs.wisc.edu                      help="take a checkpoint at end of run")
1098920Snilay@cs.wisc.edu    parser.add_option("--work-begin-checkpoint-count", action="store", type="int",
1108920Snilay@cs.wisc.edu                      help="checkpoint at specified work begin count")
1118920Snilay@cs.wisc.edu    parser.add_option("--work-end-checkpoint-count", action="store", type="int",
1128920Snilay@cs.wisc.edu                      help="checkpoint at specified work end count")
1138920Snilay@cs.wisc.edu    parser.add_option("--work-cpus-checkpoint-count", action="store", type="int",
1148920Snilay@cs.wisc.edu                      help="checkpoint and exit when active cpu count is reached")
1158920Snilay@cs.wisc.edu    parser.add_option("--restore-with-cpu", action="store", type="choice",
1168920Snilay@cs.wisc.edu                      default="atomic", choices = ["atomic", "timing",
1178920Snilay@cs.wisc.edu                                                   "detailed", "inorder"],
1188920Snilay@cs.wisc.edu                      help = "cpu type for restoring from a checkpoint")
1193395Shsul@eecs.umich.edu
1205361Srstrong@cs.ucsd.edu
1218920Snilay@cs.wisc.edu    # CPU Switching - default switch model goes from a checkpoint
1228920Snilay@cs.wisc.edu    # to a timing simple CPU with caches to warm up, then to detailed CPU for
1238920Snilay@cs.wisc.edu    # data measurement
1249151Satgutier@umich.edu    parser.add_option("--repeat-switch", action="store", type="int",
1259151Satgutier@umich.edu        default=None,
1269151Satgutier@umich.edu        help="switch back and forth between CPUs with period <N>")
1279151Satgutier@umich.edu    parser.add_option("-s", "--standard-switch", action="store", type="int",
1289151Satgutier@umich.edu        default=None,
1299151Satgutier@umich.edu        help="switch from timing to Detailed CPU after warmup period of <N>")
1309562Ssaidi@eecs.umich.edu    parser.add_option("-p", "--prog-interval", type="str",
1318920Snilay@cs.wisc.edu        help="CPU Progress Interval")
1328920Snilay@cs.wisc.edu
1338920Snilay@cs.wisc.edu    # Fastforwarding and simpoint related materials
1348920Snilay@cs.wisc.edu    parser.add_option("-W", "--warmup-insts", action="store", type="int",
1358920Snilay@cs.wisc.edu        default=None,
1368920Snilay@cs.wisc.edu        help="Warmup period in total instructions (requires --standard-switch)")
1378920Snilay@cs.wisc.edu    parser.add_option("--bench", action="store", type="string", default=None,
1388920Snilay@cs.wisc.edu        help="base names for --take-checkpoint and --checkpoint-restore")
1398920Snilay@cs.wisc.edu    parser.add_option("-F", "--fast-forward", action="store", type="string",
1408920Snilay@cs.wisc.edu        default=None,
1418920Snilay@cs.wisc.edu        help="Number of instructions to fast forward before switching")
1428920Snilay@cs.wisc.edu    parser.add_option("-S", "--simpoint", action="store_true", default=False,
1438920Snilay@cs.wisc.edu        help="""Use workload simpoints as an instruction offset for
1448920Snilay@cs.wisc.edu                --checkpoint-restore or --take-checkpoint.""")
1458920Snilay@cs.wisc.edu    parser.add_option("--at-instruction", action="store_true", default=False,
1468920Snilay@cs.wisc.edu        help="""Treat value of --checkpoint-restore or --take-checkpoint as a
1478920Snilay@cs.wisc.edu                number of instructions.""")
1488920Snilay@cs.wisc.edu
1498920Snilay@cs.wisc.edudef addSEOptions(parser):
1508920Snilay@cs.wisc.edu    # Benchmark options
1518920Snilay@cs.wisc.edu    parser.add_option("-c", "--cmd", default="",
1528920Snilay@cs.wisc.edu                      help="The binary to run in syscall emulation mode.")
1538920Snilay@cs.wisc.edu    parser.add_option("-o", "--options", default="",
1548920Snilay@cs.wisc.edu                      help="""The options to pass to the binary, use " "
1558920Snilay@cs.wisc.edu                              around the entire string""")
1568920Snilay@cs.wisc.edu    parser.add_option("-i", "--input", default="",
1578920Snilay@cs.wisc.edu                      help="Read stdin from a file.")
1588920Snilay@cs.wisc.edu    parser.add_option("--output", default="",
1598920Snilay@cs.wisc.edu                      help="Redirect stdout to a file.")
1608920Snilay@cs.wisc.edu    parser.add_option("--errout", default="",
1618920Snilay@cs.wisc.edu                      help="Redirect stderr to a file.")
1628920Snilay@cs.wisc.edu
1638920Snilay@cs.wisc.edudef addFSOptions(parser):
1648920Snilay@cs.wisc.edu    # Simulation options
1658920Snilay@cs.wisc.edu    parser.add_option("--timesync", action="store_true",
1668920Snilay@cs.wisc.edu            help="Prevent simulated time from getting ahead of real time")
1678920Snilay@cs.wisc.edu
1688920Snilay@cs.wisc.edu    # System options
1698920Snilay@cs.wisc.edu    parser.add_option("--kernel", action="store", type="string")
1708920Snilay@cs.wisc.edu    parser.add_option("--script", action="store", type="string")
1718920Snilay@cs.wisc.edu    parser.add_option("--frame-capture", action="store_true",
1728920Snilay@cs.wisc.edu            help="Stores changed frame buffers from the VNC server to compressed "\
1738920Snilay@cs.wisc.edu            "files in the gem5 output directory")
1748920Snilay@cs.wisc.edu
1758920Snilay@cs.wisc.edu    if buildEnv['TARGET_ISA'] == "arm":
1768920Snilay@cs.wisc.edu        parser.add_option("--bare-metal", action="store_true",
1778920Snilay@cs.wisc.edu                   help="Provide the raw system without the linux specific bits")
1788920Snilay@cs.wisc.edu        parser.add_option("--machine-type", action="store", type="choice",
1798920Snilay@cs.wisc.edu                choices=ArmMachineType.map.keys(), default="RealView_PBX")
1809539Satgutier@umich.edu        parser.add_option("--dtb-filename", action="store", type="string",
1819539Satgutier@umich.edu              help="Specifies device tree blob file to use with device-tree-"\
1829539Satgutier@umich.edu              "enabled kernels")
1838920Snilay@cs.wisc.edu    # Benchmark options
1848920Snilay@cs.wisc.edu    parser.add_option("--dual", action="store_true",
1858920Snilay@cs.wisc.edu                      help="Simulate two systems attached with an ethernet link")
1868920Snilay@cs.wisc.edu    parser.add_option("-b", "--benchmark", action="store", type="string",
1878920Snilay@cs.wisc.edu                      dest="benchmark",
1888920Snilay@cs.wisc.edu                      help="Specify the benchmark to run. Available benchmarks: %s"\
1898920Snilay@cs.wisc.edu                      % DefinedBenchmarks)
1908920Snilay@cs.wisc.edu
1918920Snilay@cs.wisc.edu    # Metafile options
1928920Snilay@cs.wisc.edu    parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
1938920Snilay@cs.wisc.edu                      help="Specify the filename to dump a pcap capture of the" \
1948920Snilay@cs.wisc.edu                      "ethernet traffic")
1958956Sjayneel@cs.wisc.edu
1968956Sjayneel@cs.wisc.edu    # Disk Image Options
1978956Sjayneel@cs.wisc.edu    parser.add_option("--disk-image", action="store", type="string", default=None,
1988956Sjayneel@cs.wisc.edu                      help="Path to the disk image to use.")
1998956Sjayneel@cs.wisc.edu
2008956Sjayneel@cs.wisc.edu    # Memory Size Options
2018956Sjayneel@cs.wisc.edu    parser.add_option("--mem-size", action="store", type="string", default=None,
2028976Sjayneel@cs.wisc.edu                      help="Specify the physical memory size (single memory)")
203