+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(no_mem_vec = options.use_map)
+ 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 = [])
+ ruby.network = network