summaryrefslogtreecommitdiff
path: root/configs/ruby
diff options
context:
space:
mode:
authorBrad Beckmann <Brad.Beckmann@amd.com>2012-07-10 22:51:53 -0700
committerBrad Beckmann <Brad.Beckmann@amd.com>2012-07-10 22:51:53 -0700
commit11b725c19da4d08ae471678f6da867c67e3c15b5 (patch)
tree58bd0ebd09b404f0e860531bda80195f234d0bf2 /configs/ruby
parent745274cbd4851b3bf725b24138c1fd13746492ec (diff)
downloadgem5-11b725c19da4d08ae471678f6da867c67e3c15b5.tar.xz
ruby: changes how Topologies are created
Instead of just passing a list of controllers to the makeTopology function in src/mem/ruby/network/topologies/<Topo>.py we pass in a function pointer which knows how to make the topology, possibly with some extra state set in the configs/ruby/<protocol>.py file. Thus, we can move all of the files from network/topologies to configs/topologies. A new class BaseTopology is added which all topologies in configs/topologies must inheirit from and follow its API. --HG-- rename : src/mem/ruby/network/topologies/Crossbar.py => configs/topologies/Crossbar.py rename : src/mem/ruby/network/topologies/Mesh.py => configs/topologies/Mesh.py rename : src/mem/ruby/network/topologies/MeshDirCorners.py => configs/topologies/MeshDirCorners.py rename : src/mem/ruby/network/topologies/Pt2Pt.py => configs/topologies/Pt2Pt.py rename : src/mem/ruby/network/topologies/Torus.py => configs/topologies/Torus.py
Diffstat (limited to 'configs/ruby')
-rw-r--r--configs/ruby/MESI_CMP_directory.py5
-rw-r--r--configs/ruby/MI_example.py5
-rw-r--r--configs/ruby/MOESI_CMP_directory.py5
-rw-r--r--configs/ruby/MOESI_CMP_token.py5
-rw-r--r--configs/ruby/MOESI_hammer.py5
-rw-r--r--configs/ruby/Network_test.py5
-rw-r--r--configs/ruby/Ruby.py28
7 files changed, 43 insertions, 15 deletions
diff --git a/configs/ruby/MESI_CMP_directory.py b/configs/ruby/MESI_CMP_directory.py
index cd503ddc9..d877543c0 100644
--- a/configs/ruby/MESI_CMP_directory.py
+++ b/configs/ruby/MESI_CMP_directory.py
@@ -31,6 +31,7 @@ import math
import m5
from m5.objects import *
from m5.defines import buildEnv
+from Ruby import create_topology
#
# Note: the L1 Cache latency is only used by the sequencer on fast path hits
@@ -185,4 +186,6 @@ def create_system(options, system, piobus, dma_ports, ruby_system):
dir_cntrl_nodes + \
dma_cntrl_nodes
- return (cpu_sequencers, dir_cntrl_nodes, all_cntrls)
+ topology = create_topology(all_cntrls, options)
+
+ return (cpu_sequencers, dir_cntrl_nodes, topology)
diff --git a/configs/ruby/MI_example.py b/configs/ruby/MI_example.py
index de82c38f6..4fb55b89f 100644
--- a/configs/ruby/MI_example.py
+++ b/configs/ruby/MI_example.py
@@ -31,6 +31,7 @@ import math
import m5
from m5.objects import *
from m5.defines import buildEnv
+from Ruby import create_topology
#
# Note: the cache latency is only used by the sequencer on fast path hits
@@ -155,4 +156,6 @@ def create_system(options, system, piobus, dma_ports, ruby_system):
all_cntrls = l1_cntrl_nodes + dir_cntrl_nodes + dma_cntrl_nodes
- return (cpu_sequencers, dir_cntrl_nodes, all_cntrls)
+ topology = create_topology(all_cntrls, options)
+
+ return (cpu_sequencers, dir_cntrl_nodes, topology)
diff --git a/configs/ruby/MOESI_CMP_directory.py b/configs/ruby/MOESI_CMP_directory.py
index 10eeaf21a..bce7be5d6 100644
--- a/configs/ruby/MOESI_CMP_directory.py
+++ b/configs/ruby/MOESI_CMP_directory.py
@@ -31,6 +31,7 @@ import math
import m5
from m5.objects import *
from m5.defines import buildEnv
+from Ruby import create_topology
#
# Note: the L1 Cache latency is only used by the sequencer on fast path hits
@@ -182,4 +183,6 @@ def create_system(options, system, piobus, dma_ports, ruby_system):
dir_cntrl_nodes + \
dma_cntrl_nodes
- return (cpu_sequencers, dir_cntrl_nodes, all_cntrls)
+ topology = create_topology(all_cntrls, options)
+
+ return (cpu_sequencers, dir_cntrl_nodes, topology)
diff --git a/configs/ruby/MOESI_CMP_token.py b/configs/ruby/MOESI_CMP_token.py
index 4da7d7adf..51cc5fb92 100644
--- a/configs/ruby/MOESI_CMP_token.py
+++ b/configs/ruby/MOESI_CMP_token.py
@@ -31,6 +31,7 @@ import math
import m5
from m5.objects import *
from m5.defines import buildEnv
+from Ruby import create_topology
#
# Note: the L1 Cache latency is only used by the sequencer on fast path hits
@@ -206,4 +207,6 @@ def create_system(options, system, piobus, dma_ports, ruby_system):
dir_cntrl_nodes + \
dma_cntrl_nodes
- return (cpu_sequencers, dir_cntrl_nodes, all_cntrls)
+ topology = create_topology(all_cntrls, options)
+
+ return (cpu_sequencers, dir_cntrl_nodes, topology)
diff --git a/configs/ruby/MOESI_hammer.py b/configs/ruby/MOESI_hammer.py
index 622296289..48129c0a4 100644
--- a/configs/ruby/MOESI_hammer.py
+++ b/configs/ruby/MOESI_hammer.py
@@ -31,6 +31,7 @@ import math
import m5
from m5.objects import *
from m5.defines import buildEnv
+from Ruby import create_topology
#
# Note: the L1 Cache latency is only used by the sequencer on fast path hits
@@ -219,4 +220,6 @@ def create_system(options, system, piobus, dma_ports, ruby_system):
all_cntrls = l1_cntrl_nodes + dir_cntrl_nodes + dma_cntrl_nodes
- return (cpu_sequencers, dir_cntrl_nodes, all_cntrls)
+ topology = create_topology(all_cntrls, options)
+
+ return (cpu_sequencers, dir_cntrl_nodes, topology)
diff --git a/configs/ruby/Network_test.py b/configs/ruby/Network_test.py
index b84fabde6..6eae52e86 100644
--- a/configs/ruby/Network_test.py
+++ b/configs/ruby/Network_test.py
@@ -31,6 +31,7 @@ import m5
from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
+from Ruby import create_topology
#
# Note: the cache latency is only used by the sequencer on fast path hits
@@ -135,4 +136,6 @@ def create_system(options, system, piobus, dma_ports, ruby_system):
all_cntrls = l1_cntrl_nodes + dir_cntrl_nodes
- return (cpu_sequencers, dir_cntrl_nodes, all_cntrls)
+ topology = create_topology(all_cntrls, options)
+
+ return (cpu_sequencers, dir_cntrl_nodes, topology)
diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py
index 87939fac8..82b8d0111 100644
--- a/configs/ruby/Ruby.py
+++ b/configs/ruby/Ruby.py
@@ -79,6 +79,16 @@ def define_options(parser):
exec "import %s" % protocol
eval("%s.define_options(parser)" % protocol)
+def create_topology(controllers, options):
+ """ Called from create_system in configs/ruby/<protocol>.py
+ Must return an object which is a subclass of BaseTopology
+ found in configs/topologies/BaseTopology.py
+ This is a wrapper for the legacy topologies.
+ """
+ exec "import %s as Topo" % options.topology
+ topology = eval("Topo.%s(controllers)" % options.topology)
+ return topology
+
def create_system(options, system, piobus = None, dma_ports = []):
system.ruby = RubySystem(clock = options.clock,
@@ -89,7 +99,7 @@ def create_system(options, system, piobus = None, dma_ports = []):
protocol = buildEnv['PROTOCOL']
exec "import %s" % protocol
try:
- (cpu_sequencers, dir_cntrls, all_cntrls) = \
+ (cpu_sequencers, dir_cntrls, topology) = \
eval("%s.create_system(options, system, piobus, dma_ports, ruby)"
% protocol)
except:
@@ -128,17 +138,17 @@ def create_system(options, system, piobus = None, dma_ports = []):
class RouterClass(BasicRouter): pass
#
- # Important: the topology must be created before the network and after the
- # controllers.
+ # Important: the topology must be instantiated before the network and after
+ # the controllers. Hence the separation between topology definition and
+ # instantiation. TopologyCreator is in src/mem/ruby/network/topologies/.
#
- exec "import %s" % options.topology
+ from TopologyCreator import instantiateTopology
try:
- net_topology = eval("%s.makeTopology(all_cntrls, options, \
- IntLinkClass, ExtLinkClass, \
- RouterClass)" \
- % options.topology)
+ net_topology = instantiateTopology(topology, options, \
+ IntLinkClass, ExtLinkClass, \
+ RouterClass)
except:
- print "Error: could not create topology %s" % options.topology
+ print "Error: could not make topology %s" % options.topology
raise
if options.network_fault_model: