summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/Network.cc
diff options
context:
space:
mode:
authorNilay Vaish <nilay@cs.wisc.edu>2013-03-22 15:53:23 -0500
committerNilay Vaish <nilay@cs.wisc.edu>2013-03-22 15:53:23 -0500
commit5aa43e130acec02bc616008a8758cf5096025c19 (patch)
treef1277ef0002aadfb911f126ec0537afa572f3789 /src/mem/ruby/network/Network.cc
parent2d501276429ab674c146a86802e62538892fc500 (diff)
downloadgem5-5aa43e130acec02bc616008a8758cf5096025c19.tar.xz
ruby: convert Topology to regular class
The Topology class in Ruby does not need to inherit from SimObject class. This patch turns it into a regular class. The topology object is now created in the constructor of the Network class. All the parameters for the topology class have been moved to the network class.
Diffstat (limited to 'src/mem/ruby/network/Network.cc')
-rw-r--r--src/mem/ruby/network/Network.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/mem/ruby/network/Network.cc b/src/mem/ruby/network/Network.cc
index c681dc5fe..c90f27c35 100644
--- a/src/mem/ruby/network/Network.cc
+++ b/src/mem/ruby/network/Network.cc
@@ -28,8 +28,8 @@
#include "base/misc.hh"
#include "mem/protocol/MachineType.hh"
+#include "mem/ruby/network/BasicLink.hh"
#include "mem/ruby/network/Network.hh"
-#include "mem/ruby/network/Topology.hh"
#include "mem/ruby/system/System.hh"
uint32_t Network::m_virtual_networks;
@@ -40,20 +40,25 @@ Network::Network(const Params *p)
: ClockedObject(p)
{
m_virtual_networks = p->number_of_virtual_networks;
- m_topology_ptr = p->topology;
m_control_msg_size = p->control_msg_size;
// Total nodes/controllers in network
// Must make sure this is called after the State Machine constructors
m_nodes = MachineType_base_number(MachineType_NUM);
assert(m_nodes != 0);
-
assert(m_virtual_networks != 0);
- assert(m_topology_ptr != NULL);
- // Initialize the controller's network pointers
- m_topology_ptr->initNetworkPtr(this);
+ m_topology_ptr = new Topology(p->routers.size(), p->ext_links,
+ p->int_links);
p->ruby_system->registerNetwork(this);
+
+ // Initialize the controller's network pointers
+ for (std::vector<BasicExtLink*>::const_iterator i = p->ext_links.begin();
+ i != p->ext_links.end(); ++i) {
+ BasicExtLink *ext_link = (*i);
+ AbstractController *abs_cntrl = ext_link->params()->ext_node;
+ abs_cntrl->initNetworkPtr(this);
+ }
}
void