Options.py revision 9539
12SN/A# Copyright (c) 2006-2008 The Regents of The University of Michigan 28733Sgeoffrey.blake@arm.com# All rights reserved. 38733Sgeoffrey.blake@arm.com# 48733Sgeoffrey.blake@arm.com# Redistribution and use in source and binary forms, with or without 58733Sgeoffrey.blake@arm.com# modification, are permitted provided that the following conditions are 68733Sgeoffrey.blake@arm.com# met: redistributions of source code must retain the above copyright 78733Sgeoffrey.blake@arm.com# notice, this list of conditions and the following disclaimer; 88733Sgeoffrey.blake@arm.com# redistributions in binary form must reproduce the above copyright 98733Sgeoffrey.blake@arm.com# notice, this list of conditions and the following disclaimer in the 108733Sgeoffrey.blake@arm.com# documentation and/or other materials provided with the distribution; 118733Sgeoffrey.blake@arm.com# neither the name of the copyright holders nor the names of its 128733Sgeoffrey.blake@arm.com# contributors may be used to endorse or promote products derived from 138733Sgeoffrey.blake@arm.com# this software without specific prior written permission. 142188SN/A# 152SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 162SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 172SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 182SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 192SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 202SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 212SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 222SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 232SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 242SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 252SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 262SN/A# 272SN/A# Authors: Lisa Hsu 282SN/A 292SN/Aimport m5 302SN/Afrom m5.defines import buildEnv 312SN/Afrom m5.objects import * 322SN/Afrom Benchmarks import * 332SN/A 342SN/Aimport CpuConfig 352SN/A 362SN/Adef _listCpuTypes(option, opt, value, parser): 372SN/A CpuConfig.print_cpu_list() 382SN/A sys.exit(0) 392665SN/A 402665SN/Adef addCommonOptions(parser): 412665SN/A # system options 422SN/A parser.add_option("--list-cpu-types", 432SN/A action="callback", callback=_listCpuTypes, 442683Sktlim@umich.edu help="List available CPU types") 452683Sktlim@umich.edu parser.add_option("--cpu-type", type="choice", default="atomic", 462SN/A choices=CpuConfig.cpu_names(), 479020Sgblack@eecs.umich.edu help = "type of cpu to run with") 486313Sgblack@eecs.umich.edu parser.add_option("--checker", action="store_true"); 492190SN/A parser.add_option("-n", "--num-cpus", type="int", default=1) 506329Sgblack@eecs.umich.edu parser.add_option("--caches", action="store_true") 514997Sgblack@eecs.umich.edu parser.add_option("--l2cache", action="store_true") 526316Sgblack@eecs.umich.edu parser.add_option("--fastmem", action="store_true") 536216Snate@binkert.org parser.add_option("--clock", action="store", type="string", default='2GHz') 546658Snate@binkert.org parser.add_option("--num-dirs", type="int", default=1) 552680SN/A parser.add_option("--num-l2caches", type="int", default=1) 562683Sktlim@umich.edu parser.add_option("--num-l3caches", type="int", default=1) 578232Snate@binkert.org parser.add_option("--l1d_size", type="string", default="64kB") 588232Snate@binkert.org parser.add_option("--l1i_size", type="string", default="32kB") 598777Sgblack@eecs.umich.edu parser.add_option("--l2_size", type="string", default="2MB") 602395SN/A parser.add_option("--l3_size", type="string", default="16MB") 612190SN/A parser.add_option("--l1d_assoc", type="int", default=2) 622188SN/A parser.add_option("--l1i_assoc", type="int", default=2) 638777Sgblack@eecs.umich.edu parser.add_option("--l2_assoc", type="int", default=8) 64217SN/A parser.add_option("--l3_assoc", type="int", default=16) 658777Sgblack@eecs.umich.edu parser.add_option("--cacheline_size", type="int", default=64) 662SN/A parser.add_option("--ruby", action="store_true") 672SN/A parser.add_option("--smt", action="store_true", default=False, 688887Sgeoffrey.blake@arm.com help = """ 691070SN/A Only used if multiple programs are specified. If true, 701917SN/A then the number of threads per cpu is same as the 711917SN/A number of programs.""") 722521SN/A 733548Sgblack@eecs.umich.edu # Run duration options 743548Sgblack@eecs.umich.edu parser.add_option("-m", "--maxtick", type="int", default=m5.MaxTick, 753548Sgblack@eecs.umich.edu metavar="T", help="Stop after T ticks") 768902Sandreas.hansson@arm.com parser.add_option("--maxtime", type="float") 778902Sandreas.hansson@arm.com parser.add_option("-I", "--maxinsts", action="store", type="int", 782330SN/A default=None, help="""Total number of instructions to 792683Sktlim@umich.edu simulate (default: run forever)""") 802683Sktlim@umich.edu parser.add_option("--work-item-id", action="store", type="int", 812683Sktlim@umich.edu help="the specific work id for exit & checkpointing") 822683Sktlim@umich.edu parser.add_option("--work-begin-cpu-id-exit", action="store", type="int", 832683Sktlim@umich.edu help="exit when work starts on the specified cpu") 842683Sktlim@umich.edu parser.add_option("--work-end-exit-count", action="store", type="int", 852683Sktlim@umich.edu help="exit at specified work end count") 862683Sktlim@umich.edu parser.add_option("--work-begin-exit-count", action="store", type="int", 872683Sktlim@umich.edu help="exit at specified work begin count") 882683Sktlim@umich.edu parser.add_option("--init-param", action="store", type="int", default=0, 892683Sktlim@umich.edu help="""Parameter available in simulation with m5 902683Sktlim@umich.edu initparam""") 912683Sktlim@umich.edu 922683Sktlim@umich.edu # Checkpointing options 932683Sktlim@umich.edu ###Note that performing checkpointing via python script files will override 942SN/A ###checkpoint instructions built into binaries. 952683Sktlim@umich.edu parser.add_option("--take-checkpoints", action="store", type="string", 962SN/A help="<M,N> take checkpoints at tick M and every N ticks thereafter") 972107SN/A parser.add_option("--max-checkpoints", action="store", type="int", 982107SN/A help="the maximum number of checkpoints to drop", default=5) 992159SN/A parser.add_option("--checkpoint-dir", action="store", type="string", 1002455SN/A help="Place all checkpoints in this absolute directory") 1012455SN/A parser.add_option("-r", "--checkpoint-restore", action="store", type="int", 1022SN/A help="restore from checkpoint <N>") 1032680SN/A parser.add_option("--checkpoint-at-end", action="store_true", 1042SN/A help="take a checkpoint at end of run") 1052190SN/A parser.add_option("--work-begin-checkpoint-count", action="store", type="int", 1066315Sgblack@eecs.umich.edu help="checkpoint at specified work begin count") 1076315Sgblack@eecs.umich.edu parser.add_option("--work-end-checkpoint-count", action="store", type="int", 1086315Sgblack@eecs.umich.edu help="checkpoint at specified work end count") 1096315Sgblack@eecs.umich.edu parser.add_option("--work-cpus-checkpoint-count", action="store", type="int", 1106316Sgblack@eecs.umich.edu help="checkpoint and exit when active cpu count is reached") 1119384SAndreas.Sandberg@arm.com parser.add_option("--restore-with-cpu", action="store", type="choice", 1122SN/A default="atomic", choices = ["atomic", "timing", 1137720Sgblack@eecs.umich.edu "detailed", "inorder"], 1146324Sgblack@eecs.umich.edu help = "cpu type for restoring from a checkpoint") 1157597Sminkyu.jeong@arm.com 1167597Sminkyu.jeong@arm.com 1177597Sminkyu.jeong@arm.com # CPU Switching - default switch model goes from a checkpoint 1182190SN/A # to a timing simple CPU with caches to warm up, then to detailed CPU for 1198357Sksewell@umich.edu # data measurement 1208357Sksewell@umich.edu parser.add_option("--repeat-switch", action="store", type="int", 1218735Sandreas.hanson@arm.com default=None, 1228357Sksewell@umich.edu help="switch back and forth between CPUs with period <N>") 1238357Sksewell@umich.edu parser.add_option("-s", "--standard-switch", action="store", type="int", 1242683Sktlim@umich.edu default=None, 1252188SN/A help="switch from timing to Detailed CPU after warmup period of <N>") 1262378SN/A parser.add_option("-p", "--prog-interval", type="int", 1272400SN/A help="CPU Progress Interval") 1286022Sgblack@eecs.umich.edu 1296022Sgblack@eecs.umich.edu # Fastforwarding and simpoint related materials 1302SN/A parser.add_option("-W", "--warmup-insts", action="store", type="int", 1319020Sgblack@eecs.umich.edu default=None, 1328541Sgblack@eecs.umich.edu help="Warmup period in total instructions (requires --standard-switch)") 1332683Sktlim@umich.edu parser.add_option("--bench", action="store", type="string", default=None, 1348793Sgblack@eecs.umich.edu help="base names for --take-checkpoint and --checkpoint-restore") 1352683Sktlim@umich.edu parser.add_option("-F", "--fast-forward", action="store", type="string", 1369384SAndreas.Sandberg@arm.com default=None, 1372683Sktlim@umich.edu help="Number of instructions to fast forward before switching") 1388793Sgblack@eecs.umich.edu parser.add_option("-S", "--simpoint", action="store_true", default=False, 1398820Sgblack@eecs.umich.edu help="""Use workload simpoints as an instruction offset for 1409384SAndreas.Sandberg@arm.com --checkpoint-restore or --take-checkpoint.""") 1419384SAndreas.Sandberg@arm.com parser.add_option("--at-instruction", action="store_true", default=False, 1422862Sktlim@umich.edu help="""Treat value of --checkpoint-restore or --take-checkpoint as a 1432864Sktlim@umich.edu number of instructions.""") 1442862Sktlim@umich.edu 1452683Sktlim@umich.edudef addSEOptions(parser): 1462SN/A # Benchmark options 1472680SN/A parser.add_option("-c", "--cmd", default="", 148180SN/A help="The binary to run in syscall emulation mode.") 1492SN/A parser.add_option("-o", "--options", default="", 1502SN/A help="""The options to pass to the binary, use " " 1512864Sktlim@umich.edu around the entire string""") 1522864Sktlim@umich.edu parser.add_option("-i", "--input", default="", 1532862Sktlim@umich.edu help="Read stdin from a file.") 1542862Sktlim@umich.edu parser.add_option("--output", default="", 155217SN/A help="Redirect stdout to a file.") 156237SN/A parser.add_option("--errout", default="", 157217SN/A help="Redirect stderr to a file.") 1582683Sktlim@umich.edu 1592683Sktlim@umich.edudef addFSOptions(parser): 1605891Sgblack@eecs.umich.edu # Simulation options 1612683Sktlim@umich.edu parser.add_option("--timesync", action="store_true", 1622190SN/A help="Prevent simulated time from getting ahead of real time") 1632683Sktlim@umich.edu 1642683Sktlim@umich.edu # System options 1652683Sktlim@umich.edu parser.add_option("--kernel", action="store", type="string") 1662683Sktlim@umich.edu parser.add_option("--script", action="store", type="string") 1672680SN/A parser.add_option("--frame-capture", action="store_true", 1682190SN/A help="Stores changed frame buffers from the VNC server to compressed "\ 1695358Sgblack@eecs.umich.edu "files in the gem5 output directory") 1705358Sgblack@eecs.umich.edu 1715358Sgblack@eecs.umich.edu if buildEnv['TARGET_ISA'] == "arm": 1725358Sgblack@eecs.umich.edu parser.add_option("--bare-metal", action="store_true", 1735358Sgblack@eecs.umich.edu help="Provide the raw system without the linux specific bits") 1745358Sgblack@eecs.umich.edu parser.add_option("--machine-type", action="store", type="choice", 1755358Sgblack@eecs.umich.edu choices=ArmMachineType.map.keys(), default="RealView_PBX") 1765358Sgblack@eecs.umich.edu parser.add_option("--dtb-filename", action="store", type="string", 1775358Sgblack@eecs.umich.edu help="Specifies device tree blob file to use with device-tree-"\ 1785358Sgblack@eecs.umich.edu "enabled kernels") 1795358Sgblack@eecs.umich.edu # Benchmark options 1805358Sgblack@eecs.umich.edu parser.add_option("--dual", action="store_true", 1815358Sgblack@eecs.umich.edu help="Simulate two systems attached with an ethernet link") 1825358Sgblack@eecs.umich.edu parser.add_option("-b", "--benchmark", action="store", type="string", 1835358Sgblack@eecs.umich.edu dest="benchmark", 1845358Sgblack@eecs.umich.edu help="Specify the benchmark to run. Available benchmarks: %s"\ 1852683Sktlim@umich.edu % DefinedBenchmarks) 1862521SN/A 1875702Ssaidi@eecs.umich.edu # Metafile options 1885702Ssaidi@eecs.umich.edu parser.add_option("--etherdump", action="store", type="string", dest="etherdump", 1895702Ssaidi@eecs.umich.edu help="Specify the filename to dump a pcap capture of the" \ 1905702Ssaidi@eecs.umich.edu "ethernet traffic") 1912683Sktlim@umich.edu 1922683Sktlim@umich.edu # Disk Image Options 1932683Sktlim@umich.edu parser.add_option("--disk-image", action="store", type="string", default=None, 1942683Sktlim@umich.edu help="Path to the disk image to use.") 1958735Sandreas.hanson@arm.com 1962683Sktlim@umich.edu # Memory Size Options 1976022Sgblack@eecs.umich.edu parser.add_option("--mem-size", action="store", type="string", default=None, 1982683Sktlim@umich.edu help="Specify the physical memory size (single memory)") 1996022Sgblack@eecs.umich.edu