From 4488379244cdf3c211e76dbf3b4278347f639039 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Tue, 2 Oct 2012 14:35:45 -0500 Subject: ruby: changes to simple network This patch makes the Switch structure inherit from BasicRouter, as is done in two other networks. --- src/mem/ruby/network/simple/SimpleNetwork.cc | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'src/mem/ruby/network/simple/SimpleNetwork.cc') diff --git a/src/mem/ruby/network/simple/SimpleNetwork.cc b/src/mem/ruby/network/simple/SimpleNetwork.cc index 84d2ee97f..7aa8e62f9 100644 --- a/src/mem/ruby/network/simple/SimpleNetwork.cc +++ b/src/mem/ruby/network/simple/SimpleNetwork.cc @@ -78,6 +78,15 @@ SimpleNetwork::SimpleNetwork(const Params *p) new MessageBuffer(csprintf("fromNet node %d j %d", node, j)); } } + + // record the routers + for (vector::const_iterator i = + m_topology_ptr->params()->routers.begin(); + i != m_topology_ptr->params()->routers.end(); ++i) { + Switch* s = safe_cast(*i); + m_switch_ptr_vector.push_back(s); + s->init_net_ptr(this); + } } void @@ -88,11 +97,6 @@ SimpleNetwork::init() // The topology pointer should have already been initialized in // the parent class network constructor. assert(m_topology_ptr != NULL); - int number_of_switches = m_topology_ptr->numSwitches(); - for (int i = 0; i < number_of_switches; i++) { - m_switch_ptr_vector.push_back(new Switch(i, this)); - } - // false because this isn't a reconfiguration m_topology_ptr->createLinks(this, false); } @@ -282,15 +286,14 @@ SimpleNetwork::printStats(ostream& out) const if (total_msg_counts[type] > 0) { out << "total_msg_count_" << type << ": " << total_msg_counts[type] - << " " << total_msg_counts[type] * - uint64(RubySystem::getNetwork()->MessageSizeType_to_int(type)) + << " " << total_msg_counts[type] * + uint64(MessageSizeType_to_int(type)) << endl; total_msgs += total_msg_counts[type]; total_bytes += total_msg_counts[type] * - uint64(RubySystem::getNetwork()->MessageSizeType_to_int(type)); - + uint64(MessageSizeType_to_int(type)); } } -- cgit v1.2.3