# import the m5 (gem5) library created when gem5 is built import m5 # import all of the SimObjects 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:
from __future__ import print_function # import the m5 (gem5) library created when gem5 is built import m5 # import all of the SimObjects from m5.objects import * # Add the common scripts to our path m5.util.addToPath('../') # import the SimpleOpts module from common import SimpleOpts # Set the usage message to display SimpleOpts.set_usage("usage: %prog [options] <binary to load>") # Finalize the arguments and grab the opts so we can pass it on to our objects (opts, args) = SimpleOpts.parse_args() if len(args) == 1: binary = args[0] else: SimpleOpts.print_help() m5.fatal("Expected a binary to execute as positional argument") ############################################################################## # CREATE THE SYSTEM ############################################################################## # create the system we are going to simulate
# import the m5 (gem5) library created when gem5 is built import m5 # import all of the SimObjects 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:
# import the SimpleOpts module from common import SimpleOpts # set default args cpu_2006_base_dir = '/speccpu2006-clean/benchspec/CPU2006/' default_max_insts = 100000000 # 100 million # Set the usage message to display SimpleOpts.add_option('--maxinsts', help='Max instructions to run. Default: %s' % default_max_insts) SimpleOpts.add_option('--rl_prefetcher', help='Which RL prefetcher to use') SimpleOpts.add_option('--reward_type', help='Type of rewards to use with the RL prefetcher') SimpleOpts.set_usage('usage: %prog [--maxinsts number] [--rl_prefetcher string] [--reward_type string] spec_program') # Finalize the arguments and grab the opts so we can pass it on to our objects (opts, args) = SimpleOpts.parse_args() # Check if there was a binary passed in via the command line and error if # there are too many arguments if len(args) == 1: spec_program = args[0] else: SimpleOpts.print_help() m5.fatal('Expected a spec program to execute as positional argument') # Clear python server and set proper RL prefetcher to be used # to make this work run apt-get install python-requests if opts.rl_prefetcher is not None and opts.rl_prefetcher not in ['table_bandits', 'table_q', 'DQN']:
# import model parameters import params # extract as local variables for define in dir(params): if define[0] != '_': # This filters out the swig stuff. exec("val = params." + define) exec(define + " = int(val) & 0xFFFFFFFF") # Add the common scripts to our path m5.util.addToPath('../../gem5/configs/') # import the SimpleOpts module from common import SimpleOpts # Set the usage message to display SimpleOpts.set_usage( "usage: %prog [options] <binary to execute> <trace replay mode - 1 / 0>") # 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 # grab the specific path to the binary thispath = os.path.dirname(os.path.realpath(__file__)) binary = os.path.join(thispath, '../../', 'gem5/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