diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2015-08-30 12:24:18 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2015-08-30 12:24:18 -0500 |
commit | bf8ae288fa81ad66c56eae483eea1814afaa2119 (patch) | |
tree | a41d47e7fbe981d152aa300e9e9afb1deccc8e2e /src/mem/ruby/network/garnet/flexible-pipeline/Router.cc | |
parent | 7175db4a3fcd7f5767d740a7c11b5fcf215d0018 (diff) | |
download | gem5-bf8ae288fa81ad66c56eae483eea1814afaa2119.tar.xz |
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.
Diffstat (limited to 'src/mem/ruby/network/garnet/flexible-pipeline/Router.cc')
-rw-r--r-- | src/mem/ruby/network/garnet/flexible-pipeline/Router.cc | 39 |
1 files changed, 12 insertions, 27 deletions
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() { |