ruby: network: move routers from topology to network
authorNilay Vaish <nilay@cs.wisc.edu>
Fri, 22 Mar 2013 20:53:22 +0000 (15:53 -0500)
committerNilay Vaish <nilay@cs.wisc.edu>
Fri, 22 Mar 2013 20:53:22 +0000 (15:53 -0500)
configs/ruby/Ruby.py
src/mem/ruby/network/Network.py
src/mem/ruby/network/Topology.cc
src/mem/ruby/network/garnet/fixed-pipeline/GarnetNetwork_d.cc
src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc
src/mem/ruby/network/simple/SimpleNetwork.cc

index 88a0acd499704ae664ab654b3ce6b82a734c2566..6859b044e85b34e906ad52d9882d5d3ea00263f5 100644 (file)
@@ -149,18 +149,17 @@ def create_system(options, system, piobus = None, dma_ports = []):
     routers, int_links, ext_links = topology.makeTopology(options,
                                     IntLinkClass, ExtLinkClass, RouterClass)
 
-    net_topology.routers = routers
+    net_topology.num_routers = len(routers)
     net_topology.int_links = int_links
     net_topology.ext_links = ext_links
 
+    network = NetworkClass(ruby_system = ruby, topology = net_topology,
+                           routers = routers)
 
     if options.network_fault_model:
         assert(options.garnet_network == "fixed")
-        fault_model = FaultModel()
-        network = NetworkClass(ruby_system = ruby, topology = net_topology,\
-                               enable_fault_model=True, fault_model = fault_model)
-    else:
-        network = NetworkClass(ruby_system = ruby, topology = net_topology)
+        network.enable_fault_model = True
+        network.fault_model = FaultModel()
 
     #
     # Loop through the directory controlers.
index a1313a8413b5dcf6eb287910c998ce2df577ac59..1d2e8ed9d62db58d4904ece2d30006917d9f48f4 100644 (file)
@@ -37,11 +37,9 @@ class Topology(SimObject):
     cxx_header = "mem/ruby/network/Topology.hh"
     description = Param.String("Not Specified",
                                "the name of the imported topology module")
+    num_routers = Param.UInt32("Number of routers in the network")
     ext_links = VectorParam.BasicExtLink("Links to external nodes")
     int_links = VectorParam.BasicIntLink("Links between internal nodes")
-    routers = VectorParam.BasicRouter("Network routers")
-    print_config = Param.Bool(False,
-        "display topology config in the stats file")
 
 class RubyNetwork(ClockedObject):
     type = 'RubyNetwork'
@@ -52,3 +50,4 @@ class RubyNetwork(ClockedObject):
     topology = Param.Topology("");
     control_msg_size = Param.Int(8, "");
     ruby_system = Param.RubySystem("");
+    routers = VectorParam.BasicRouter("Network routers")
index e80b76d8135fff4af368518b78ebd610a9c8e062..58114d14765d484db0085d1d4d313cb9f2320e63 100644 (file)
@@ -61,7 +61,7 @@ NetDest shortest_path_to_node(SwitchID src, SwitchID next,
 Topology::Topology(const Params *p)
     : SimObject(p)
 {
-    m_number_of_switches = p->routers.size();
+    m_number_of_switches = p->num_routers;
 
     // initialize component latencies record
     m_component_latencies.resize(0);
index f6fcc2514ede99cc8f1821a0bd251ed8b5932ed0..c4965af17a7f21410c37f374409a487bb638598e 100644 (file)
@@ -59,9 +59,8 @@ GarnetNetwork_d::GarnetNetwork_d(const Params *p)
     }
 
     // record the routers
-    for (vector<BasicRouter*>::const_iterator i = 
-             m_topology_ptr->params()->routers.begin();
-         i != m_topology_ptr->params()->routers.end(); ++i) {
+    for (vector<BasicRouter*>::const_iterator i =  p->routers.begin();
+         i != p->routers.end(); ++i) {
         Router_d* router = safe_cast<Router_d*>(*i);
         m_router_ptr_vector.push_back(router);
     }
@@ -115,7 +114,6 @@ GarnetNetwork_d::init()
             router->printFaultVector(cout);
         }
     }
-
 }
 
 GarnetNetwork_d::~GarnetNetwork_d()
index a60d2345783cc8b36f553ac8a18a284d07c427de..ed75a26d1221d8865b25f79fea1d16a7dad4d48a 100644 (file)
@@ -53,9 +53,8 @@ GarnetNetwork::GarnetNetwork(const Params *p)
     m_number_of_pipe_stages = p->number_of_pipe_stages;
 
     // record the routers
-    for (vector<BasicRouter*>::const_iterator i = 
-             m_topology_ptr->params()->routers.begin();
-         i != m_topology_ptr->params()->routers.end(); ++i) {
+    for (vector<BasicRouter*>::const_iterator i = p->routers.begin();
+         i != p->routers.end(); ++i) {
         Router* router = safe_cast<Router*>(*i);
         m_router_ptr_vector.push_back(router);
     }
index 9a8201a05ba99bc65472c02c133600219b1ba12b..a51add4a58f6ce6bae6b83ee4ae17a3916cc1ba0 100644 (file)
@@ -80,9 +80,8 @@ SimpleNetwork::SimpleNetwork(const Params *p)
     }
 
     // record the routers
-    for (vector<BasicRouter*>::const_iterator i =
-             m_topology_ptr->params()->routers.begin();
-         i != m_topology_ptr->params()->routers.end(); ++i) {
+    for (vector<BasicRouter*>::const_iterator i = p->routers.begin();
+         i != p->routers.end(); ++i) {
         Switch* s = safe_cast<Switch*>(*i);
         m_switch_ptr_vector.push_back(s);
         s->init_net_ptr(this);