+from m5.util import addToPath, fatal
+
+addToPath('../topologies')
+
+def define_options(parser):
+ # By default, ruby uses the simple timing cpu
+ parser.set_defaults(cpu_type="timing")
+
+ parser.add_option("--ruby-clock", action="store", type="string",
+ default='2GHz',
+ help="Clock for blocks running at Ruby system's speed")
+
+ # Options related to cache structure
+ parser.add_option("--ports", action="store", type="int", default=4,
+ 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 src/mem/ruby/network/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/")
+
+ # ruby mapping options
+ parser.add_option("--numa-high-bit", type="int", default=0,
+ help="high order address bit to use for numa mapping. " \
+ "0 = highest bit, not specified = lowest bit")
+
+ # ruby sparse memory options
+ parser.add_option("--use-map", action="store_true", default=False)
+ parser.add_option("--map-levels", type="int", default=4)
+
+ parser.add_option("--recycle-latency", type="int", default=10,
+ help="Recycle latency for ruby controller input buffers")
+
+ parser.add_option("--random_seed", type="int", default=1234,
+ help="Used for seeding the random number generator")
+
+ parser.add_option("--ruby_stats", type="string", default="ruby.stats")
+
+ protocol = buildEnv['PROTOCOL']
+ 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 = []):