fs.py revision 2995
1import optparse, os, sys 2 3import m5 4from m5.objects import * 5m5.AddToPath('../common') 6from FSConfig import * 7from SysPaths import * 8from Util import * 9from Benchmarks import * 10 11parser = optparse.OptionParser() 12 13parser.add_option("-d", "--detailed", action="store_true") 14parser.add_option("-t", "--timing", action="store_true") 15parser.add_option("-m", "--maxtick", type="int") 16parser.add_option("--maxtime", type="float") 17parser.add_option("--dual", action="store_true", 18 help="Simulate two systems attached with an ethernet link") 19parser.add_option("-b", "--benchmark", action="store", type="string", 20 dest="benchmark", 21 help="Specify the benchmark to run. Available benchmarks: %s"\ 22 % DefinedBenchmarks) 23 24(options, args) = parser.parse_args() 25 26if args: 27 print "Error: script doesn't take any positional arguments" 28 sys.exit(1) 29 30if options.detailed: 31 cpu = DetailedO3CPU() 32 cpu2 = DetailedO3CPU() 33 mem_mode = 'timing' 34elif options.timing: 35 cpu = TimingSimpleCPU() 36 cpu2 = TimingSimpleCPU() 37 mem_mode = 'timing' 38else: 39 cpu = AtomicSimpleCPU() 40 cpu2 = AtomicSimpleCPU() 41 mem_mode = 'atomic' 42 43 44if options.benchmark: 45 if options.benchmark not in Benchmarks: 46 print "Error benchmark %s has not been defined." % options.benchmark 47 print "Valid benchmarks are: %s" % DefinedBenchmarks 48 sys.exit(1) 49 50 bm = Benchmarks[options.benchmark] 51 52 if len(bm) == 2: 53 root = makeDualRoot(makeLinuxAlphaSystem(cpu, mem_mode, bm[0]), 54 makeLinuxAlphaSystem(cpu2, mem_mode, bm[1])) 55 56 elif len(bm) == 1: 57 root = Root(clock = '1THz', 58 system = makeLinuxAlphaSystem(cpu, mem_mode, bm[0])) 59 else: 60 print "Error I don't know how to create more than 2 systems." 61 sys.exit(1) 62 63else: 64 if options.dual: 65 root = makeDualRoot( 66 makeLinuxAlphaSystem(cpu, mem_mode, Machine()), 67 makeLinuxAlphaSystem(cpu2, mem_mode, Machine())) 68 else: 69 root = Root(clock = '1THz', 70 system = makeLinuxAlphaSystem(cpu, mem_mode, Machine())) 71 72m5.instantiate(root) 73 74#exit_event = m5.simulate(2600000000000) 75#if exit_event.getCause() != "user interrupt received": 76# m5.checkpoint(root, 'cpt') 77# exit_event = m5.simulate(300000000000) 78# if exit_event.getCause() != "user interrupt received": 79# m5.checkpoint(root, 'cptA') 80 81 82if options.maxtick: 83 exit_event = m5.simulate(options.maxtick) 84elif options.maxtime: 85 simtime = int(options.maxtime * root.clock.value) 86 print "simulating for: ", simtime 87 exit_event = m5.simulate(simtime) 88else: 89 exit_event = m5.simulate() 90 91print 'Exiting @ cycle', m5.curTick(), 'because', exit_event.getCause() 92