summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mem/ruby/network/topologies/Crossbar.py17
-rw-r--r--src/mem/ruby/network/topologies/Mesh.py25
-rw-r--r--src/mem/ruby/network/topologies/MeshDirCorners.py30
-rw-r--r--src/mem/ruby/network/topologies/Pt2Pt.py16
-rw-r--r--src/mem/ruby/network/topologies/Torus.py24
5 files changed, 63 insertions, 49 deletions
diff --git a/src/mem/ruby/network/topologies/Crossbar.py b/src/mem/ruby/network/topologies/Crossbar.py
index 8aa6c3504..04e01ee1c 100644
--- a/src/mem/ruby/network/topologies/Crossbar.py
+++ b/src/mem/ruby/network/topologies/Crossbar.py
@@ -37,14 +37,15 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
# 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(nodes)+1)]
- ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i])
- for (i, n) in enumerate(nodes)]
+ cb = Crossbar()
+ cb.routers = [Router(router_id=i) for i in range(len(nodes)+1)]
+ cb.ext_links = [ExtLink(link_id=i, ext_node=n, int_node=cb.routers[i])
+ for (i, n) in enumerate(nodes)]
link_count = len(nodes)
- xbar = routers[len(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(nodes))]
- return Crossbar(ext_links=ext_links, int_links=int_links,
- routers=routers)
+ xbar = cb.routers[len(nodes)] # the crossbar router is the last router created
+ cb.int_links = [IntLink(link_id=(link_count+i),
+ node_a=cb.routers[i], node_b=xbar)
+ for i in range(len(nodes))]
+ return cb
diff --git a/src/mem/ruby/network/topologies/Mesh.py b/src/mem/ruby/network/topologies/Mesh.py
index 20f3bba31..fa6e63354 100644
--- a/src/mem/ruby/network/topologies/Mesh.py
+++ b/src/mem/ruby/network/topologies/Mesh.py
@@ -46,8 +46,11 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
num_columns = int(num_routers / num_rows)
assert(num_columns * num_rows == num_routers)
+ # Create the mesh object
+ mesh = Mesh()
+
# Create the routers in the mesh
- routers = [Router(router_id=i) for i in range(num_routers)]
+ mesh.routers = [Router(router_id=i) for i in range(num_routers)]
# link counter to set unique link ids
link_count = 0
@@ -68,7 +71,7 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
cntrl_level, router_id = divmod(i, num_routers)
assert(cntrl_level < cntrls_per_router)
ext_links.append(ExtLink(link_id=link_count, ext_node=n,
- int_node=routers[router_id]))
+ int_node=mesh.routers[router_id]))
link_count += 1
# Connect the remainding nodes to router 0. These should only be
@@ -77,7 +80,7 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
assert(node.type == 'DMA_Controller')
assert(i < remainder)
ext_links.append(ExtLink(link_id=link_count, ext_node=node,
- int_node=routers[0]))
+ int_node=mesh.routers[0]))
link_count += 1
# Create the mesh links. First row (east-west) links then column
@@ -89,8 +92,8 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
east_id = col + (row * num_columns)
west_id = (col + 1) + (row * num_columns)
int_links.append(IntLink(link_id=link_count,
- node_a=routers[east_id],
- node_b=routers[west_id],
+ node_a=mesh.routers[east_id],
+ node_b=mesh.routers[west_id],
weight=1))
link_count += 1
@@ -100,10 +103,12 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
north_id = col + (row * num_columns)
south_id = col + ((row + 1) * num_columns)
int_links.append(IntLink(link_id=link_count,
- node_a=routers[north_id],
- node_b=routers[south_id],
+ node_a=mesh.routers[north_id],
+ node_b=mesh.routers[south_id],
weight=2))
link_count += 1
- return Mesh(ext_links=ext_links,
- int_links=int_links,
- routers=routers)
+
+ mesh.int_links = int_links
+ mesh.ext_links = ext_links
+
+ return mesh
diff --git a/src/mem/ruby/network/topologies/MeshDirCorners.py b/src/mem/ruby/network/topologies/MeshDirCorners.py
index 1234d61c5..f9d302d19 100644
--- a/src/mem/ruby/network/topologies/MeshDirCorners.py
+++ b/src/mem/ruby/network/topologies/MeshDirCorners.py
@@ -65,8 +65,10 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
assert(remainder == 0)
assert(len(dir_nodes) == 4)
+ mesh = MeshDirCorners()
+
# Create the routers in the mesh
- routers = [Router(router_id=i) for i in range(num_routers)]
+ mesh.routers = [Router(router_id=i) for i in range(num_routers)]
# link counter to set unique link ids
link_count = 0
@@ -77,27 +79,27 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
cntrl_level, router_id = divmod(i, num_routers)
assert(cntrl_level < caches_per_router)
ext_links.append(ExtLink(link_id=link_count, ext_node=n,
- int_node=routers[router_id]))
+ int_node=mesh.routers[router_id]))
link_count += 1
# Connect the dir nodes to the corners.
ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[0],
- int_node=routers[0]))
+ int_node=mesh.routers[0]))
link_count += 1
ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[1],
- int_node=routers[num_columns - 1]))
+ int_node=mesh.routers[num_columns - 1]))
link_count += 1
ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[2],
- int_node=routers[num_routers - num_columns]))
+ int_node=mesh.routers[num_routers - num_columns]))
link_count += 1
ext_links.append(ExtLink(link_id=link_count, ext_node=dir_nodes[3],
- int_node=routers[num_routers - 1]))
+ int_node=mesh.routers[num_routers - 1]))
link_count += 1
# 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(ext_node=node, int_node=routers[0]))
+ ext_links.append(ExtLink(ext_node=node, int_node=mesh.routers[0]))
# Create the mesh links. First row (east-west) links then column
# (north-south) links
@@ -108,8 +110,8 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
east_id = col + (row * num_columns)
west_id = (col + 1) + (row * num_columns)
int_links.append(IntLink(link_id=link_count,
- node_a=routers[east_id],
- node_b=routers[west_id],
+ node_a=mesh.routers[east_id],
+ node_b=mesh.routers[west_id],
weight=1))
link_count += 1
@@ -119,12 +121,12 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
north_id = col + (row * num_columns)
south_id = col + ((row + 1) * num_columns)
int_links.append(IntLink(link_id=link_count,
- node_a=routers[north_id],
- node_b=routers[south_id],
+ node_a=mesh.routers[north_id],
+ node_b=mesh.routers[south_id],
weight=2))
link_count += 1
- return MeshDirCorners(ext_links=ext_links,
- int_links=int_links,
- routers=routers)
+ mesh.ext_links = ext_links
+ mesh.int_links = int_links
+ return mesh
diff --git a/src/mem/ruby/network/topologies/Pt2Pt.py b/src/mem/ruby/network/topologies/Pt2Pt.py
index ecab96d74..f6ca13626 100644
--- a/src/mem/ruby/network/topologies/Pt2Pt.py
+++ b/src/mem/ruby/network/topologies/Pt2Pt.py
@@ -36,8 +36,9 @@ class Pt2Pt(Topology):
def makeTopology(nodes, options, IntLink, ExtLink, Router):
# Create an individual router for each controller, and connect all to all.
- routers = [Router(router_id=i) for i in range(len(nodes))]
- ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i])
+ pt2pt = Pt2Pt()
+ pt2pt.routers = [Router(router_id=i) for i in range(len(nodes))]
+ ext_links = [ExtLink(link_id=i, ext_node=n, int_node=pt2pt.routers[i])
for (i, n) in enumerate(nodes)]
link_count = len(nodes)
@@ -47,9 +48,10 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
if (i != j):
link_count += 1
int_links.append(IntLink(link_id=link_count,
- node_a=routers[i],
- node_b=routers[j]))
+ node_a=pt2pt.routers[i],
+ node_b=pt2pt.routers[j]))
- return Pt2Pt(ext_links=ext_links,
- int_links=int_links,
- routers=routers)
+ pt2pt.ext_links = ext_links
+ pt2pt.int_links = int_links
+
+ return pt2pt
diff --git a/src/mem/ruby/network/topologies/Torus.py b/src/mem/ruby/network/topologies/Torus.py
index 636e4636b..f3583bfc1 100644
--- a/src/mem/ruby/network/topologies/Torus.py
+++ b/src/mem/ruby/network/topologies/Torus.py
@@ -51,8 +51,11 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
num_columns = int(num_routers / num_rows)
assert(num_columns * num_rows == num_routers)
+ # Create the torus object
+ torus = Torus()
+
# Create the routers in the torus
- routers = [Router(router_id=i) for i in range(num_routers)]
+ torus.routers = [Router(router_id=i) for i in range(num_routers)]
# link counter to set unique link ids
link_count = 0
@@ -73,7 +76,7 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
cntrl_level, router_id = divmod(i, num_routers)
assert(cntrl_level < cntrls_per_router)
ext_links.append(ExtLink(link_id=link_count, ext_node=n,
- int_node=routers[router_id]))
+ int_node=torus.routers[router_id]))
link_count += 1
# Connect the remainding nodes to router 0. These should only be
@@ -82,7 +85,7 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
assert(node.type == 'DMA_Controller')
assert(i < remainder)
ext_links.append(ExtLink(link_id=link_count, ext_node=node,
- int_node=routers[0]))
+ int_node=torus.routers[0]))
link_count += 1
# Create the torus links. First row (east-west) links then column
@@ -97,8 +100,8 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
else:
east_id = (row * num_columns)
int_links.append(IntLink(link_id=link_count,
- node_a=routers[east_id],
- node_b=routers[west_id],
+ node_a=torus.routers[east_id],
+ node_b=torus.routers[west_id],
latency=2,
weight=1))
link_count += 1
@@ -111,12 +114,13 @@ def makeTopology(nodes, options, IntLink, ExtLink, Router):
else:
south_id = col
int_links.append(IntLink(link_id=link_count,
- node_a=routers[north_id],
- node_b=routers[south_id],
+ node_a=torus.routers[north_id],
+ node_b=torus.routers[south_id],
latency=2,
weight=2))
link_count += 1
- return Torus(ext_links=ext_links,
- int_links=int_links,
- routers=routers)
+ torus.ext_links = ext_links
+ torus.int_links = int_links
+
+ return torus