From bf8ae288fa81ad66c56eae483eea1814afaa2119 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Sun, 30 Aug 2015 12:24:18 -0500 Subject: ruby: network: drop member m_in_use This member indicates whether or not a particular virtual network is in use. Instead of having a default big value for the number of virtual networks and then checking whether a virtual network is in use, the next patch removes the default value and the protocol configuration file would now specify the number of virtual networks it requires. Additionally, the patch also refactors some of the code used for computing the virtual channel next in the round robin order. --- .../network/garnet/flexible-pipeline/Router.cc | 39 +++++++--------------- 1 file changed, 12 insertions(+), 27 deletions(-) (limited to 'src/mem/ruby/network/garnet/flexible-pipeline/Router.cc') diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc index ef985058e..9451439c9 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc @@ -157,27 +157,13 @@ Router::vc_arbitrate() if (inport >= m_in_link.size()) inport = 0; int invc = m_round_robin_invc[inport]; - - int next_round_robin_invc = invc; - do { - next_round_robin_invc++; - - if (next_round_robin_invc >= m_num_vcs) - next_round_robin_invc = 0; - - } while (!(m_net_ptr->validVirtualNetwork( - get_vnet(next_round_robin_invc)))); - - m_round_robin_invc[inport] = next_round_robin_invc; + m_round_robin_invc[inport] = get_next_round_robin_vc(invc); for (int vc_iter = 0; vc_iter < m_num_vcs; vc_iter++) { invc++; if (invc >= m_num_vcs) invc = 0; - if (!(m_net_ptr->validVirtualNetwork(get_vnet(invc)))) - continue; - InVcState *in_vc_state = m_in_vc_state[inport][invc]; if (in_vc_state->isInState(VC_AB_, curCycle())) { @@ -335,17 +321,7 @@ Router::scheduleOutputLinks() { for (int port = 0; port < m_out_link.size(); port++) { int vc_tolookat = m_vc_round_robin[port]; - - int next_round_robin_vc_tolookat = vc_tolookat; - do { - next_round_robin_vc_tolookat++; - - if (next_round_robin_vc_tolookat == m_num_vcs) - next_round_robin_vc_tolookat = 0; - } while (!(m_net_ptr->validVirtualNetwork( - get_vnet(next_round_robin_vc_tolookat)))); - - m_vc_round_robin[port] = next_round_robin_vc_tolookat; + m_vc_round_robin[port] = get_next_round_robin_vc(vc_tolookat); for (int i = 0; i < m_num_vcs; i++) { vc_tolookat++; @@ -374,13 +350,22 @@ Router::scheduleOutputLinks() } int -Router::get_vnet(int vc) +Router::get_vnet(int vc) const { int vnet = vc/m_vc_per_vnet; assert(vnet < m_virtual_networks); return vnet; } +int +Router::get_next_round_robin_vc(int vc) const +{ + vc++; + if (vc == m_num_vcs) + vc = 0; + return vc; +} + void Router::checkReschedule() { -- cgit v1.2.3