Update configs.
[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 script.dir = '/z/saidi/work/m5.newmem/configs/boot'
26
27 linux_image = env.get('LINUX_IMAGE', disk('linux-latest.img'))
28
29 class CowIdeDisk(IdeDisk):
30 image = CowDiskImage(child=RawDiskImage(read_only=True),
31 read_only=False)
32
33 def childImage(self, ci):
34 self.image.child.image_file = ci
35
36 class BaseTsunami(Tsunami):
37 ethernet = NSGigE(configdata=NSGigEPciData(),
38 pci_bus=0, pci_dev=1, pci_func=0)
39 etherint = NSGigEInt(device=Parent.ethernet)
40 ide = IdeController(disks=[Parent.disk0, Parent.disk2],
41 pci_func=0, pci_dev=0, pci_bus=0)
42
43 class MyLinuxAlphaSystem(LinuxAlphaSystem):
44 iobus = Bus(bus_id=0)
45 membus = Bus(bus_id=1)
46 bridge = Bridge()
47 physmem = PhysicalMemory(range = AddrRange('128MB'))
48 bridge.side_a = iobus.port
49 bridge.side_b = membus.port
50 physmem.port = membus.port
51 disk0 = CowIdeDisk(driveID='master')
52 disk2 = CowIdeDisk(driveID='master')
53 disk0.childImage(linux_image)
54 disk2.childImage(disk('linux-bigswap2.img'))
55 tsunami = BaseTsunami()
56 tsunami.attachIO(iobus)
57 tsunami.ide.pio = iobus.port
58 tsunami.ide.dma = iobus.port
59 tsunami.ide.config = iobus.port
60 tsunami.ethernet.pio = iobus.port
61 tsunami.ethernet.dma = iobus.port
62 tsunami.ethernet.config = iobus.port
63 simple_disk = SimpleDisk(disk=RawDiskImage(image_file = linux_image,
64 read_only = True))
65 intrctrl = IntrControl()
66 if options.detailed:
67 cpu = DetailedO3CPU()
68 elif options.timing:
69 cpu = TimingSimpleCPU()
70 mem_mode = 'timing'
71 else:
72 cpu = AtomicSimpleCPU()
73 cpu.mem = membus
74 cpu.icache_port = membus.port
75 cpu.dcache_port = membus.port
76 cpu.itb = AlphaITB()
77 cpu.dtb = AlphaDTB()
78 cpu.clock = '2GHz'
79 sim_console = SimConsole(listener=ConsoleListener(port=3456))
80 kernel = binary('vmlinux')
81 pal = binary('ts_osfpal')
82 console = binary('console')
83 boot_osflags = 'root=/dev/hda1 console=ttyS0'
84
85 class TsunamiRoot(Root):
86 pass
87
88 def DualRoot(clientSystem, serverSystem):
89 self = Root()
90 self.client = clientSystem
91 self.server = serverSystem
92
93 self.etherdump = EtherDump(file='ethertrace')
94 self.etherlink = EtherLink(int1 = Parent.client.tsunami.etherint[0],
95 int2 = Parent.server.tsunami.etherint[0],
96 dump = Parent.etherdump)
97 self.clock = '1THz'
98 return self
99
100 if options.dual:
101 root = DualRoot(
102 MyLinuxAlphaSystem(readfile=script('netperf-stream-nt-client.rcS')),
103 MyLinuxAlphaSystem(readfile=script('netperf-server.rcS')))
104 else:
105 root = TsunamiRoot(clock = '2GHz', system = MyLinuxAlphaSystem())
106
107 m5.instantiate(root)
108
109 #exit_event = m5.simulate(2600000000000)
110 #if exit_event.getCause() != "user interrupt received":
111 # m5.checkpoint(root, 'cpt')
112 # exit_event = m5.simulate(300000000000)
113 # if exit_event.getCause() != "user interrupt received":
114 # m5.checkpoint(root, 'cptA')
115
116
117 if options.maxtick:
118 exit_event = m5.simulate(options.maxtick)
119 else:
120 exit_event = m5.simulate()
121
122 print 'Exiting @ cycle', m5.curTick(), 'because', exit_event.getCause()