2006-06-10 06:22:42 +02:00
|
|
|
# Simple test script
|
|
|
|
#
|
|
|
|
# Alpha: "m5 test.py"
|
2006-07-12 23:17:17 +02:00
|
|
|
# MIPS: "m5 test.py -c hello_mips"
|
2006-06-10 06:22:42 +02:00
|
|
|
|
2006-06-10 05:01:31 +02:00
|
|
|
import m5
|
2006-07-12 23:17:17 +02:00
|
|
|
import os, optparse, sys
|
|
|
|
m5.AddToPath('../common')
|
|
|
|
from SEConfig import *
|
2006-06-10 05:01:31 +02:00
|
|
|
|
|
|
|
this_dir = os.path.dirname(__file__)
|
|
|
|
|
2006-06-12 03:49:46 +02:00
|
|
|
process = LiveProcess()
|
2006-06-10 06:22:42 +02:00
|
|
|
process.executable = os.path.join(this_dir, options.cmd)
|
2006-06-26 22:50:19 +02:00
|
|
|
process.cmd = options.cmd + " " + options.options
|
|
|
|
if options.input != "":
|
|
|
|
process.input = options.input
|
2006-03-10 16:01:29 +01:00
|
|
|
|
2006-07-12 23:17:17 +02:00
|
|
|
if options.detailed:
|
2006-07-03 07:10:19 +02:00
|
|
|
#check for SMT workload
|
|
|
|
workloads = options.cmd.split(';')
|
|
|
|
if len(workloads) > 1:
|
|
|
|
process = []
|
|
|
|
smt_idx = 0
|
|
|
|
inputs = []
|
|
|
|
|
|
|
|
if options.input != "":
|
|
|
|
inputs = options.input.split(';')
|
|
|
|
|
|
|
|
for wrkld in workloads:
|
|
|
|
smt_process = LiveProcess()
|
|
|
|
smt_process.executable = os.path.join(this_dir, wrkld)
|
|
|
|
smt_process.cmd = wrkld + " " + options.options
|
|
|
|
if inputs and inputs[smt_idx]:
|
|
|
|
smt_process.input = inputs[smt_idx]
|
|
|
|
process += [smt_process, ]
|
|
|
|
smt_idx += 1
|
|
|
|
|
2006-06-10 05:01:31 +02:00
|
|
|
cpu.workload = process
|
|
|
|
|
2006-06-10 06:22:42 +02:00
|
|
|
# instantiate configuration
|
2006-06-10 05:01:31 +02:00
|
|
|
m5.instantiate(root)
|
|
|
|
|
2006-06-10 06:22:42 +02:00
|
|
|
# simulate until program terminates
|
2006-06-16 23:08:47 +02:00
|
|
|
if options.maxtick:
|
|
|
|
exit_event = m5.simulate(options.maxtick)
|
|
|
|
else:
|
|
|
|
exit_event = m5.simulate()
|
2006-06-10 05:01:31 +02:00
|
|
|
|
2006-06-18 21:58:14 +02:00
|
|
|
print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
|
2006-06-10 05:01:31 +02:00
|
|
|
|