fs.py revision 2917
1import m5
2from m5.objects import *
3import os,optparse,sys
4from SysPaths import *
5from FullO3Config import *
6
7parser = optparse.OptionParser(option_list=m5.standardOptions)
8
9parser.add_option("-d", "--detailed", action="store_true")
10parser.add_option("-t", "--timing", action="store_true")
11parser.add_option("-m", "--maxtick", type="int")
12parser.add_option("--dual", help="Run full system using dual systems",
13                  action="store_true")
14
15(options, args) = parser.parse_args()
16m5.setStandardOptions(options)
17
18if 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.
23test_base = os.path.dirname(__file__)
24
25linux_image = env.get('LINUX_IMAGE', disk('linux-latest.img'))
26
27class 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
34class 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
41class 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
81class TsunamiRoot(Root):
82    pass
83
84def 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
96if options.dual:
97    root = DualRoot(
98        MyLinuxAlphaSystem(readfile=script('netperf-stream-nt-client.rcS')),
99        MyLinuxAlphaSystem(readfile=script('netperf-server.rcS')))
100else:
101    root = TsunamiRoot(clock = '2GHz', system = MyLinuxAlphaSystem())
102
103m5.instantiate(root)
104
105if options.maxtick:
106    exit_event = m5.simulate(options.maxtick)
107else:
108    exit_event = m5.simulate()
109
110print 'Exiting @ cycle', m5.curTick(), 'because', exit_event.getCause()
111