def main(): parser = argparse.ArgumentParser(epilog=__doc__) parser.add_argument("commands_to_run", metavar="command(s)", nargs='*', help="Command(s) to run") parser.add_argument("--cpu", type=str, choices=cpu_types.keys(), default="atomic", help="CPU model to use") parser.add_argument("--cpu-freq", type=str, default="4GHz") parser.add_argument("--num-cores", type=int, default=1, help="Number of CPU cores") parser.add_argument("--mem-type", default="DDR3_1600_8x8", choices=MemConfig.mem_names(), help = "type of memory to use") parser.add_argument("--mem-channels", type=int, default=2, help = "number of memory channels") parser.add_argument("--mem-ranks", type=int, default=None, help = "number of memory ranks per channel") parser.add_argument("--mem-size", action="store", type=str, default="2GB", help="Specify the physical memory size") args = parser.parse_args() # Create a single root node for gem5's object hierarchy. There can # only exist one root node in the simulator at any given # time. Tell gem5 that we want to use syscall emulation mode # instead of full system mode. root = Root(full_system=False) # Populate the root node with a system. A system corresponds to a # single node with shared memory. root.system = create(args) # Instantiate the C++ object hierarchy. After this point, # SimObjects can't be instantiated anymore. m5.instantiate() # Start the simulator. This gives control to the C++ world and # starts the simulator. The returned event tells the simulation # script why the simulator exited. event = m5.simulate() # Print the reason for the simulation exit. Some exit codes are # requests for service (e.g., checkpoints) from the simulation # script. We'll just ignore them here and exit. print(event.getCause(), " @ ", m5.curTick()) sys.exit(event.getCode())
def main(): parser = argparse.ArgumentParser(epilog=__doc__) parser.add_argument("--dtb", type=str, default=None, help="DTB file to load") parser.add_argument("--kernel", type=str, default=default_kernel, help="Linux kernel") parser.add_argument("--disk-image", type=str, default=default_disk, help="Disk to instantiate") parser.add_argument("--script", type=str, default="", help = "Linux bootscript") parser.add_argument("--cpu", type=str, choices=cpu_types.keys(), default="atomic", help="CPU model to use") parser.add_argument("--cpu-freq", type=str, default="4GHz") parser.add_argument("--num-cores", type=int, default=1, help="Number of CPU cores") parser.add_argument("--mem-type", default="DDR3_1600_8x8", choices=MemConfig.mem_names(), help = "type of memory to use") parser.add_argument("--mem-channels", type=int, default=1, help = "number of memory channels") parser.add_argument("--mem-ranks", type=int, default=None, help = "number of memory ranks per channel") parser.add_argument("--mem-size", action="store", type=str, default="2GB", help="Specify the physical memory size") parser.add_argument("--checkpoint", action="store_true") parser.add_argument("--restore", type=str, default=None) args = parser.parse_args() root = Root(full_system=True) root.system = create(args) if args.restore is not None: m5.instantiate(args.restore) else: m5.instantiate() run(args)
try: import google.protobuf except: print("Please install the Python protobuf module") exit(-1) import packet_pb2 else: print("Failed to import packet proto definitions") exit(-1) parser = optparse.OptionParser() parser.add_option("--mem-type", type="choice", default="DDR3_1600_8x8", choices=MemConfig.mem_names(), help = "type of memory to use") parser.add_option("--mem-size", action="store", type="string", default="16MB", help="Specify the memory size") parser.add_option("--reuse-trace", action="store_true", help="Prevent generation of traces and reuse existing") (options, args) = parser.parse_args() if args: print("Error: script doesn't take any positional arguments") sys.exit(1) # start by creating the system itself, using a multi-layer 2.0 GHz # crossbar, delivering 64 bytes / 3 cycles (one header cycle) which
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', help = """Top-level voltage for blocks running at system power supply""") parser.add_option("--sys-clock", action="store", type="string", 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_8x8", 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")
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', help = """Top-level voltage for blocks running at system power supply""") parser.add_option("--sys-clock", action="store", type="string", 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")
import subprocess import m5 from m5.objects import * from m5.util import addToPath addToPath("../") from common import MemConfig from common import HMC parser = optparse.OptionParser() # Use a HMC_2500_x32 by default parser.add_option( "--mem-type", type="choice", default="HMC_2500_x32", choices=MemConfig.mem_names(), help="type of memory to use" ) parser.add_option("--ranks", "-r", type="int", default=1, help="Number of ranks to iterate across") parser.add_option("--rd_perc", type="int", default=100, help="Percentage of read commands") parser.add_option( "--mode", type="choice", default="DRAM", choices=["DRAM", "DRAM_ROTATE", "RANDOM"], help="DRAM: Random traffic; \ DRAM_ROTATE: Traffic rotating across banks and ranks", )
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', help="""Top-level voltage for blocks running at system power supply""") parser.add_option("--sys-clock", action="store", type="string", 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_8x8", 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) # SPM Options parser.add_option("--spm_pageshift", type="int", default=9) parser.add_option("--spm_size", type="string", default="1kB") parser.add_option("--spm_assoc", type="int", default=2) parser.add_option("--th", type="int", default=16) parser.add_option("--timeGap", type="int", default=1000000) parser.add_option("--accessFre", type="int", default=16) parser.add_option("--accessTh", type="int", default=328) parser.add_option("--myPlan", type="int", default=0) parser.add_option("--eCache", type="int", default=8) parser.add_option("--eSPM", type="int", default=6) parser.add_option("--eDRAM", type="int", default=345) # 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( "-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.")
# this script is helpful to sweep the efficiency of a specific memory # controller configuration, by varying the number of banks accessed, # and the sequential stride size (how many bytes per activate), and # observe what bus utilisation (bandwidth) is achieved parser = optparse.OptionParser() dram_generators = { "DRAM" : lambda x: x.createDram, "DRAM_ROTATE" : lambda x: x.createDramRot, } # Use a single-channel DDR3-1600 x64 (8x8 topology) by default parser.add_option("--mem-type", type="choice", default="DDR3_1600_8x8", choices=MemConfig.mem_names(), help = "type of memory to use") parser.add_option("--mem-ranks", "-r", type="int", default=1, help = "Number of ranks to iterate across") parser.add_option("--rd_perc", type="int", default=100, help = "Percentage of read commands") parser.add_option("--mode", type="choice", default="DRAM", choices=dram_generators.keys(), help = "DRAM: Random traffic; \ DRAM_ROTATE: Traffic rotating across banks and ranks") parser.add_option("--addr_map", type="int", default=1, help = "0: RoCoRaBaCh; 1: RoRaBaCoCh/RoRaBaChCo")
def main(): parser = argparse.ArgumentParser(epilog=__doc__) parser.add_argument("--kernel", type=str, default=None, help="Binary to run") parser.add_argument("--disk-image", type=str, default=None, help="Disk to instantiate") parser.add_argument("--readfile", type=str, default="", help="File to return with the m5 readfile command") parser.add_argument("--cpu", type=str, choices=cpu_types.keys(), default="atomic", help="CPU model to use") parser.add_argument("--cpu-freq", type=str, default="4GHz") parser.add_argument("--num-cores", type=int, default=1, help="Number of CPU cores") parser.add_argument("--mem-type", default="DDR3_1600_8x8", choices=MemConfig.mem_names(), help="type of memory to use") parser.add_argument("--mem-channels", type=int, default=1, help="number of memory channels") parser.add_argument("--mem-ranks", type=int, default=None, help="number of memory ranks per channel") parser.add_argument("--mem-size", action="store", type=str, default="2GB", help="Specify the physical memory size") parser.add_argument("--checkpoint", action="store_true") parser.add_argument("--restore", type=str, default=None) parser.add_argument("--dtb-gen", action="store_true", help="Doesn't run simulation, it generates a DTB only") args = parser.parse_args() root = Root(full_system=True) root.system = create(args) if args.restore is not None: m5.instantiate(args.restore) else: m5.instantiate() if args.dtb_gen: # No run, autogenerate DTB and exit root.system.generateDtb(m5.options.outdir, 'system.dtb') else: run(args)
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', help = """Top-level voltage for blocks running at system power supply""") parser.add_option("--sys-clock", action="store", type="string", 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_8x8", 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") parser.add_option("--membus-width", type="int", default=16, help="System membus Width") parser.add_option("--membus-frontend_latency", type="int", default=3, help="System membus frontend latency") parser.add_option("--membus-forward_latency", type="int", default=4, help="System membus forward latency") parser.add_option("--membus-response_latency", type="int", default=2, help="System membus response latency") parser.add_option("--membus-snoop_response_latency", type="int", default=4, help="System membus snoop response latency") # 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("--l2_cluster_size", type="int", default=256, help="Number of CPUs to cluster for each l2 size") parser.add_option("--l3_assoc", type="int", default=16) parser.add_option("--cacheline_size", type="int", default=64) parser.add_option("--l2bus-width", type="int", default=32, help="L2 Bus Width") # DerivO3CPU Options parser.add_option("--fetchToDecodeDelay", type="int", default=1, help="Fetch to decode delay") parser.add_option("--decodeToRenameDelay", type="int", default=1, help="Decode to rename delay") parser.add_option("--renameToIEWDelay", type="int", default=2, help="Rename to IEW delay") parser.add_option("--iewToCommitDelay", type="int", default=1, help="Issue/Execute/Writeback to commit") parser.add_option("--issueToExecuteDelay", type="int", default=1, help="Issue to execute delay") parser.add_option("--renameToROBDelay", type="int", default=1, help="Rename to reorder buffer delay") parser.add_option("--fetchWidth", type="int", default=5, help="Fetch width") parser.add_option("--decodeWidth", type="int", default=5, help="Decode width") parser.add_option("--renameWidth", type="int", default=5, help="Rename width") parser.add_option("--dispatchWidth", type="int", default=5, help="Dispatch width") parser.add_option("--issueWidth", type="int", default=5, help="issue width") parser.add_option("--wbWidth", type="int", default=5, help="Writeback width") parser.add_option("--commitWidth", type="int", default=5, help="Commit width") parser.add_option("--squashWidth", type="int", default=5, help="Squash width") parser.add_option("--numPhysIntRegs", type="int", default=256, help="Number of physical integer registers") parser.add_option("--numPhysFloatRegs", type="int", default=256, help="Number of physical floating registers") parser.add_option("--numPhysVecRegs", type="int", default=256, help="Number of physical vector registers") parser.add_option("--numROBEntries", type="int", default=128, help="Number of reorder buffer entries") # 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")
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', help = """Top-level voltage for blocks running at system power supply""") parser.add_option("--sys-clock", action="store", type="string", 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_8x8", 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") parser.add_option("-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.")