diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2012-10-02 14:35:45 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2012-10-02 14:35:45 -0500 |
commit | 4488379244cdf3c211e76dbf3b4278347f639039 (patch) | |
tree | d8ae21ee6a35e60c0856d91479e199126f4ba5ac /src/mem/ruby/network/simple/SimpleNetwork.cc | |
parent | b370f6a7b2fb9a4cd8e38b1db12845d401d3adf3 (diff) | |
download | gem5-4488379244cdf3c211e76dbf3b4278347f639039.tar.xz |
ruby: changes to simple network
This patch makes the Switch structure inherit from BasicRouter, as is
done in two other networks.
Diffstat (limited to 'src/mem/ruby/network/simple/SimpleNetwork.cc')
-rw-r--r-- | src/mem/ruby/network/simple/SimpleNetwork.cc | 21 |
1 files changed, 12 insertions, 9 deletions
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<BasicRouter*>::const_iterator i = + m_topology_ptr->params()->routers.begin(); + i != m_topology_ptr->params()->routers.end(); ++i) { + Switch* s = safe_cast<Switch*>(*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)); } } |