Merge ktlim@zizzer:/bk/newmem
[gem5.git] / configs / test / fs.py
1 import optparse, os, sys
2
3 import m5
4 from m5.objects import *
5 from SysPaths import *
6 from FullO3Config import *
7
8 parser = optparse.OptionParser()
9
10 parser.add_option("-d", "--detailed", action="store_true")
11 parser.add_option("-t", "--timing", action="store_true")
12 parser.add_option("-m", "--maxtick", type="int")
13 parser.add_option("--dual", help="Run full system using dual systems",
14 action="store_true")
15
16 (options, args) = parser.parse_args()
17
18 if args:
19 print "Error: script doesn't take any positional arguments"
20 sys.exit(1)
21
22 # Base for tests is directory containing this file.
23 test_base = os.path.dirname(__file__)
24
25 linux_image = env.get('LINUX_IMAGE', disk('linux-latest.img'))
26
27 class CowIdeDisk(IdeDisk):
28 image = CowDiskImage(child=RawDiskImage(read_only=True),
29 read_only=False)
30
31 def childImage(self, ci):
32 self.image.child.image_file = ci
33
34 class BaseTsunami(Tsunami):
35 ethernet = NSGigE(configdata=NSGigEPciData(),
36 pci_bus=0, pci_dev=1, pci_func=0)
37 etherint = NSGigEInt(device=Parent.ethernet)
38 ide = IdeController(disks=[Parent.disk0, Parent.disk2],
39 pci_func=0, pci_dev=0, pci_bus=0)
40
41 class MyLinuxAlphaSystem(LinuxAlphaSystem):
42 iobus = Bus(bus_id=0)
43 membus = Bus(bus_id=1)
44 bridge = Bridge()
45 physmem = PhysicalMemory(range = AddrRange('128MB'))
46 bridge.side_a = iobus.port
47 bridge.side_b = membus.port
48 physmem.port = membus.port
49 disk0 = CowIdeDisk(driveID='master')
50 disk2 = CowIdeDisk(driveID='master')
51 disk0.childImage(linux_image)
52 disk2.childImage(disk('linux-bigswap2.img'))
53 tsunami = BaseTsunami()
54 tsunami.attachIO(iobus)
55 tsunami.ide.pio = iobus.port
56 tsunami.ide.dma = iobus.port
57 tsunami.ide.config = iobus.port
58 tsunami.ethernet.pio = iobus.port
59 tsunami.ethernet.dma = iobus.port
60 tsunami.ethernet.config = iobus.port
61 simple_disk = SimpleDisk(disk=RawDiskImage(image_file = linux_image,
62 read_only = True))
63 intrctrl = IntrControl()
64 if options.detailed:
65 cpu = DetailedO3CPU()
66 elif options.timing:
67 cpu = TimingSimpleCPU()
68 else:
69 cpu = AtomicSimpleCPU()
70 cpu.mem = membus
71 cpu.icache_port = membus.port
72 cpu.dcache_port = membus.port
73 cpu.itb = AlphaITB()
74 cpu.dtb = AlphaDTB()
75 sim_console = SimConsole(listener=ConsoleListener(port=3456))
76 kernel = binary('vmlinux')
77 pal = binary('ts_osfpal')
78 console = binary('console')
79 boot_osflags = 'root=/dev/hda1 console=ttyS0'
80
81 class TsunamiRoot(Root):
82 pass
83
84 def DualRoot(clientSystem, serverSystem):
85 self = Root()
86 self.client = clientSystem
87 self.server = serverSystem
88
89 self.etherdump = EtherDump(file='ethertrace')
90 self.etherlink = EtherLink(int1 = Parent.client.tsunami.etherint[0],
91 int2 = Parent.server.tsunami.etherint[0],
92 dump = Parent.etherdump)
93 self.clock = '5GHz'
94 return self
95
96 if options.dual:
97 root = DualRoot(
98 MyLinuxAlphaSystem(readfile=script('netperf-stream-nt-client.rcS')),
99 MyLinuxAlphaSystem(readfile=script('netperf-server.rcS')))
100 else:
101 root = TsunamiRoot(clock = '2GHz', system = MyLinuxAlphaSystem())
102
103 m5.instantiate(root)
104
105 if options.maxtick:
106 exit_event = m5.simulate(options.maxtick)
107 else:
108 exit_event = m5.simulate()
109
110 print 'Exiting @ cycle', m5.curTick(), 'because', exit_event.getCause()