se.py revision 2925
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 *
10from m5.objects import *
11
12this_dir = os.path.dirname(__file__)
13
14process = LiveProcess()
15process.executable = os.path.join(this_dir, options.cmd)
16process.cmd = options.cmd + " " + options.options
17if options.input != "":
18    process.input = options.input
19
20if options.detailed:
21    #check for SMT workload
22    workloads = options.cmd.split(';')
23    if len(workloads) > 1:
24        process = []
25        smt_idx = 0
26        inputs = []
27
28        if options.input != "":
29            inputs = options.input.split(';')
30
31        for wrkld in workloads:
32            smt_process = LiveProcess()
33            smt_process.executable = os.path.join(this_dir, wrkld)
34            smt_process.cmd = wrkld + " " + options.options
35            if inputs and inputs[smt_idx]:
36                smt_process.input = inputs[smt_idx]
37            process += [smt_process, ]
38            smt_idx += 1
39
40root = MySESystem(process)
41
42if options.timing or options.detailed:
43    root.system.mem_mode = 'timing'
44
45# instantiate configuration
46m5.instantiate(root)
47
48# simulate until program terminates
49if options.maxtick:
50    exit_event = m5.simulate(options.maxtick)
51else:
52    exit_event = m5.simulate()
53
54print 'Exiting @ tick', m5.curTick(), 'because', exit_event.getCause()
55
56