1# Copyright (c) 2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright 9# notice, this list of conditions and the following disclaimer in the 10# documentation and/or other materials provided with the distribution; 11# neither the name of the copyright holders nor the names of its 12# contributors may be used to endorse or promote products derived from 13# this software without specific prior written permission. 14# 15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26# 27# Authors: Nathan Binkert 28 29import code 30import datetime 31import os 32import socket 33import sys 34 35from util import attrdict 36import config 37from options import OptionParser 38 39__all__ = [ 'options', 'arguments', 'main' ] 40 41def print_list(items, indent=4): 42 line = ' ' * indent 43 for i,item in enumerate(items): 44 if len(line) + len(item) > 76: 45 print line 46 line = ' ' * indent 47 48 if i < len(items) - 1: 49 line += '%s, ' % item 50 else: 51 line += item 52 print line 53 54usage="%prog [m5 options] script.py [script options]" 55version="%prog 2.0" 56brief_copyright=''' 57Copyright (c) 2001-2008 58The Regents of The University of Michigan 59All Rights Reserved 60''' 61 62options = OptionParser(usage=usage, version=version, 63 description=brief_copyright) 64add_option = options.add_option 65set_group = options.set_group 66usage = options.usage 67 68# Help options 69add_option('-A', "--authors", action="store_true", default=False, 70 help="Show author information") 71add_option('-B', "--build-info", action="store_true", default=False, 72 help="Show build information") 73add_option('-C', "--copyright", action="store_true", default=False, 74 help="Show full copyright information") 75add_option('-R', "--readme", action="store_true", default=False, 76 help="Show the readme") 77add_option('-N', "--release-notes", action="store_true", default=False, 78 help="Show the release notes") 79 80# Options for configuring the base simulator 81add_option('-d', "--outdir", metavar="DIR", default="m5out", 82 help="Set the output directory to DIR [Default: %default]") 83add_option('-r', "--redirect-stdout", action="store_true", default=False, 84 help="Redirect stdout (& stderr, without -e) to file") 85add_option('-e', "--redirect-stderr", action="store_true", default=False, 86 help="Redirect stderr to file") 87add_option("--stdout-file", metavar="FILE", default="simout", 88 help="Filename for -r redirection [Default: %default]") 89add_option("--stderr-file", metavar="FILE", default="simerr", 90 help="Filename for -e redirection [Default: %default]") 91add_option('-i', "--interactive", action="store_true", default=False, 92 help="Invoke the interactive interpreter after running the script") 93add_option("--pdb", action="store_true", default=False, 94 help="Invoke the python debugger before running the script") 95add_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', 96 help="Prepend PATH to the system path when invoking the script") 97add_option('-q', "--quiet", action="count", default=0, 98 help="Reduce verbosity") 99add_option('-v', "--verbose", action="count", default=0, 100 help="Increase verbosity") 101 102# Statistics options 103set_group("Statistics Options") 104add_option("--stats-file", metavar="FILE", default="stats.txt", 105 help="Sets the output file for statistics [Default: %default]") 106 107# Configuration Options 108set_group("Configuration Options") 109add_option("--dump-config", metavar="FILE", default="config.ini", 110 help="Dump configuration output file [Default: %default]") 111 112# Debugging options 113set_group("Debugging Options") 114add_option("--debug-break", metavar="TIME[,TIME]", action='append', split=',', 115 help="Cycle to create a breakpoint") 116add_option("--remote-gdb-port", type='int', default=7000, 117 help="Remote gdb base port") 118 119# Tracing options 120set_group("Trace Options") 121add_option("--trace-help", action='store_true', 122 help="Print help on trace flags") 123add_option("--trace-flags", metavar="FLAG[,FLAG]", action='append', split=',', 124 help="Sets the flags for tracing (-FLAG disables a flag)") 125add_option("--trace-start", metavar="TIME", type='int', 126 help="Start tracing at TIME (must be in ticks)") 127add_option("--trace-file", metavar="FILE", default="cout", 128 help="Sets the output file for tracing [Default: %default]") 129add_option("--trace-ignore", metavar="EXPR", action='append', split=':', 130 help="Ignore EXPR sim objects") 131 132# Help options 133set_group("Help Options") 134add_option("--list-sim-objects", action='store_true', default=False, 135 help="List all built-in SimObjects, their parameters and default values") 136 137def main(): 138 import event 139 import info 140 import internal
| 1# Copyright (c) 2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright 9# notice, this list of conditions and the following disclaimer in the 10# documentation and/or other materials provided with the distribution; 11# neither the name of the copyright holders nor the names of its 12# contributors may be used to endorse or promote products derived from 13# this software without specific prior written permission. 14# 15# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 16# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 17# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 18# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 19# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 20# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 21# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 23# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26# 27# Authors: Nathan Binkert 28 29import code 30import datetime 31import os 32import socket 33import sys 34 35from util import attrdict 36import config 37from options import OptionParser 38 39__all__ = [ 'options', 'arguments', 'main' ] 40 41def print_list(items, indent=4): 42 line = ' ' * indent 43 for i,item in enumerate(items): 44 if len(line) + len(item) > 76: 45 print line 46 line = ' ' * indent 47 48 if i < len(items) - 1: 49 line += '%s, ' % item 50 else: 51 line += item 52 print line 53 54usage="%prog [m5 options] script.py [script options]" 55version="%prog 2.0" 56brief_copyright=''' 57Copyright (c) 2001-2008 58The Regents of The University of Michigan 59All Rights Reserved 60''' 61 62options = OptionParser(usage=usage, version=version, 63 description=brief_copyright) 64add_option = options.add_option 65set_group = options.set_group 66usage = options.usage 67 68# Help options 69add_option('-A', "--authors", action="store_true", default=False, 70 help="Show author information") 71add_option('-B', "--build-info", action="store_true", default=False, 72 help="Show build information") 73add_option('-C', "--copyright", action="store_true", default=False, 74 help="Show full copyright information") 75add_option('-R', "--readme", action="store_true", default=False, 76 help="Show the readme") 77add_option('-N', "--release-notes", action="store_true", default=False, 78 help="Show the release notes") 79 80# Options for configuring the base simulator 81add_option('-d', "--outdir", metavar="DIR", default="m5out", 82 help="Set the output directory to DIR [Default: %default]") 83add_option('-r', "--redirect-stdout", action="store_true", default=False, 84 help="Redirect stdout (& stderr, without -e) to file") 85add_option('-e', "--redirect-stderr", action="store_true", default=False, 86 help="Redirect stderr to file") 87add_option("--stdout-file", metavar="FILE", default="simout", 88 help="Filename for -r redirection [Default: %default]") 89add_option("--stderr-file", metavar="FILE", default="simerr", 90 help="Filename for -e redirection [Default: %default]") 91add_option('-i', "--interactive", action="store_true", default=False, 92 help="Invoke the interactive interpreter after running the script") 93add_option("--pdb", action="store_true", default=False, 94 help="Invoke the python debugger before running the script") 95add_option('-p', "--path", metavar="PATH[:PATH]", action='append', split=':', 96 help="Prepend PATH to the system path when invoking the script") 97add_option('-q', "--quiet", action="count", default=0, 98 help="Reduce verbosity") 99add_option('-v', "--verbose", action="count", default=0, 100 help="Increase verbosity") 101 102# Statistics options 103set_group("Statistics Options") 104add_option("--stats-file", metavar="FILE", default="stats.txt", 105 help="Sets the output file for statistics [Default: %default]") 106 107# Configuration Options 108set_group("Configuration Options") 109add_option("--dump-config", metavar="FILE", default="config.ini", 110 help="Dump configuration output file [Default: %default]") 111 112# Debugging options 113set_group("Debugging Options") 114add_option("--debug-break", metavar="TIME[,TIME]", action='append', split=',', 115 help="Cycle to create a breakpoint") 116add_option("--remote-gdb-port", type='int', default=7000, 117 help="Remote gdb base port") 118 119# Tracing options 120set_group("Trace Options") 121add_option("--trace-help", action='store_true', 122 help="Print help on trace flags") 123add_option("--trace-flags", metavar="FLAG[,FLAG]", action='append', split=',', 124 help="Sets the flags for tracing (-FLAG disables a flag)") 125add_option("--trace-start", metavar="TIME", type='int', 126 help="Start tracing at TIME (must be in ticks)") 127add_option("--trace-file", metavar="FILE", default="cout", 128 help="Sets the output file for tracing [Default: %default]") 129add_option("--trace-ignore", metavar="EXPR", action='append', split=':', 130 help="Ignore EXPR sim objects") 131 132# Help options 133set_group("Help Options") 134add_option("--list-sim-objects", action='store_true', default=False, 135 help="List all built-in SimObjects, their parameters and default values") 136 137def main(): 138 import event 139 import info 140 import internal
|