diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2013-09-06 16:21:33 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2013-09-06 16:21:33 -0500 |
commit | e9ae8b7d29e83fa2cad55006d2c6dc58115965cc (patch) | |
tree | c418f84ec5ed77be77ca84de9517126b5cfa4ad6 /configs/topologies/Cluster.py | |
parent | 24dc914d8758464ed6d757cf2830456562686be0 (diff) | |
download | gem5-e9ae8b7d29e83fa2cad55006d2c6dc58115965cc.tar.xz |
ruby: network: correct naming of routers
The routers are created before the network class. This results in the routers
becoming children of the first link they are connected to and they get generic
names like int_node and node_b. This patch creates the network object first
and passes it to the topology creation function. Now the routers are children
of the network object and names are much more sensible.
Diffstat (limited to 'configs/topologies/Cluster.py')
-rw-r--r-- | configs/topologies/Cluster.py | 19 |
1 files changed, 6 insertions, 13 deletions
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]) + \ |