summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/Network.py
diff options
context:
space:
mode:
authorSteve Reinhardt <steve.reinhardt@amd.com>2010-01-29 20:29:17 -0800
committerSteve Reinhardt <steve.reinhardt@amd.com>2010-01-29 20:29:17 -0800
commit0b54f1db8e8af9094229a55fab302ebfb84c31b5 (patch)
treefebc2db26bde0cb0dcd6ab168c29d08c5e04fb57 /src/mem/ruby/network/Network.py
parent184cf4db5b1354552de3960fd3becbeb7ef49767 (diff)
downloadgem5-0b54f1db8e8af9094229a55fab302ebfb84c31b5.tar.xz
ruby: Add support for generating topologies in Python.
Diffstat (limited to 'src/mem/ruby/network/Network.py')
-rw-r--r--src/mem/ruby/network/Network.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/mem/ruby/network/Network.py b/src/mem/ruby/network/Network.py
index 94115ebe8..8079032c6 100644
--- a/src/mem/ruby/network/Network.py
+++ b/src/mem/ruby/network/Network.py
@@ -30,12 +30,40 @@
from m5.params import *
from m5.SimObject import SimObject
+class Link(SimObject):
+ type = 'Link'
+ latency = Param.Int(1, "")
+ bw_multiplier = Param.Int("")
+ weight = Param.Int(1, "")
+
+class ExtLink(Link):
+ type = 'ExtLink'
+ ext_node = Param.RubyController("External node")
+ int_node = Param.Int("ID of internal node")
+ bw_multiplier = 64
+
+class IntLink(Link):
+ type = 'IntLink'
+ node_a = Param.Int("ID of internal node on one end")
+ node_b = Param.Int("ID of internal node on other end")
+ bw_multiplier = 16
+
class Topology(SimObject):
type = 'Topology'
- connections = Param.String("")
+ ext_links = VectorParam.ExtLink("Links to external nodes")
+ int_links = VectorParam.IntLink("Links between internal nodes")
+ num_int_nodes = Param.Int("Nunber of internal nodes")
print_config = Param.Bool(False,
"display topology config in the stats file")
+def makeCrossbar(nodes):
+ 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))]
+ return Topology(ext_links=ext_links, int_links=int_links,
+ num_int_nodes=len(nodes)+1)
+
class RubyNetwork(SimObject):
type = 'RubyNetwork'
cxx_class = 'Network'