def runFullSystem(): (opts, args) = SimpleOpts.parse_args() kernel, disk, cpu, benchmark, num_cpus = args # Don't init GPU stuff in Ruby if no GPU is specified if opts.dgpu or opts.apu: opts.cpu_only_mode = False else: opts.cpu_only_mode = True # create the system we are going to simulate system = MySystem(kernel, disk, int(num_cpus), opts, no_kvm=False) # Exit from guest on workbegin/workend system.exit_on_work_items = True # Set up the root SimObject and start the simulation root = Root(full_system=True, system=system) if system.getHostParallel(): # Required for running kvm on multiple host cores. # Uses gem5's parallel event queue feature # Note: The simulator is quite picky about this number! root.sim_quantum = int(1e9) # 1 ms # Instantiate all of the objects if opts.checkpoint_restore: m5.instantiate(opts.checkpoint_dir) else: m5.instantiate() globalStart = time.time() print("Running the simulation") print("Using cpu: {}".format(cpu)) exit_event = m5.simulate(opts.abs_max_tick) # While there is still something to do in the guest keep executing. while exit_event.getCause() != "m5_exit instruction encountered": # If the user pressed ctrl-c on the host, then we really should exit if exit_event.getCause() == "user interrupt received": print("User interrupt. Exiting") break if exit_event.getCause() == "simulate() limit reached": break elif "checkpoint" in exit_event.getCause(): m5.checkpoint(opts.checkpoint_dir) break elif "switchcpu" in exit_event.getCause(): system.switchCpus(system.cpu, system.warmupCpu) else: break print('Exiting @ tick %i because %s' % (m5.curTick(), exit_event.getCause()))
from m5.objects import * # Add the common scripts to our path #m5.util.addToPath('../../') m5.util.addToPath('../') # import the caches which we made from caches import * # import the SimpleOpts module from common import SimpleOpts # Set the usage message to display SimpleOpts.set_usage("usage: %prog [options] <binary to execute>") # Finalize the arguments and grab the opts so we can pass it on to our objects (opts, args) = SimpleOpts.parse_args() # get ISA for the default binary to run. This is mostly for simple testing isa = str(m5.defines.buildEnv['TARGET_ISA']).lower() # Default to running 'hello', use the compiled ISA to find the binary #binary = 'tests/test-progs/polybench-c-4.2/2mm_ref' binary = 'tests/test-progs/polybench-c-4.2/jacobi-2d-fpga' # Check if there was a binary passed in via the command line and error if # there are too many arguments if len(args) == 1: binary = args[0] elif len(args) > 1: SimpleOpts.print_help() m5.fatal("Expected a binary to execute as positional argument")
# get ISA for the default binary to run. This is mostly for simple testing isa = str(m5.defines.buildEnv['TARGET_ISA']).lower() # Default to running 'hello', use the compiled ISA to find the binary # grab the specific path to the binary thispath = os.path.dirname(os.path.realpath(__file__)) default_binary = os.path.join(thispath, '../../../', 'tests/test-progs/hello/bin/', isa, 'linux/hello') # Binary to execute SimpleOpts.add_option("binary", nargs='?', default=default_binary) # Finalize the arguments and grab the args so we can pass it on to our objects args = SimpleOpts.parse_args() # create the system we are going to simulate system = System() # Set the clock fequency of the system (and all of its children) system.clk_domain = SrcClockDomain() system.clk_domain.clock = '1GHz' system.clk_domain.voltage_domain = VoltageDomain() # Set up the system system.mem_mode = 'timing' # Use timing accesses system.mem_ranges = [AddrRange('512MB')] # Create an address range # Create a simple CPU system.cpu = TimingSimpleCPU()
from m5.objects import * # Add the common scripts to our path m5.util.addToPath('../../') # import the caches which we made from caches import * # import the SimpleOpts module from common import SimpleOpts # Set the usage message to display SimpleOpts.set_usage("usage: %prog [options] <binary to execute>") # Finalize the arguments and grab the opts so we can pass it on to our objects (opts, args) = SimpleOpts.parse_args() # get ISA for the default binary to run. This is mostly for simple testing isa = str(m5.defines.buildEnv['TARGET_ISA']).lower() # Default to running 'hello', use the compiled ISA to find the binary binary = 'tests/test-progs/hello/bin/' + isa + '/linux/hello' # Check if there was a binary passed in via the command line and error if # there are too many arguments if len(args) == 1: binary = args[0] elif len(args) > 1: SimpleOpts.print_help() m5.fatal("Expected a binary to execute as positional argument")