diff --git a/configs/common/CpuConfig.py b/configs/common/CpuConfig.py index 3220acecd..757ec2d08 100644 --- a/configs/common/CpuConfig.py +++ b/configs/common/CpuConfig.py @@ -70,7 +70,7 @@ def is_cpu_class(cls): return issubclass(cls, m5.objects.BaseCPU) and \ not cls.abstract and \ not issubclass(cls, m5.objects.CheckerCPU) - except TypeError: + except (TypeError, AttributeError): return False def get(name): diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py index c1d8f6fe0..3a169a4bb 100644 --- a/configs/common/FSConfig.py +++ b/configs/common/FSConfig.py @@ -42,7 +42,7 @@ from m5.objects import * from Benchmarks import * from m5.util import * -import PlatformConfig +from common import PlatformConfig # Populate to reflect supported os types per target ISA os_types = { 'alpha' : [ 'linux' ], diff --git a/configs/common/Options.py b/configs/common/Options.py index 5bed98aca..16d817f59 100644 --- a/configs/common/Options.py +++ b/configs/common/Options.py @@ -41,13 +41,11 @@ import m5 from m5.defines import buildEnv from m5.objects import * -from Benchmarks import * +from common.Benchmarks import * -import CpuConfig -import MemConfig -import PlatformConfig - -from FSConfig import os_types +from common import CpuConfig +from common import MemConfig +from common import PlatformConfig def _listCpuTypes(option, opt, value, parser): CpuConfig.print_cpu_list() @@ -61,15 +59,10 @@ def _listPlatformTypes(option, opt, value, parser): PlatformConfig.print_platform_list() sys.exit(0) -def addCommonOptions(parser): - # system options - parser.add_option("--list-cpu-types", - action="callback", callback=_listCpuTypes, - help="List available CPU types") - parser.add_option("--cpu-type", type="choice", default="atomic", - choices=CpuConfig.cpu_names(), - help = "type of cpu to run with") - parser.add_option("--checker", action="store_true"); +# Add the very basic options that work also in the case of the no ISA +# being used, and consequently no CPUs, but rather various types of +# testers and traffic generators. +def addNoISAOptions(parser): parser.add_option("-n", "--num-cpus", type="int", default=1) parser.add_option("--sys-voltage", action="store", type="string", default='1.0V', @@ -79,6 +72,73 @@ def addCommonOptions(parser): default='1GHz', help = """Top-level clock for blocks running at system speed""") + + # Memory Options + parser.add_option("--list-mem-types", + action="callback", callback=_listMemTypes, + help="List available memory types") + parser.add_option("--mem-type", type="choice", default="DDR3_1600_x64", + choices=MemConfig.mem_names(), + help = "type of memory to use") + parser.add_option("--mem-channels", type="int", default=1, + help = "number of memory channels") + parser.add_option("--mem-ranks", type="int", default=None, + help = "number of memory ranks per channel") + parser.add_option("--mem-size", action="store", type="string", + default="512MB", + help="Specify the physical memory size (single memory)") + + + parser.add_option("--memchecker", action="store_true") + + # Cache Options + parser.add_option("--external-memory-system", type="string", + help="use external ports of this port_type for caches") + parser.add_option("--tlm-memory", type="string", + help="use external port for SystemC TLM cosimulation") + parser.add_option("--caches", action="store_true") + parser.add_option("--l2cache", action="store_true") + parser.add_option("--num-dirs", type="int", default=1) + parser.add_option("--num-l2caches", type="int", default=1) + parser.add_option("--num-l3caches", type="int", default=1) + parser.add_option("--l1d_size", type="string", default="64kB") + parser.add_option("--l1i_size", type="string", default="32kB") + parser.add_option("--l2_size", type="string", default="2MB") + parser.add_option("--l3_size", type="string", default="16MB") + parser.add_option("--l1d_assoc", type="int", default=2) + parser.add_option("--l1i_assoc", type="int", default=2) + parser.add_option("--l2_assoc", type="int", default=8) + parser.add_option("--l3_assoc", type="int", default=16) + parser.add_option("--cacheline_size", type="int", default=64) + + # Enable Ruby + parser.add_option("--ruby", action="store_true") + + # Run duration options + parser.add_option("-m", "--abs-max-tick", type="int", default=m5.MaxTick, + metavar="TICKS", help="Run to absolute simulated tick " + "specified including ticks from a restored checkpoint") + parser.add_option("--rel-max-tick", type="int", default=None, + metavar="TICKS", help="Simulate for specified number of" + " ticks relative to the simulation start tick (e.g. if " + "restoring a checkpoint)") + parser.add_option("--maxtime", type="float", default=None, + help="Run to the specified absolute simulated time in " + "seconds") + +# Add common options that assume a non-NULL ISA. +def addCommonOptions(parser): + # start by adding the base options that do not assume an ISA + addNoISAOptions(parser) + + # system options + parser.add_option("--list-cpu-types", + action="callback", callback=_listCpuTypes, + help="List available CPU types") + parser.add_option("--cpu-type", type="choice", default="atomic", + choices=CpuConfig.cpu_names(), + help = "type of cpu to run with") + parser.add_option("--checker", action="store_true"); parser.add_option("--cpu-clock", action="store", type="string", default='2GHz', help="Clock for blocks running at CPU speed") @@ -101,46 +161,10 @@ def addCommonOptions(parser): Elastic Trace probe in a capture simulation and Trace CPU in a replay simulation""", default="") - # Memory Options - parser.add_option("--list-mem-types", - action="callback", callback=_listMemTypes, - help="List available memory types") - parser.add_option("--mem-type", type="choice", default="DDR3_1600_x64", - choices=MemConfig.mem_names(), - help = "type of memory to use") - parser.add_option("--mem-channels", type="int", default=1, - help = "number of memory channels") - parser.add_option("--mem-ranks", type="int", default=None, - help = "number of memory ranks per channel") - parser.add_option("--mem-size", action="store", type="string", - default="512MB", - help="Specify the physical memory size (single memory)") - parser.add_option("-l", "--lpae", action="store_true") parser.add_option("-V", "--virtualisation", action="store_true") - parser.add_option("--memchecker", action="store_true") - - # Cache Options - parser.add_option("--external-memory-system", type="string", - help="use external ports of this port_type for caches") - parser.add_option("--tlm-memory", type="string", - help="use external port for SystemC TLM cosimulation") - parser.add_option("--caches", action="store_true") - parser.add_option("--l2cache", action="store_true") parser.add_option("--fastmem", action="store_true") - parser.add_option("--num-dirs", type="int", default=1) - parser.add_option("--num-l2caches", type="int", default=1) - parser.add_option("--num-l3caches", type="int", default=1) - parser.add_option("--l1d_size", type="string", default="64kB") - parser.add_option("--l1i_size", type="string", default="32kB") - parser.add_option("--l2_size", type="string", default="2MB") - parser.add_option("--l3_size", type="string", default="16MB") - parser.add_option("--l1d_assoc", type="int", default=2) - parser.add_option("--l1i_assoc", type="int", default=2) - parser.add_option("--l2_assoc", type="int", default=8) - parser.add_option("--l3_assoc", type="int", default=16) - parser.add_option("--cacheline_size", type="int", default=64) # dist-gem5 options parser.add_option("--dist", action="store_true", @@ -175,20 +199,7 @@ def addCommonOptions(parser): action="store", type="string", help="Link delay in seconds\nDEFAULT: 10us") - # Enable Ruby - parser.add_option("--ruby", action="store_true") - # Run duration options - parser.add_option("-m", "--abs-max-tick", type="int", default=m5.MaxTick, - metavar="TICKS", help="Run to absolute simulated tick " \ - "specified including ticks from a restored checkpoint") - parser.add_option("--rel-max-tick", type="int", default=None, - metavar="TICKS", help="Simulate for specified number of" \ - " ticks relative to the simulation start tick (e.g. if " \ - "restoring a checkpoint)") - parser.add_option("--maxtime", type="float", default=None, - help="Run to the specified absolute simulated time in " \ - "seconds") parser.add_option("-I", "--maxinsts", action="store", type="int", default=None, help="""Total number of instructions to simulate (default: run forever)""") @@ -297,6 +308,8 @@ def addSEOptions(parser): help="Redirect stderr to a file.") 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") diff --git a/configs/common/PlatformConfig.py b/configs/common/PlatformConfig.py index 1d047b118..3541c07fb 100644 --- a/configs/common/PlatformConfig.py +++ b/configs/common/PlatformConfig.py @@ -63,7 +63,7 @@ def is_platform_class(cls): try: return issubclass(cls, m5.objects.Platform) and \ not cls.abstract - except TypeError: + except (TypeError, AttributeError): return False def get(name): diff --git a/configs/common/Simulation.py b/configs/common/Simulation.py index b18d65cbc..c4d5c9644 100644 --- a/configs/common/Simulation.py +++ b/configs/common/Simulation.py @@ -43,8 +43,8 @@ import sys from os import getcwd from os.path import join as joinpath -import CpuConfig -import MemConfig +from common import CpuConfig +from common import MemConfig import m5 from m5.defines import buildEnv diff --git a/configs/example/garnet_synth_traffic.py b/configs/example/garnet_synth_traffic.py index 16617486d..0cb1fae9f 100644 --- a/configs/example/garnet_synth_traffic.py +++ b/configs/example/garnet_synth_traffic.py @@ -43,7 +43,7 @@ config_root = os.path.dirname(config_path) m5_root = os.path.dirname(config_root) parser = optparse.OptionParser() -Options.addCommonOptions(parser) +Options.addNoISAOptions(parser) parser.add_option("--synthetic", type="choice", default="uniform_random", choices=['uniform_random', 'tornado', 'bit_complement', \ diff --git a/configs/example/ruby_direct_test.py b/configs/example/ruby_direct_test.py index 1c02e6e55..9e8c87a81 100644 --- a/configs/example/ruby_direct_test.py +++ b/configs/example/ruby_direct_test.py @@ -45,7 +45,7 @@ config_root = os.path.dirname(config_path) m5_root = os.path.dirname(config_root) parser = optparse.OptionParser() -Options.addCommonOptions(parser) +Options.addNoISAOptions(parser) parser.add_option("--requests", metavar="N", default=100, help="Stop after N requests") diff --git a/configs/example/ruby_gpu_random_test.py b/configs/example/ruby_gpu_random_test.py index 08eac583a..80aecf90e 100644 --- a/configs/example/ruby_gpu_random_test.py +++ b/configs/example/ruby_gpu_random_test.py @@ -50,7 +50,7 @@ config_root = os.path.dirname(config_path) m5_root = os.path.dirname(config_root) parser = optparse.OptionParser() -Options.addCommonOptions(parser) +Options.addNoISAOptions(parser) parser.add_option("--maxloads", metavar="N", default=100, help="Stop after N loads") diff --git a/configs/example/ruby_mem_test.py b/configs/example/ruby_mem_test.py index 3b6c5f110..010c4a2bc 100644 --- a/configs/example/ruby_mem_test.py +++ b/configs/example/ruby_mem_test.py @@ -44,7 +44,7 @@ config_path = os.path.dirname(os.path.abspath(__file__)) config_root = os.path.dirname(config_path) parser = optparse.OptionParser() -Options.addCommonOptions(parser) +Options.addNoISAOptions(parser) parser.add_option("--maxloads", metavar="N", default=0, help="Stop after N loads") diff --git a/configs/example/ruby_random_test.py b/configs/example/ruby_random_test.py index ce898cd81..d96905e2c 100644 --- a/configs/example/ruby_random_test.py +++ b/configs/example/ruby_random_test.py @@ -45,7 +45,7 @@ config_root = os.path.dirname(config_path) m5_root = os.path.dirname(config_root) parser = optparse.OptionParser() -Options.addCommonOptions(parser) +Options.addNoISAOptions(parser) parser.add_option("--maxloads", metavar="N", default=100, help="Stop after N loads")