Options.py revision 8956:1df031399919
17119SN/A# Copyright (c) 2006-2008 The Regents of The University of Michigan
27119SN/A# All rights reserved.
312219Snikos.nikoleris@arm.com#
47119SN/A# Redistribution and use in source and binary forms, with or without
57119SN/A# modification, are permitted provided that the following conditions are
67119SN/A# met: redistributions of source code must retain the above copyright
77119SN/A# notice, this list of conditions and the following disclaimer;
87119SN/A# redistributions in binary form must reproduce the above copyright
97119SN/A# notice, this list of conditions and the following disclaimer in the
107119SN/A# documentation and/or other materials provided with the distribution;
117119SN/A# neither the name of the copyright holders nor the names of its
127119SN/A# contributors may be used to endorse or promote products derived from
137119SN/A# this software without specific prior written permission.
147119SN/A#
157119SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
167119SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
177119SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
187119SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
197119SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
207119SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
217119SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
227119SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
237119SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
247119SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
257119SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
267119SN/A#
277119SN/A# Authors: Lisa Hsu
287119SN/A
297119SN/Aimport m5
307119SN/Afrom m5.defines import buildEnv
317119SN/Afrom m5.objects import *
327119SN/Afrom Benchmarks import *
337119SN/A
347119SN/Adef addCommonOptions(parser):
357119SN/A    # system options
367119SN/A    parser.add_option("--cpu-type", type="choice", default="atomic",
377119SN/A                      choices = ["atomic", "timing", "detailed", "inorder",
387119SN/A                                 "arm_detailed"],
397119SN/A                      help = "type of cpu to run with")
407119SN/A    parser.add_option("--checker", action="store_true");
4110037SARM gem5 Developers    parser.add_option("-n", "--num-cpus", type="int", default=1)
427119SN/A    parser.add_option("--caches", action="store_true")
437119SN/A    parser.add_option("--l2cache", action="store_true")
447119SN/A    parser.add_option("--fastmem", action="store_true")
457119SN/A    parser.add_option("--clock", action="store", type="string", default='2GHz')
467119SN/A    parser.add_option("--num-dirs", type="int", default=1)
477590Sgblack@eecs.umich.edu    parser.add_option("--num-l2caches", type="int", default=1)
487590Sgblack@eecs.umich.edu    parser.add_option("--num-l3caches", type="int", default=1)
497119SN/A    parser.add_option("--l1d_size", type="string", default="64kB")
507590Sgblack@eecs.umich.edu    parser.add_option("--l1i_size", type="string", default="32kB")
518069SMatt.Horsnell@arm.com    parser.add_option("--l2_size", type="string", default="2MB")
528069SMatt.Horsnell@arm.com    parser.add_option("--l3_size", type="string", default="16MB")
537590Sgblack@eecs.umich.edu    parser.add_option("--l1d_assoc", type="int", default=2)
547590Sgblack@eecs.umich.edu    parser.add_option("--l1i_assoc", type="int", default=2)
557590Sgblack@eecs.umich.edu    parser.add_option("--l2_assoc", type="int", default=8)
567590Sgblack@eecs.umich.edu    parser.add_option("--l3_assoc", type="int", default=16)
577590Sgblack@eecs.umich.edu    parser.add_option("--cacheline_size", type="int", default=64)
587590Sgblack@eecs.umich.edu    parser.add_option("--ruby", action="store_true")
597590Sgblack@eecs.umich.edu
607590Sgblack@eecs.umich.edu    # Run duration options
617590Sgblack@eecs.umich.edu    parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick,
627590Sgblack@eecs.umich.edu                      metavar="T", help="Stop after T ticks")
638069SMatt.Horsnell@arm.com    parser.add_option("--maxtime", type="float")
647590Sgblack@eecs.umich.edu    parser.add_option("-I", "--maxinsts", action="store", type="int",
657590Sgblack@eecs.umich.edu                      default=None, help="""Total number of instructions to
667590Sgblack@eecs.umich.edu                                            simulate (default: run forever)""")
677590Sgblack@eecs.umich.edu    parser.add_option("--work-item-id", action="store", type="int",
687590Sgblack@eecs.umich.edu                      help="the specific work id for exit & checkpointing")
697590Sgblack@eecs.umich.edu    parser.add_option("--work-begin-cpu-id-exit", action="store", type="int",
707590Sgblack@eecs.umich.edu                      help="exit when work starts on the specified cpu")
717590Sgblack@eecs.umich.edu    parser.add_option("--work-end-exit-count", action="store", type="int",
727646Sgene.wu@arm.com                      help="exit at specified work end count")
737590Sgblack@eecs.umich.edu    parser.add_option("--work-begin-exit-count", action="store", type="int",
747590Sgblack@eecs.umich.edu                      help="exit at specified work begin count")
757590Sgblack@eecs.umich.edu    parser.add_option("--init-param", action="store", type="int", default=0,
767590Sgblack@eecs.umich.edu                      help="""Parameter available in simulation with m5
777590Sgblack@eecs.umich.edu                              initparam""")
787590Sgblack@eecs.umich.edu
797590Sgblack@eecs.umich.edu    # Checkpointing options
807590Sgblack@eecs.umich.edu    ###Note that performing checkpointing via python script files will override
8110037SARM gem5 Developers    ###checkpoint instructions built into binaries.
8210037SARM gem5 Developers    parser.add_option("--take-checkpoints", action="store", type="string",
8310037SARM gem5 Developers        help="<M,N> will take checkpoint at cycle M and every N cycles thereafter")
847590Sgblack@eecs.umich.edu    parser.add_option("--max-checkpoints", action="store", type="int",
857590Sgblack@eecs.umich.edu        help="the maximum number of checkpoints to drop", default=5)
867590Sgblack@eecs.umich.edu    parser.add_option("--checkpoint-dir", action="store", type="string",
877590Sgblack@eecs.umich.edu        help="Place all checkpoints in this absolute directory")
887590Sgblack@eecs.umich.edu    parser.add_option("-r", "--checkpoint-restore", action="store", type="int",
897590Sgblack@eecs.umich.edu        help="restore from checkpoint <N>")
907590Sgblack@eecs.umich.edu    parser.add_option("--checkpoint-at-end", action="store_true",
917590Sgblack@eecs.umich.edu                      help="take a checkpoint at end of run")
927590Sgblack@eecs.umich.edu    parser.add_option("--work-begin-checkpoint-count", action="store", type="int",
937590Sgblack@eecs.umich.edu                      help="checkpoint at specified work begin count")
947590Sgblack@eecs.umich.edu    parser.add_option("--work-end-checkpoint-count", action="store", type="int",
957590Sgblack@eecs.umich.edu                      help="checkpoint at specified work end count")
967590Sgblack@eecs.umich.edu    parser.add_option("--work-cpus-checkpoint-count", action="store", type="int",
977590Sgblack@eecs.umich.edu                      help="checkpoint and exit when active cpu count is reached")
987590Sgblack@eecs.umich.edu    parser.add_option("--restore-with-cpu", action="store", type="choice",
997590Sgblack@eecs.umich.edu                      default="atomic", choices = ["atomic", "timing",
1007590Sgblack@eecs.umich.edu                                                   "detailed", "inorder"],
1017590Sgblack@eecs.umich.edu                      help = "cpu type for restoring from a checkpoint")
1027590Sgblack@eecs.umich.edu
1037590Sgblack@eecs.umich.edu
1047590Sgblack@eecs.umich.edu    # CPU Switching - default switch model goes from a checkpoint
1057590Sgblack@eecs.umich.edu    # to a timing simple CPU with caches to warm up, then to detailed CPU for
1067590Sgblack@eecs.umich.edu    # data measurement
1077590Sgblack@eecs.umich.edu    parser.add_option("-s", "--standard-switch", action="store_true",
1087590Sgblack@eecs.umich.edu        help="switch from timing CPU to Detailed CPU")
1097590Sgblack@eecs.umich.edu    parser.add_option("-w", "--warmup", action="store", type="int",
1107590Sgblack@eecs.umich.edu        help="if -s, then this is the warmup period.  else, this is ignored",
1117590Sgblack@eecs.umich.edu        default=5000000000)
1127590Sgblack@eecs.umich.edu    parser.add_option("-p", "--prog-interval", type="int",
1137590Sgblack@eecs.umich.edu        help="CPU Progress Interval")
1147590Sgblack@eecs.umich.edu
1157590Sgblack@eecs.umich.edu    # Fastforwarding and simpoint related materials
1168588Sgblack@eecs.umich.edu    parser.add_option("-W", "--warmup-insts", action="store", type="int",
1178588Sgblack@eecs.umich.edu        default=None,
1187590Sgblack@eecs.umich.edu        help="Warmup period in total instructions (requires --standard-switch)")
1197590Sgblack@eecs.umich.edu    parser.add_option("--bench", action="store", type="string", default=None,
1207590Sgblack@eecs.umich.edu        help="base names for --take-checkpoint and --checkpoint-restore")
1217590Sgblack@eecs.umich.edu    parser.add_option("-F", "--fast-forward", action="store", type="string",
1227590Sgblack@eecs.umich.edu        default=None,
1237590Sgblack@eecs.umich.edu        help="Number of instructions to fast forward before switching")
1247590Sgblack@eecs.umich.edu    parser.add_option("-S", "--simpoint", action="store_true", default=False,
1257590Sgblack@eecs.umich.edu        help="""Use workload simpoints as an instruction offset for
1267590Sgblack@eecs.umich.edu                --checkpoint-restore or --take-checkpoint.""")
1277746SAli.Saidi@ARM.com    parser.add_option("--at-instruction", action="store_true", default=False,
1287746SAli.Saidi@ARM.com        help="""Treat value of --checkpoint-restore or --take-checkpoint as a
1297746SAli.Saidi@ARM.com                number of instructions.""")
1307746SAli.Saidi@ARM.com
1317746SAli.Saidi@ARM.comdef addSEOptions(parser):
1327746SAli.Saidi@ARM.com    # Benchmark options
1337746SAli.Saidi@ARM.com    parser.add_option("-c", "--cmd", default="",
1347590Sgblack@eecs.umich.edu                      help="The binary to run in syscall emulation mode.")
1357590Sgblack@eecs.umich.edu    parser.add_option("-o", "--options", default="",
1367590Sgblack@eecs.umich.edu                      help="""The options to pass to the binary, use " "
1377590Sgblack@eecs.umich.edu                              around the entire string""")
1387746SAli.Saidi@ARM.com    parser.add_option("-i", "--input", default="",
1397590Sgblack@eecs.umich.edu                      help="Read stdin from a file.")
1407590Sgblack@eecs.umich.edu    parser.add_option("--output", default="",
1417590Sgblack@eecs.umich.edu                      help="Redirect stdout to a file.")
1427590Sgblack@eecs.umich.edu    parser.add_option("--errout", default="",
1437590Sgblack@eecs.umich.edu                      help="Redirect stderr to a file.")
1447590Sgblack@eecs.umich.edu
1457590Sgblack@eecs.umich.edudef addFSOptions(parser):
1467590Sgblack@eecs.umich.edu    # Simulation options
1477590Sgblack@eecs.umich.edu    parser.add_option("--timesync", action="store_true",
1487590Sgblack@eecs.umich.edu            help="Prevent simulated time from getting ahead of real time")
1497646Sgene.wu@arm.com
1507646Sgene.wu@arm.com    # System options
1517646Sgene.wu@arm.com    parser.add_option("--kernel", action="store", type="string")
1527646Sgene.wu@arm.com    parser.add_option("--script", action="store", type="string")
1537646Sgene.wu@arm.com    parser.add_option("--frame-capture", action="store_true",
1547590Sgblack@eecs.umich.edu            help="Stores changed frame buffers from the VNC server to compressed "\
1557590Sgblack@eecs.umich.edu            "files in the gem5 output directory")
1567590Sgblack@eecs.umich.edu
1577590Sgblack@eecs.umich.edu    if buildEnv['TARGET_ISA'] == "arm":
1588304SAli.Saidi@ARM.com        parser.add_option("--bare-metal", action="store_true",
1597646Sgene.wu@arm.com                   help="Provide the raw system without the linux specific bits")
1607646Sgene.wu@arm.com        parser.add_option("--machine-type", action="store", type="choice",
1617646Sgene.wu@arm.com                choices=ArmMachineType.map.keys(), default="RealView_PBX")
1627646Sgene.wu@arm.com    # Benchmark options
1637646Sgene.wu@arm.com    parser.add_option("--dual", action="store_true",
1647646Sgene.wu@arm.com                      help="Simulate two systems attached with an ethernet link")
1657646Sgene.wu@arm.com    parser.add_option("-b", "--benchmark", action="store", type="string",
1667646Sgene.wu@arm.com                      dest="benchmark",
1677590Sgblack@eecs.umich.edu                      help="Specify the benchmark to run. Available benchmarks: %s"\
1687590Sgblack@eecs.umich.edu                      % DefinedBenchmarks)
1697590Sgblack@eecs.umich.edu
1707590Sgblack@eecs.umich.edu    # Metafile options
1717590Sgblack@eecs.umich.edu    parser.add_option("--etherdump", action="store", type="string", dest="etherdump",
1727590Sgblack@eecs.umich.edu                      help="Specify the filename to dump a pcap capture of the" \
1737590Sgblack@eecs.umich.edu                      "ethernet traffic")
1747590Sgblack@eecs.umich.edu
1757590Sgblack@eecs.umich.edu    # Disk Image Options
1767590Sgblack@eecs.umich.edu    parser.add_option("--disk-image", action="store", type="string", default=None,
17710037SARM gem5 Developers                      help="Path to the disk image to use.")
1787590Sgblack@eecs.umich.edu
1797590Sgblack@eecs.umich.edu    # Memory Size Options
1807590Sgblack@eecs.umich.edu    parser.add_option("--mem-size", action="store", type="string", default=None,
1817590Sgblack@eecs.umich.edu                      help="Path to the disk image to use.")
1827590Sgblack@eecs.umich.edu