diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2014-02-20 17:28:01 -0600 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2014-02-20 17:28:01 -0600 |
commit | f8f8b7e5c2382dac32a8109c56f1aaad7e6a5fd7 (patch) | |
tree | ebc3d4f4de1ff44452ff1d2a9040cd28c532977f /src | |
parent | 896654746adeebc264150692a9dda4e3fa48a6a3 (diff) | |
download | gem5-f8f8b7e5c2382dac32a8109c56f1aaad7e6a5fd7.tar.xz |
ruby: network: garnet: fixed: removes next cycle functions
At several places, there are functions that take a cycle value as input
and performs some computation. Along with each such function, another
function was being defined that simply added one more cycle to input and
computed the same function. This patch removes this second copy of the
function. Places where these functions were being called have been updated
to use the original function with argument being current cycle + 1.
Diffstat (limited to 'src')
10 files changed, 16 insertions, 53 deletions
diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh index 2c37996b3..836613d02 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/InputUnit_d.hh @@ -125,16 +125,9 @@ class InputUnit_d : public Consumer } inline bool - need_stage(int vc, VC_state_type state, flit_stage stage, Cycles curTime) + need_stage(int vc, VC_state_type state, flit_stage stage, Cycles cTime) { - return m_vcs[vc]->need_stage(state, stage, curTime); - } - - inline bool - need_stage_nextcycle(int vc, VC_state_type state, flit_stage stage, - Cycles curTime) - { - return m_vcs[vc]->need_stage_nextcycle(state, stage, curTime); + return m_vcs[vc]->need_stage(state, stage, cTime); } inline bool diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc index b48efb632..c4c64b5ea 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/NetworkInterface_d.cc @@ -361,7 +361,7 @@ NetworkInterface_d::checkReschedule() } } for (int vc = 0; vc < m_num_vcs; vc++) { - if (m_ni_buffers[vc]->isReadyForNext(m_net_ptr->curCycle())) { + if (m_ni_buffers[vc]->isReady(m_net_ptr->curCycle() + Cycles(1))) { scheduleEvent(Cycles(1)); return; } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc index e292745c1..cabf435f4 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/SWallocator_d.cc @@ -218,10 +218,11 @@ SWallocator_d::arbitrate_outports() void SWallocator_d::check_for_wakeup() { + Cycles nextCycle = m_router->curCycle() + Cycles(1); + for (int i = 0; i < m_num_inports; i++) { for (int j = 0; j < m_num_vcs; j++) { - if (m_input_unit[i]->need_stage_nextcycle(j, ACTIVE_, SA_, - m_router->curCycle())) { + if (m_input_unit[i]->need_stage(j, ACTIVE_, SA_, nextCycle)) { scheduleEvent(Cycles(1)); return; } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc index f41dc884d..4b4a4f323 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/Switch_d.cc @@ -88,8 +88,10 @@ Switch_d::wakeup() void Switch_d::check_for_wakeup() { + Cycles nextCycle = m_router->curCycle() + Cycles(1); + for (int inport = 0; inport < m_num_inports; inport++) { - if (m_switch_buffer[inport]->isReadyForNext(m_router->curCycle())) { + if (m_switch_buffer[inport]->isReady(nextCycle)) { scheduleEvent(Cycles(1)); break; } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc index e9e2226a8..395b1a9c5 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/VCallocator_d.cc @@ -256,10 +256,11 @@ VCallocator_d::get_vnet(int invc) void VCallocator_d::check_for_wakeup() { + Cycles nextCycle = m_router->curCycle() + Cycles(1); + for (int i = 0; i < m_num_inports; i++) { for (int j = 0; j < m_num_vcs; j++) { - if (m_input_unit[i]->need_stage_nextcycle(j, VC_AB_, VA_, - m_router->curCycle())) { + if (m_input_unit[i]->need_stage(j, VC_AB_, VA_, nextCycle)) { scheduleEvent(Cycles(1)); return; } diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc index 510a79e8d..109d2a3be 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.cc @@ -62,25 +62,12 @@ VirtualChannel_d::grant_vc(int out_vc, Cycles curTime) bool VirtualChannel_d::need_stage(VC_state_type state, flit_stage stage, - Cycles curTime) + Cycles ct) { - if ((m_vc_state.first == state) && (curTime >= m_vc_state.second)) { - if (m_input_buffer->isReady(curTime)) { + if ((m_vc_state.first == state) && (ct >= m_vc_state.second)) { + if (m_input_buffer->isReady(ct)) { flit_d *t_flit = m_input_buffer->peekTopFlit(); - return(t_flit->is_stage(stage, curTime)) ; - } - } - return false; -} - -bool -VirtualChannel_d::need_stage_nextcycle(VC_state_type state, flit_stage stage, - Cycles curTime) -{ - if ((m_vc_state.first == state) && ((curTime + 1) >= m_vc_state.second)) { - if (m_input_buffer->isReadyForNext(curTime)) { - flit_d *t_flit = m_input_buffer->peekTopFlit(); - return(t_flit->is_next_stage(stage, curTime)) ; + return(t_flit->is_stage(stage, ct)) ; } } return false; diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh index d19630305..b46a095e6 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/VirtualChannel_d.hh @@ -43,8 +43,6 @@ class VirtualChannel_d ~VirtualChannel_d(); bool need_stage(VC_state_type state, flit_stage stage, Cycles curTime); - bool need_stage_nextcycle(VC_state_type state, flit_stage stage, - Cycles curTime); void set_outport(int outport); void grant_vc(int out_vc, Cycles curTime); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc index 6a7d4be87..1305b1547 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.cc @@ -57,17 +57,6 @@ flitBuffer_d::isReady(Cycles curTime) return false; } -bool -flitBuffer_d::isReadyForNext(Cycles curTime) -{ - if (m_buffer.size() != 0 ) { - flit_d *t_flit = peekTopFlit(); - if (t_flit->get_time() <= (curTime + 1)) - return true; - } - return false; -} - void flitBuffer_d::print(std::ostream& out) const { diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh index 2fe6e982b..bfa6cc9a9 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flitBuffer_d.hh @@ -45,7 +45,6 @@ class flitBuffer_d flitBuffer_d(int maximum_size); bool isReady(Cycles curTime); - bool isReadyForNext(Cycles curTime); bool isEmpty(); void print(std::ostream& out) const; bool isFull(); diff --git a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh index 87ea1152f..55187bd14 100644 --- a/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh +++ b/src/mem/ruby/network/garnet/fixed-pipeline/flit_d.hh @@ -65,13 +65,6 @@ class flit_d curTime >= m_stage.second); } - bool - is_next_stage(flit_stage t_stage, Cycles curTime) - { - return (m_stage.first == t_stage && - (curTime + 1) >= m_stage.second); - } - void advance_stage(flit_stage t_stage, Cycles curTime) { |