diff options
Diffstat (limited to 'src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc')
-rw-r--r-- | src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc index e8aca533a..9916f4ba5 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/GarnetNetwork.cc @@ -192,6 +192,54 @@ GarnetNetwork::checkNetworkAllocation(NodeID id, bool ordered, m_in_use[network_num] = true; } +/* + * Go through all the routers, network interfaces and the interconnecting + * links for reading/writing all the messages. + */ +bool +GarnetNetwork::functionalRead(Packet *pkt) +{ + for (unsigned int i = 0; i < m_router_ptr_vector.size(); i++) { + if (m_router_ptr_vector[i]->functionalRead(pkt)) { + return true; + } + } + + for (unsigned int i = 0; i < m_ni_ptr_vector.size(); ++i) { + if (m_ni_ptr_vector[i]->functionalRead(pkt)) { + return true; + } + } + + for (unsigned int i = 0; i < m_link_ptr_vector.size(); ++i) { + if (m_link_ptr_vector[i]->functionalRead(pkt)) { + return true; + } + } + + return false; +} + +uint32_t +GarnetNetwork::functionalWrite(Packet *pkt) +{ + uint32_t num_functional_writes = 0; + + for (unsigned int i = 0; i < m_router_ptr_vector.size(); i++) { + num_functional_writes += m_router_ptr_vector[i]->functionalWrite(pkt); + } + + for (unsigned int i = 0; i < m_ni_ptr_vector.size(); ++i) { + num_functional_writes += m_ni_ptr_vector[i]->functionalWrite(pkt); + } + + for (unsigned int i = 0; i < m_link_ptr_vector.size(); ++i) { + num_functional_writes += m_link_ptr_vector[i]->functionalWrite(pkt); + } + + return num_functional_writes; +} + void GarnetNetwork::printLinkStats(ostream& out) const { |