summaryrefslogtreecommitdiff
path: root/configs
diff options
context:
space:
mode:
Diffstat (limited to 'configs')
-rw-r--r--configs/ruby/Ruby.py15
-rw-r--r--configs/topologies/BaseTopology.py2
-rw-r--r--configs/topologies/Cluster.py19
-rw-r--r--configs/topologies/Crossbar.py19
-rw-r--r--configs/topologies/Mesh.py7
-rw-r--r--configs/topologies/MeshDirCorners.py10
-rw-r--r--configs/topologies/Pt2Pt.py11
-rw-r--r--configs/topologies/Torus.py7
8 files changed, 47 insertions, 43 deletions
diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py
index e9a8a3c3f..0cd63b4f9 100644
--- a/configs/ruby/Ruby.py
+++ b/configs/ruby/Ruby.py
@@ -145,17 +145,12 @@ def create_system(options, system, piobus = None, dma_ports = []):
class ExtLinkClass(SimpleExtLink): pass
class RouterClass(Switch): pass
- #
- # Important: the topology must be instantiated before the network and after
- # the controllers. Hence the separation between topology definition and
- # instantiation.
- #
- routers, int_links, ext_links = topology.makeTopology(options,
- IntLinkClass, ExtLinkClass, RouterClass)
- network = NetworkClass(ruby_system = ruby, routers = routers,
- int_links = int_links, ext_links = ext_links,
- topology = topology.description)
+ # Create the network topology
+ network = NetworkClass(ruby_system = ruby, topology = topology.description,
+ routers = [], ext_links = [], int_links = [])
+ topology.makeTopology(options, network, IntLinkClass, ExtLinkClass,
+ RouterClass)
if options.network_fault_model:
assert(options.garnet_network == "fixed")
diff --git a/configs/topologies/BaseTopology.py b/configs/topologies/BaseTopology.py
index 2390bb5be..bd8ae255e 100644
--- a/configs/topologies/BaseTopology.py
+++ b/configs/topologies/BaseTopology.py
@@ -38,7 +38,7 @@ class BaseTopology(object):
all of the controllers created in the above file.
"""
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
""" 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!!
diff --git a/configs/topologies/Cluster.py b/configs/topologies/Cluster.py
index 93bd0d946..5f41edd0a 100644
--- a/configs/topologies/Cluster.py
+++ b/configs/topologies/Cluster.py
@@ -73,22 +73,17 @@ class Cluster(BaseTopology):
def add(self, node):
self.nodes.append(node)
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
""" Recursively make all of the links and routers
"""
- routers = []
- int_links = []
- ext_links = []
# make a router to connect all of the nodes
self.router = Router(router_id=self.num_routers())
- routers.append(self.router)
+ network.routers.append(self.router)
+
for node in self.nodes:
if type(node) == Cluster:
- subRouters, subIntLinks, subExtLinks = node.makeTopology(options, IntLink, ExtLink, Router)
- routers += subRouters
- int_links += subIntLinks
- ext_links += subExtLinks
+ node.makeTopology(options, network, IntLink, ExtLink, Router)
# connect this cluster to the router
link = IntLink(link_id=self.num_int_links(), node_a=self.router, node_b=node.router)
@@ -102,7 +97,7 @@ class Cluster(BaseTopology):
elif self.intLatency:
link.latency = self.intLatency
- int_links.append(link)
+ network.int_links.append(link)
else:
# node is just a controller connect it to the router via a ext_link
link = ExtLink(link_id=self.num_ext_links(), ext_node=node, int_node=self.router)
@@ -111,9 +106,7 @@ class Cluster(BaseTopology):
if self.intLatency:
link.latency = self.intLatency
- ext_links.append(link)
-
- return routers, int_links, ext_links
+ network.ext_links.append(link)
def __len__(self):
return len([i for i in self.nodes if type(i) != Cluster]) + \
diff --git a/configs/topologies/Crossbar.py b/configs/topologies/Crossbar.py
index c85b8e8eb..e3dd431e7 100644
--- a/configs/topologies/Crossbar.py
+++ b/configs/topologies/Crossbar.py
@@ -34,19 +34,22 @@ from BaseTopology import SimpleTopology
class Crossbar(SimpleTopology):
description='Crossbar'
- 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
- # external links do not model outgoing bandwidth in the simple network, but
- # internal links do.
+ def makeTopology(self, options, network, 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 external links do not model outgoing bandwidth in the
+ # simple network, but internal links do.
routers = [Router(router_id=i) for i in range(len(self.nodes)+1)]
+ xbar = routers[len(self.nodes)] # the crossbar router is the last router created
+ network.routers = routers
+
ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i])
for (i, n) in enumerate(self.nodes)]
+ network.ext_links = ext_links
+
link_count = len(self.nodes)
- xbar = routers[len(self.nodes)] # the crossbar router is the last router created
int_links = [IntLink(link_id=(link_count+i),
node_a=routers[i], node_b=xbar)
for i in range(len(self.nodes))]
-
- return routers, int_links, ext_links
+ network.int_links = int_links
diff --git a/configs/topologies/Mesh.py b/configs/topologies/Mesh.py
index 81d87f5e5..446fc4a18 100644
--- a/configs/topologies/Mesh.py
+++ b/configs/topologies/Mesh.py
@@ -39,7 +39,7 @@ class Mesh(SimpleTopology):
# Makes a generic mesh assuming an equal number of cache and directory cntrls
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
num_routers = options.num_cpus
@@ -54,6 +54,7 @@ class Mesh(SimpleTopology):
# Create the routers in the mesh
routers = [Router(router_id=i) for i in range(num_routers)]
+ network.routers = routers
# link counter to set unique link ids
link_count = 0
@@ -86,6 +87,8 @@ class Mesh(SimpleTopology):
int_node=routers[0]))
link_count += 1
+ network.ext_links = ext_links
+
# Create the mesh links. First row (east-west) links then column
# (north-south) links
int_links = []
@@ -111,4 +114,4 @@ class Mesh(SimpleTopology):
weight=2))
link_count += 1
- return routers, int_links, ext_links
+ network.int_links = int_links
diff --git a/configs/topologies/MeshDirCorners.py b/configs/topologies/MeshDirCorners.py
index 13b4acc19..40720004e 100644
--- a/configs/topologies/MeshDirCorners.py
+++ b/configs/topologies/MeshDirCorners.py
@@ -42,7 +42,7 @@ class MeshDirCorners(SimpleTopology):
# configurations. The network specified is similar to GEMS old file
# specified network.
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
num_routers = options.num_cpus
@@ -74,6 +74,7 @@ class MeshDirCorners(SimpleTopology):
# Create the routers in the mesh
routers = [Router(router_id=i) for i in range(num_routers)]
+ network.routers = routers
# link counter to set unique link ids
link_count = 0
@@ -104,7 +105,10 @@ class MeshDirCorners(SimpleTopology):
# Connect the dma nodes to router 0. These should only be DMA nodes.
for (i, node) in enumerate(dma_nodes):
assert(node.type == 'DMA_Controller')
- ext_links.append(ExtLink(link_id=link_count, ext_node=node, int_node=routers[0]))
+ ext_links.append(ExtLink(link_id=link_count, ext_node=node,
+ int_node=routers[0]))
+
+ network.ext_links = ext_links
# Create the mesh links. First row (east-west) links then column
# (north-south) links
@@ -131,4 +135,4 @@ class MeshDirCorners(SimpleTopology):
weight=2))
link_count += 1
- return routers, int_links, ext_links
+ network.int_links = int_links
diff --git a/configs/topologies/Pt2Pt.py b/configs/topologies/Pt2Pt.py
index 74ff116ff..8fada26bf 100644
--- a/configs/topologies/Pt2Pt.py
+++ b/configs/topologies/Pt2Pt.py
@@ -39,15 +39,18 @@ class Pt2Pt(SimpleTopology):
def __init__(self, controllers):
self.nodes = controllers
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
- # Create an individual router for each controller, and connect all to all.
+ # Create an individual router for each controller, and connect all to all.
routers = [Router(router_id=i) for i in range(len(nodes))]
+ network.routers = routers
+
ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i])
for (i, n) in enumerate(nodes)]
- link_count = len(nodes)
+ network.ext_links = ext_links
+ link_count = len(nodes)
int_links = []
for i in xrange(len(nodes)):
for j in xrange(len(nodes)):
@@ -57,4 +60,4 @@ class Pt2Pt(SimpleTopology):
node_a=routers[i],
node_b=routers[j]))
- return routers, int_links, ext_links
+ network.int_links = int_links
diff --git a/configs/topologies/Torus.py b/configs/topologies/Torus.py
index 9869465ae..db67d3ede 100644
--- a/configs/topologies/Torus.py
+++ b/configs/topologies/Torus.py
@@ -44,7 +44,7 @@ class Torus(SimpleTopology):
# All links (including the wrap-around ones) are of equal length, double that
# of a mesh. Thus, each link is assigned a latency of 2 cycles.
- def makeTopology(self, options, IntLink, ExtLink, Router):
+ def makeTopology(self, options, network, IntLink, ExtLink, Router):
nodes = self.nodes
num_routers = options.num_cpus
@@ -59,6 +59,7 @@ class Torus(SimpleTopology):
# Create the routers in the torus
routers = [Router(router_id=i) for i in range(num_routers)]
+ network.routers = routers
# link counter to set unique link ids
link_count = 0
@@ -91,6 +92,8 @@ class Torus(SimpleTopology):
int_node=routers[0]))
link_count += 1
+ network.ext_links = ext_links
+
# Create the torus links. First row (east-west) links then column
# (north-south) links
# column links are given higher weights to implement XY routing
@@ -123,4 +126,4 @@ class Torus(SimpleTopology):
weight=2))
link_count += 1
- return routers, int_links, ext_links
+ network.int_links = int_links