se.py revision 2917
1# Simple test script
2#
3# Alpha: "m5 test.py"
4# MIPS: "m5 test.py -c hello_mips"
5
6import m5
7import os, optparse, sys
8m5.AddToPath('../common')
9from SEConfig import *
10
11this_dir = os.path.dirname(__file__)
12
13process = LiveProcess()
14process.executable = os.path.join(this_dir, options.cmd)
15process.cmd = options.cmd + " " + options.options
16if options.input != "":
17    process.input = options.input
18
19if options.detailed:
20    #check for SMT workload
21    workloads = options.cmd.split(';')
22    if len(workloads) > 1:
23        process = []
24        smt_idx = 0
25        inputs = []
26
27        if options.input != "":
28            inputs = options.input.split(';')
29
30        for wrkld in workloads:
31            smt_process = LiveProcess()
32            smt_process.executable = os.path.join(this_dir, wrkld)
33            smt_process.cmd = wrkld + " " + options.options
34            if inputs and inputs[smt_idx]:
35                smt_process.input = inputs[smt_idx]
36            process += [smt_process, ]
37            smt_idx += 1
38
39cpu.workload = process
40
41# instantiate configuration
42m5.instantiate(root)
43
44# simulate until program terminates
45if options.maxtick:
46    exit_event = m5.simulate(options.maxtick)
47else:
48    exit_event = m5.simulate()
49
50print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
51
52