summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configs/ruby/Ruby.py29
-rw-r--r--configs/topologies/BaseTopology.py23
-rw-r--r--configs/topologies/Cluster.py3
-rw-r--r--configs/topologies/Crossbar.py8
-rw-r--r--configs/topologies/Mesh.py4
-rw-r--r--configs/topologies/MeshDirCorners.py4
-rw-r--r--configs/topologies/Pt2Pt.py4
-rw-r--r--configs/topologies/Torus.py4
-rw-r--r--src/mem/ruby/network/topologies/SConscript36
-rw-r--r--src/mem/ruby/network/topologies/TopologyCreator.py19
10 files changed, 48 insertions, 86 deletions
diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py
index 82b8d0111..ba6f3e7fa 100644
--- a/configs/ruby/Ruby.py
+++ b/configs/ruby/Ruby.py
@@ -136,20 +136,23 @@ def create_system(options, system, piobus = None, dma_ports = []):
class IntLinkClass(SimpleIntLink): pass
class ExtLinkClass(SimpleExtLink): pass
class RouterClass(BasicRouter): pass
-
+
#
# Important: the topology must be instantiated before the network and after
# the controllers. Hence the separation between topology definition and
- # instantiation. TopologyCreator is in src/mem/ruby/network/topologies/.
+ # instantiation.
#
- from TopologyCreator import instantiateTopology
- try:
- net_topology = instantiateTopology(topology, options, \
- IntLinkClass, ExtLinkClass, \
- RouterClass)
- except:
- print "Error: could not make topology %s" % options.topology
- raise
+ # gem5 SimObject defined in src/mem/ruby/network/Network.py
+ net_topology = Topology()
+ net_topology.description = topology.description
+
+ routers, int_links, ext_links = topology.makeTopology(options,
+ IntLinkClass, ExtLinkClass, RouterClass)
+
+ net_topology.routers = routers
+ net_topology.int_links = int_links
+ net_topology.ext_links = ext_links
+
if options.network_fault_model:
assert(options.garnet_network == "fixed")
@@ -162,7 +165,7 @@ def create_system(options, system, piobus = None, dma_ports = []):
#
# Loop through the directory controlers.
# Determine the total memory size of the ruby system and verify it is equal
- # to physmem. However, if Ruby memory is using sparse memory in SE
+ # to physmem. However, if Ruby memory is using sparse memory in SE
# mode, then the system should not back-up the memory state with
# the Memory Vector and thus the memory size bytes should stay at 0.
# Also set the numa bits to the appropriate values.
@@ -180,11 +183,11 @@ def create_system(options, system, piobus = None, dma_ports = []):
numa_bit = dir_bits + 5
else:
numa_bit = 6
-
+
for dir_cntrl in dir_cntrls:
total_mem_size.value += dir_cntrl.directory.size.value
dir_cntrl.directory.numa_high_bit = numa_bit
-
+
phys_mem_size = 0
for mem in system.memories.unproxy(system):
phys_mem_size += long(mem.range.second) - long(mem.range.first) + 1
diff --git a/configs/topologies/BaseTopology.py b/configs/topologies/BaseTopology.py
index 114a29f19..2390bb5be 100644
--- a/configs/topologies/BaseTopology.py
+++ b/configs/topologies/BaseTopology.py
@@ -26,6 +26,7 @@
#
# Authors: Jason Power
+import m5
class BaseTopology(object):
description = "BaseTopology"
@@ -38,14 +39,28 @@ class BaseTopology(object):
"""
def makeTopology(self, options, IntLink, ExtLink, Router):
- """ Called from src/mem/ruby/network/topologies/TopologyCreatory.py
+ """ Called from configs/ruby/Ruby.py
The return value is ( list(Router), list(IntLink), list(ExtLink))
The API of this function cannot change when subclassing!!
Any additional information needed to create this topology should
be passed into the constructor when it's instantiated in
configs/ruby/<protocol>.py
"""
- print "BaseTopology should have been overridden in a sub class!!"
- import sys
- sys.exit(1)
+ m5.util.fatal("BaseTopology should have been overridden!!")
+class SimpleTopology(BaseTopology):
+ """ Provides methods needed for the topologies included in Ruby before
+ topology changes.
+ These topologies are "simple" in the sense that they only use a flat
+ list of controllers to construct the topology.
+ """
+ description = "SimpleTopology"
+
+ def __init__(self, controllers):
+ self.nodes = controllers
+
+ def addController(self, controller):
+ self.nodes.append(controller)
+
+ def __len__(self):
+ return len(self.nodes)
diff --git a/configs/topologies/Cluster.py b/configs/topologies/Cluster.py
index e5c6dac0e..93bd0d946 100644
--- a/configs/topologies/Cluster.py
+++ b/configs/topologies/Cluster.py
@@ -115,3 +115,6 @@ class Cluster(BaseTopology):
return routers, int_links, ext_links
+ def __len__(self):
+ return len([i for i in self.nodes if type(i) != Cluster]) + \
+ sum([len(i) for i in self.nodes if type(i) == Cluster])
diff --git a/configs/topologies/Crossbar.py b/configs/topologies/Crossbar.py
index e66492922..c85b8e8eb 100644
--- a/configs/topologies/Crossbar.py
+++ b/configs/topologies/Crossbar.py
@@ -29,14 +29,11 @@
from m5.params import *
from m5.objects import *
-from BaseTopology import BaseTopology
+from BaseTopology import SimpleTopology
-class Crossbar(BaseTopology):
+class Crossbar(SimpleTopology):
description='Crossbar'
- def __init__(self, controllers):
- self.nodes = controllers
-
def makeTopology(self, options, IntLink, ExtLink, Router):
# Create an individual router for each controller plus one more for the
# centralized crossbar. The large numbers of routers are needed because
@@ -53,4 +50,3 @@ class Crossbar(BaseTopology):
for i in range(len(self.nodes))]
return routers, int_links, ext_links
-
diff --git a/configs/topologies/Mesh.py b/configs/topologies/Mesh.py
index b1f2e6751..81d87f5e5 100644
--- a/configs/topologies/Mesh.py
+++ b/configs/topologies/Mesh.py
@@ -29,9 +29,9 @@
from m5.params import *
from m5.objects import *
-from BaseTopology import BaseTopology
+from BaseTopology import SimpleTopology
-class Mesh(BaseTopology):
+class Mesh(SimpleTopology):
description='Mesh'
def __init__(self, controllers):
diff --git a/configs/topologies/MeshDirCorners.py b/configs/topologies/MeshDirCorners.py
index 23bcde5a6..13b4acc19 100644
--- a/configs/topologies/MeshDirCorners.py
+++ b/configs/topologies/MeshDirCorners.py
@@ -29,9 +29,9 @@
from m5.params import *
from m5.objects import *
-from BaseTopology import BaseTopology
+from BaseTopology import SimpleTopology
-class MeshDirCorners(BaseTopology):
+class MeshDirCorners(SimpleTopology):
description='MeshDirCorners'
def __init__(self, controllers):
diff --git a/configs/topologies/Pt2Pt.py b/configs/topologies/Pt2Pt.py
index 360811272..74ff116ff 100644
--- a/configs/topologies/Pt2Pt.py
+++ b/configs/topologies/Pt2Pt.py
@@ -31,9 +31,9 @@
from m5.params import *
from m5.objects import *
-from BaseTopology import BaseTopology
+from BaseTopology import SimpleTopology
-class Pt2Pt(BaseTopology):
+class Pt2Pt(SimpleTopology):
description='Pt2Pt'
def __init__(self, controllers):
diff --git a/configs/topologies/Torus.py b/configs/topologies/Torus.py
index 7fbcbf55b..9869465ae 100644
--- a/configs/topologies/Torus.py
+++ b/configs/topologies/Torus.py
@@ -31,9 +31,9 @@
from m5.params import *
from m5.objects import *
-from BaseTopology import BaseTopology
+from BaseTopology import SimpleTopology
-class Torus(BaseTopology):
+class Torus(SimpleTopology):
description='Torus'
def __init__(self, controllers):
diff --git a/src/mem/ruby/network/topologies/SConscript b/src/mem/ruby/network/topologies/SConscript
deleted file mode 100644
index 3d61f6dd1..000000000
--- a/src/mem/ruby/network/topologies/SConscript
+++ /dev/null
@@ -1,36 +0,0 @@
-# -*- mode:python -*-
-
-# Copyright (c) 2010 Advanced Micro Devices, Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met: redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer;
-# redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution;
-# neither the name of the copyright holders nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#
-# Authors: Brad Beckmann
-
-Import('*')
-
-if env['PROTOCOL'] == 'None':
- Return()
-
-PySource('', 'TopologyCreator.py')
diff --git a/src/mem/ruby/network/topologies/TopologyCreator.py b/src/mem/ruby/network/topologies/TopologyCreator.py
deleted file mode 100644
index d9b989e77..000000000
--- a/src/mem/ruby/network/topologies/TopologyCreator.py
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-from m5.params import *
-from m5.objects import *
-
-def instantiateTopology(topology, options, IntLink, ExtLink, Router):
-
- topo = Topology()
- topo.description = topology.description
-
- routers, int_links, ext_links = topology.makeTopology(options, IntLink, ExtLink, Router)
-
- topo.routers = routers
- topo.int_links = int_links
- topo.ext_links = ext_links
-
- return topo