summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/topologies
diff options
context:
space:
mode:
authorNathan Binkert <nate@binkert.org>2010-03-31 16:56:45 -0700
committerNathan Binkert <nate@binkert.org>2010-03-31 16:56:45 -0700
commitbe10204729c107b41d5d7487323c732e9fa09df5 (patch)
tree5c8f4001c490c4d777e8756e536cd2f2340c9ebb /src/mem/ruby/network/topologies
parent60ae1d2b10002bb73b420fce91c4b74397c55457 (diff)
downloadgem5-be10204729c107b41d5d7487323c732e9fa09df5.tar.xz
style: another ruby style pass
Diffstat (limited to 'src/mem/ruby/network/topologies')
-rw-r--r--src/mem/ruby/network/topologies/Crossbar.py2
-rw-r--r--src/mem/ruby/network/topologies/Mesh.py19
-rw-r--r--src/mem/ruby/network/topologies/MeshDirCorners.py41
-rw-r--r--src/mem/ruby/network/topologies/SConscript2
4 files changed, 22 insertions, 42 deletions
diff --git a/src/mem/ruby/network/topologies/Crossbar.py b/src/mem/ruby/network/topologies/Crossbar.py
index 18c8be251..86c53cdef 100644
--- a/src/mem/ruby/network/topologies/Crossbar.py
+++ b/src/mem/ruby/network/topologies/Crossbar.py
@@ -33,7 +33,7 @@ def makeTopology(nodes, options):
ext_links = [ExtLink(ext_node=n, int_node=i)
for (i, n) in enumerate(nodes)]
xbar = len(nodes) # node ID for crossbar switch
- int_links = [IntLink(node_a=i, node_b=xbar) for i in range(len(nodes))]
+ int_links = [IntLink(node_a=i, node_b=xbar) for i in range(len(nodes))]
return Topology(ext_links=ext_links, int_links=int_links,
num_int_nodes=len(nodes)+1)
diff --git a/src/mem/ruby/network/topologies/Mesh.py b/src/mem/ruby/network/topologies/Mesh.py
index 6871bec1f..57913e778 100644
--- a/src/mem/ruby/network/topologies/Mesh.py
+++ b/src/mem/ruby/network/topologies/Mesh.py
@@ -29,28 +29,22 @@
from m5.params import *
from m5.objects import *
-#
# Makes a generic mesh assuming an equal number of cache and directory cntrls
-#
def makeTopology(nodes, options):
num_routers = options.num_cpus
num_rows = options.mesh_rows
-
- #
+
# There must be an evenly divisible number of cntrls to routers
# Also, obviously the number or rows must be <= the number of routers
- #
cntrls_per_router, remainder = divmod(len(nodes), num_routers)
assert(num_rows <= num_routers)
num_columns = int(num_routers / num_rows)
assert(num_columns * num_rows == num_routers)
- #
# Add all but the remainder nodes to the list of nodes to be uniformly
# distributed across the network.
- #
network_nodes = []
remainder_nodes = []
for node_index in xrange(len(nodes)):
@@ -59,27 +53,22 @@ def makeTopology(nodes, options):
else:
remainder_nodes.append(nodes[node_index])
- #
# Connect each node to the appropriate router
- #
ext_links = []
for (i, n) in enumerate(network_nodes):
cntrl_level, router_id = divmod(i, num_routers)
assert(cntrl_level < cntrls_per_router)
ext_links.append(ExtLink(ext_node=n, int_node=router_id))
- #
- # Connect the remainding nodes to router 0. These should only be DMA nodes.
- #
+ # Connect the remainding nodes to router 0. These should only be
+ # DMA nodes.
for (i, node) in enumerate(remainder_nodes):
assert(node.type == 'DMA_Controller')
assert(i < remainder)
ext_links.append(ExtLink(ext_node=node, int_node=0))
-
- #
+
# Create the mesh links. First row (east-west) links then column
# (north-south) links
- #
int_links = []
for row in xrange(num_rows):
for col in xrange(num_columns):
diff --git a/src/mem/ruby/network/topologies/MeshDirCorners.py b/src/mem/ruby/network/topologies/MeshDirCorners.py
index 8b08241ae..b87b749f6 100644
--- a/src/mem/ruby/network/topologies/MeshDirCorners.py
+++ b/src/mem/ruby/network/topologies/MeshDirCorners.py
@@ -29,20 +29,16 @@
from m5.params import *
from m5.objects import *
-#
-# This file contains a special network creation function. This networks is not
-# general and will only work with specific system configurations. The network
-# specified is similar to GEMS old file specified network.
-#
+# This file contains a special network creation function. This
+# networks is not general and will only work with specific system
+# configurations. The network specified is similar to GEMS old file
+# specified network.
def makeTopology(nodes, options):
-
num_routers = options.num_cpus
num_rows = options.mesh_rows
-
- #
+
# First determine which nodes are cache cntrls vs. dirs vs. dma
- #
cache_nodes = []
dir_nodes = []
dma_nodes = []
@@ -54,12 +50,11 @@ def makeTopology(nodes, options):
dir_nodes.append(node)
elif node.type == 'DMA_Controller':
dma_nodes.append(node)
-
- #
- # Obviously the number or rows must be <= the number of routers and evenly
- # divisible. Also the number of caches must be a multiple of the number of
- # routers and the number of directories must be four.
- #
+
+ # Obviously the number or rows must be <= the number of routers
+ # and evenly divisible. Also the number of caches must be a
+ # multiple of the number of routers and the number of directories
+ # must be four.
assert(num_rows <= num_routers)
num_columns = int(num_routers / num_rows)
assert(num_columns * num_rows == num_routers)
@@ -67,37 +62,31 @@ def makeTopology(nodes, options):
assert(remainder == 0)
assert(len(dir_nodes) == 4)
- #
# Connect each cache controller to the appropriate router
- #
ext_links = []
for (i, n) in enumerate(cache_nodes):
cntrl_level, router_id = divmod(i, num_routers)
assert(cntrl_level < caches_per_router)
ext_links.append(ExtLink(ext_node=n, int_node=router_id))
- #
# Connect the dir nodes to the corners.
- #
ext_links.append(ExtLink(ext_node=dir_nodes[0], int_node=0))
- ext_links.append(ExtLink(ext_node=dir_nodes[1], int_node=(num_columns - 1)))
+ ext_links.append(ExtLink(ext_node=dir_nodes[1],
+ int_node=(num_columns - 1)))
ext_links.append(ExtLink(ext_node=dir_nodes[2],
int_node=(num_routers - num_columns)))
- ext_links.append(ExtLink(ext_node=dir_nodes[3], int_node=(num_routers - 1)))
+ ext_links.append(ExtLink(ext_node=dir_nodes[3],
+ int_node=(num_routers - 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=0))
-
- #
+
# Create the mesh links. First row (east-west) links then column
# (north-south) links
- #
int_links = []
for row in xrange(num_rows):
for col in xrange(num_columns):
diff --git a/src/mem/ruby/network/topologies/SConscript b/src/mem/ruby/network/topologies/SConscript
index 71ee7809c..649769ed0 100644
--- a/src/mem/ruby/network/topologies/SConscript
+++ b/src/mem/ruby/network/topologies/SConscript
@@ -1,3 +1,5 @@
+# -*- mode:python -*-
+
# Copyright (c) 2010 Advanced Micro Devices, Inc.
# All rights reserved.
#