4 # MIPS: "m5 test.py -a Mips -c hello_mips"
6 import os
, optparse
, sys
8 from m5
.objects
import *
10 # parse command-line arguments
11 parser
= optparse
.OptionParser(option_list
=m5
.standardOptions
)
13 parser
.add_option("-c", "--cmd", default
="hello")
14 parser
.add_option("-t", "--timing", action
="store_true")
16 (options
, args
) = parser
.parse_args()
19 print "Error: script doesn't take any positional arguments"
23 this_dir
= os
.path
.dirname(__file__
)
25 process
= LiveProcess()
26 process
.executable
= os
.path
.join(this_dir
, options
.cmd
)
27 process
.cmd
= options
.cmd
30 mem
= PhysicalMemory()
33 cpu
= TimingSimpleCPU()
35 cpu
= AtomicSimpleCPU()
36 cpu
.workload
= process
39 system
= System(physmem
= mem
, cpu
= cpu
)
40 system
.c1
= Connector(side_a
= mem
, side_b
= magicbus
)
41 root
= Root(system
= system
)
43 # instantiate configuration
46 # simulate until program terminates
47 exit_event
= m5
.simulate()
49 print 'Exiting @', m5
.curTick(), 'because', exit_event
.getCause()