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.
This commit is contained in:
Nilay Vaish 2014-02-20 17:28:01 -06:00
parent 896654746a
commit f8f8b7e5c2
10 changed files with 16 additions and 53 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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;

View file

@ -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);

View file

@ -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
{

View file

@ -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();

View file

@ -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)
{