From 08c0919b433d7188c61a43266f7cfa1d67df28ae Mon Sep 17 00:00:00 2001 From: Kevin Lim Date: Thu, 27 Jul 2006 17:49:00 -0400 Subject: [PATCH] Clean up some more config stuff. configs/common/FSConfig.py: Clean up some code to make functions look less like classes. Also put makeList function (formerly listWrapper) into m5 itself. configs/test/fs.py: Update for changed code. src/python/m5/__init__.py: Put makeList into m5. --HG-- extra : convert_revision : 731806a7486f9abf986f52926126df666b024b1d --- configs/common/FSConfig.py | 10 ++++------ configs/test/fs.py | 9 +++++---- src/python/m5/__init__.py | 5 +++++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py index bf6817c7a..d17a354af 100644 --- a/configs/common/FSConfig.py +++ b/configs/common/FSConfig.py @@ -27,6 +27,7 @@ # Authors: Kevin Lim import m5 +from m5 import makeList from m5.objects import * from FullO3Config import * from SysPaths import * @@ -49,7 +50,7 @@ class BaseTsunami(Tsunami): ide = IdeController(disks=[Parent.disk0, Parent.disk2], pci_func=0, pci_dev=0, pci_bus=0) -def MyLinuxAlphaSystem(cpu, mem_mode, linux_image, icache=None, dcache=None, l2cache=None): +def makeLinuxAlphaSystem(cpu, mem_mode, linux_image, icache=None, dcache=None, l2cache=None): self = LinuxAlphaSystem() self.iobus = Bus(bus_id=0) self.membus = Bus(bus_id=1) @@ -76,7 +77,7 @@ def MyLinuxAlphaSystem(cpu, mem_mode, linux_image, icache=None, dcache=None, l2c self.cpu = cpu self.mem_mode = mem_mode connectCpu(self.cpu, self.membus, icache, dcache, l2cache) - for each_cpu in listWrapper(self.cpu): + for each_cpu in makeList(self.cpu): each_cpu.itb = AlphaITB() each_cpu.dtb = AlphaDTB() self.cpu.clock = '2GHz' @@ -88,10 +89,7 @@ def MyLinuxAlphaSystem(cpu, mem_mode, linux_image, icache=None, dcache=None, l2c return self -class TsunamiRoot(Root): - pass - -def DualRoot(clientSystem, serverSystem): +def makeDualRoot(clientSystem, serverSystem): self = Root() self.client = clientSystem self.server = serverSystem diff --git a/configs/test/fs.py b/configs/test/fs.py index 004edda79..741ebfe54 100644 --- a/configs/test/fs.py +++ b/configs/test/fs.py @@ -36,13 +36,14 @@ else: mem_mode = 'atomic' if options.dual: - root = DualRoot( - MyLinuxAlphaSystem(cpu, mem_mode, linux_image), - MyLinuxAlphaSystem(cpu2, mem_mode, linux_image)) + root = makeDualRoot( + makeLinuxAlphaSystem(cpu, mem_mode, linux_image), + makeLinuxAlphaSystem(cpu2, mem_mode, linux_image)) root.client.readfile = script('netperf-stream-nt-client.rcS') root.server.readfile = script('netperf-server.rcS') else: - root = TsunamiRoot(clock = '1THz', system = MyLinuxAlphaSystem(cpu, mem_mode, linux_image)) + root = Root(clock = '1THz', + system = makeLinuxAlphaSystem(cpu, mem_mode, linux_image)) m5.instantiate(root) diff --git a/src/python/m5/__init__.py b/src/python/m5/__init__.py index 3d0e3defa..950d605df 100644 --- a/src/python/m5/__init__.py +++ b/src/python/m5/__init__.py @@ -44,6 +44,11 @@ def panic(string): print >>sys.stderr, 'panic:', string sys.exit(1) +def makeList(objOrList): + if isinstance(objOrList, list): + return objOrList + return [objOrList] + # Prepend given directory to system module search path. We may not # need this anymore if we can structure our config library more like a # Python package.