def createSystem(caches, kernel, bootscript, machine_type="VExpress_GEM5", disks=[]): platform = PlatformConfig.get(machine_type) m5.util.inform("Simulated platform: %s", platform.__name__) sys = devices.SimpleSystem(caches, default_mem_size, platform(), kernel=SysPaths.binary(kernel), readfile=bootscript) sys.mem_ctrls = [ SimpleMemory(range=r, port=sys.membus.master) for r in sys.mem_ranges ] sys.connect() # Attach disk images if disks: def cow_disk(image_file): image = CowDiskImage() image.child.image_file = SysPaths.disk(image_file) return image sys.disk_images = [ cow_disk(f) for f in disks ] sys.pci_vio_block = [ PciVirtIO(vio=VirtIOBlock(image=img)) for img in sys.disk_images ] for dev in sys.pci_vio_block: sys.attach_pci(dev) sys.realview.setupBootLoader(sys.membus, sys, SysPaths.binary) return sys
def addFSOptions(parser): from FSConfig import os_types # Simulation options parser.add_option("--timesync", action="store_true", help="Prevent simulated time from getting ahead of real time") # System options parser.add_option("--kernel", action="store", type="string") parser.add_option("--os-type", action="store", type="choice", choices=os_types[buildEnv['TARGET_ISA']], default="linux", help="Specifies type of OS to boot") parser.add_option("--script", action="store", type="string") parser.add_option("--frame-capture", action="store_true", help="Stores changed frame buffers from the VNC server to compressed "\ "files in the gem5 output directory") if buildEnv['TARGET_ISA'] == "arm": parser.add_option("--bare-metal", action="store_true", help="Provide the raw system without the linux specific bits") parser.add_option("--list-machine-types", action="callback", callback=_listPlatformTypes, help="List available platform types") parser.add_option("--machine-type", action="store", type="choice", choices=PlatformConfig.platform_names(), default="VExpress_EMM") parser.add_option("--dtb-filename", action="store", type="string", help="Specifies device tree blob file to use with device-tree-"\ "enabled kernels") parser.add_option("--enable-context-switch-stats-dump", \ action="store_true", help="Enable stats dump at context "\ "switches and dump tasks file (required for Streamline)") # Benchmark options parser.add_option("--dual", action="store_true", help="Simulate two systems attached with an ethernet link") parser.add_option("-b", "--benchmark", action="store", type="string", dest="benchmark", help="Specify the benchmark to run. Available benchmarks: %s"\ % DefinedBenchmarks) # Metafile options parser.add_option("--etherdump", action="store", type="string", dest="etherdump", help="Specify the filename to dump a pcap capture of the" \ "ethernet traffic") # Disk Image Options parser.add_option("--disk-image", action="store", type="string", default=None, help="Path to the disk image to use.") parser.add_option("--root-device", action="store", type="string", default=None, help="OS device name for root partition") # Command line options parser.add_option("--command-line", action="store", type="string", default=None, help="Template for the kernel command line.") parser.add_option("--command-line-file", action="store", default=None, type="string", help="File with a template for the kernel command line")
def addOptions(parser): parser.add_argument("--restore-from", type=str, default=None, help="Restore from checkpoint") parser.add_argument("--dtb", type=str, default=None, help="DTB file to load") parser.add_argument("--kernel", type=str, required=True, help="Linux kernel") parser.add_argument("--root", type=str, default="/dev/vda1", help="Specify the kernel CLI root= argument") parser.add_argument("--machine-type", type=str, choices=PlatformConfig.platform_names(), default="VExpress_GEM5", help="Hardware platform class") parser.add_argument("--disk", action="append", type=str, default=[], help="Disks to instantiate") parser.add_argument("--bootscript", type=str, default=default_rcs, help="Linux bootscript") parser.add_argument("--cpu-type", type=str, choices=cpu_types.keys(), default="timing", help="CPU simulation mode. Default: %(default)s") parser.add_argument("--kernel-init", type=str, default="/sbin/init", help="Override init") parser.add_argument("--big-cpus", type=int, default=1, help="Number of big CPUs to instantiate") parser.add_argument("--little-cpus", type=int, default=1, help="Number of little CPUs to instantiate") parser.add_argument("--caches", action="store_true", default=False, help="Instantiate caches") parser.add_argument("--last-cache-level", type=int, default=2, help="Last level of caches (e.g. 3 for L3)") parser.add_argument("--big-cpu-clock", type=str, default="2GHz", help="Big CPU clock frequency") parser.add_argument("--little-cpu-clock", type=str, default="1GHz", help="Little CPU clock frequency") parser.add_argument("--sim-quantum", type=str, default="1ms", help="Simulation quantum for parallel simulation. " \ "Default: %(default)s") parser.add_argument("-P", "--param", action="append", default=[], help="Set a SimObject parameter relative to the root node. " "An extended Python multi range slicing syntax can be used " "for arrays. For example: " "'system.cpu[0,1,3:8:2].max_insts_all_threads = 42' " "sets max_insts_all_threads for cpus 0, 1, 3, 5 and 7 " "Direct parameters of the root object are not accessible, " "only parameters of its children.") return parser
def _listPlatformTypes(option, opt, value, parser): PlatformConfig.print_platform_list() sys.exit(0)
def addFSOptions(parser): from FSConfig import os_types # Simulation options parser.add_option("--timesync", action="store_true", help="Prevent simulated time from getting ahead of real time") # System options parser.add_option("--kernel", action="store", type="string") parser.add_option("--os-type", action="store", type="choice", choices=os_types[buildEnv['TARGET_ISA']], default="linux", help="Specifies type of OS to boot") parser.add_option("--script", action="store", type="string") parser.add_option("--frame-capture", action="store_true", help="Stores changed frame buffers from the VNC server to compressed "\ "files in the gem5 output directory") if buildEnv['TARGET_ISA'] == "arm": parser.add_option("--bare-metal", action="store_true", help="Provide the raw system without the linux specific bits") parser.add_option("--list-machine-types", action="callback", callback=_listPlatformTypes, help="List available platform types") parser.add_option("--machine-type", action="store", type="choice", choices=PlatformConfig.platform_names(), default="VExpress_EMM") parser.add_option("--dtb-filename", action="store", type="string", help="Specifies device tree blob file to use with device-tree-"\ "enabled kernels") parser.add_option("--enable-security-extensions", action="store_true", help="Turn on the ARM Security Extensions") parser.add_option("--enable-context-switch-stats-dump", \ action="store_true", help="Enable stats dump at context "\ "switches and dump tasks file (required for Streamline)") # Benchmark options parser.add_option("--dual", action="store_true", help="Simulate two systems attached with an ethernet link") parser.add_option("-b", "--benchmark", action="store", type="string", dest="benchmark", help="Specify the benchmark to run. Available benchmarks: %s"\ % DefinedBenchmarks) # Metafile options parser.add_option("--etherdump", action="store", type="string", dest="etherdump", help="Specify the filename to dump a pcap capture of the" \ "ethernet traffic") #COSSIM Options parser.add_option("--cossim", action="store_true", help="COSSIM distributed gem5 simulation.") parser.add_option("--nodeNum", action="store", type="int", dest="nodeNum", default=0, help="Specify the number of node") parser.add_option("--SynchTime", action="store", type="string", dest="SynchTime", help="Specify the Synchronization Time. For example: --SynchTime=1ms") parser.add_option("--RxPacketTime", action="store", type="string", dest="RxPacketTime", help="Specify the minimum time in which the node can accept packet from the OMNET++. For example: --SynchTime=1ms") parser.add_option("--TotalNodes", action="store", type="int", dest="TotalNodes", help="Specify the total number of nodes") parser.add_option("--mcpat-xml", action="store", type="string", default="empty", dest="McPATXml", help="Specify the McPAT xml ProcessorDescriptionFile") # Disk Image Options parser.add_option("--disk-image", action="store", type="string", default=None, help="Path to the disk image to use.") parser.add_option("--root-device", action="store", type="string", default=None, help="OS device name for root partition") # Command line options parser.add_option("--command-line", action="store", type="string", default=None, help="Template for the kernel command line.") parser.add_option("--command-line-file", action="store", default=None, type="string", help="File with a template for the kernel command line")