summaryrefslogtreecommitdiff
path: root/configs/ruby/Ruby.py
diff options
context:
space:
mode:
authorTushar Krishna <tushar@ece.gatech.edu>2016-10-06 14:35:17 -0400
committerTushar Krishna <tushar@ece.gatech.edu>2016-10-06 14:35:17 -0400
commitb9e23a6d741cdcdf0ffb7364c6aae36a487335ef (patch)
treed81337a49324e0aa1829308aa76a93e8b3144997 /configs/ruby/Ruby.py
parent0f68b50ff11a957a9c8d31b592c75e659f8a1023 (diff)
downloadgem5-b9e23a6d741cdcdf0ffb7364c6aae36a487335ef.tar.xz
config: add a separate config file for the network.
This patch adds a new file configs/network/Network.py to setup the network, instead of doing that within Ruby.py.
Diffstat (limited to 'configs/ruby/Ruby.py')
-rw-r--r--configs/ruby/Ruby.py66
1 files changed, 14 insertions, 52 deletions
diff --git a/configs/ruby/Ruby.py b/configs/ruby/Ruby.py
index 1a8360f23..2670c678a 100644
--- a/configs/ruby/Ruby.py
+++ b/configs/ruby/Ruby.py
@@ -47,6 +47,9 @@ from m5.util import addToPath, fatal
import MemConfig
addToPath('../topologies')
+addToPath('../network')
+
+import Network
def define_options(parser):
# By default, ruby uses the simple timing cpu
@@ -64,15 +67,7 @@ def define_options(parser):
help="used of transitions per cycle which is a proxy \
for the number of ports.")
- # ruby network options
- parser.add_option("--topology", type="string", default="Crossbar",
- help="check configs/topologies for complete set")
- parser.add_option("--mesh-rows", type="int", default=1,
- help="the number of rows in the mesh topology")
- parser.add_option("--garnet-network", type="choice",
- choices=['fixed', 'flexible'], help="'fixed'|'flexible'")
- parser.add_option("--network-fault-model", action="store_true", default=False,
- help="enable network fault model: see src/mem/ruby/network/fault_model/")
+ # network options are in network/Network.py
# ruby mapping options
parser.add_option("--numa-high-bit", type="int", default=0,
@@ -155,31 +150,9 @@ def create_system(options, full_system, system, piobus = None, dma_ports = []):
system.ruby = RubySystem()
ruby = system.ruby
- # Set the network classes based on the command line options
- if options.garnet_network == "fixed":
- NetworkClass = GarnetNetwork_d
- IntLinkClass = GarnetIntLink_d
- ExtLinkClass = GarnetExtLink_d
- RouterClass = GarnetRouter_d
- InterfaceClass = GarnetNetworkInterface_d
-
- elif options.garnet_network == "flexible":
- NetworkClass = GarnetNetwork
- IntLinkClass = GarnetIntLink
- ExtLinkClass = GarnetExtLink
- RouterClass = GarnetRouter
- InterfaceClass = GarnetNetworkInterface
-
- else:
- NetworkClass = SimpleNetwork
- IntLinkClass = SimpleIntLink
- ExtLinkClass = SimpleExtLink
- RouterClass = Switch
- InterfaceClass = None
-
- # Instantiate the network object so that the controllers can connect to it.
- network = NetworkClass(ruby_system = ruby, topology = options.topology,
- routers = [], ext_links = [], int_links = [], netifs = [])
+ # Create the network object
+ (network, IntLinkClass, ExtLinkClass, RouterClass, InterfaceClass) = \
+ Network.create_network(options, ruby)
ruby.network = network
protocol = buildEnv['PROTOCOL']
@@ -193,6 +166,13 @@ def create_system(options, full_system, system, piobus = None, dma_ports = []):
print "Error: could not create sytem for ruby protocol %s" % protocol
raise
+ # Create the network topology
+ topology.makeTopology(options, network, IntLinkClass, ExtLinkClass,
+ RouterClass)
+
+ # Initialize network based on topology
+ Network.init_network(options, network, InterfaceClass)
+
# Create a port proxy for connecting the system port. This is
# independent of the protocol and kept in the protocol-agnostic
# part (i.e. here).
@@ -207,24 +187,6 @@ def create_system(options, full_system, system, piobus = None, dma_ports = []):
# Connect the system port for loading of binaries etc
system.system_port = system.sys_port_proxy.slave
- # Create the network topology
- topology.makeTopology(options, network, IntLinkClass, ExtLinkClass,
- RouterClass)
-
- if options.garnet_network is None:
- assert(NetworkClass == SimpleNetwork)
- assert(RouterClass == Switch)
- network.setup_buffers()
-
- if InterfaceClass != None:
- netifs = [InterfaceClass(id=i) for (i,n) in enumerate(network.ext_links)]
- network.netifs = netifs
-
- if options.network_fault_model:
- assert(options.garnet_network == "fixed")
- network.enable_fault_model = True
- network.fault_model = FaultModel()
-
setup_memory_controllers(system, ruby, dir_cntrls, options)
# Connect the cpu sequencers and the piobus