diff options
Diffstat (limited to 'src/mem/ruby/network/garnet/flexible-pipeline/Router.cc')
-rw-r--r-- | src/mem/ruby/network/garnet/flexible-pipeline/Router.cc | 56 |
1 files changed, 22 insertions, 34 deletions
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc index 8e064a01f..ca82f0757 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/Router.cc @@ -71,7 +71,7 @@ Router::addInPort(NetworkLink *in_link) vector<InVcState *> in_vc_vector; for (int i = 0; i < m_num_vcs; i++) { in_vc_vector.push_back(new InVcState(i)); - in_vc_vector[i]->setState(IDLE_, g_system_ptr->getTime()); + in_vc_vector[i]->setState(IDLE_, curCycle()); } m_in_vc_state.push_back(in_vc_vector); m_in_link.push_back(in_link); @@ -111,7 +111,7 @@ Router::addOutPort(NetworkLink *out_link, const NetDest& routing_table_entry, vector<OutVcState *> out_vc_vector; for (int i = 0; i < m_num_vcs; i++) { out_vc_vector.push_back(new OutVcState(i)); - out_vc_vector[i]->setState(IDLE_, g_system_ptr->getTime()); + out_vc_vector[i]->setState(IDLE_, curCycle()); } m_out_vc_state.push_back(out_vc_vector); m_link_weights.push_back(link_weight); @@ -137,8 +137,8 @@ Router::request_vc(int in_vc, int in_port, NetDest destination, int outport = getRoute(destination); m_in_vc_state[in_port][in_vc]->setRoute(outport); m_in_vc_state[in_port][in_vc]->setState(VC_AB_, request_time); - assert(request_time >= g_system_ptr->getTime()); - if (request_time > g_system_ptr->getTime()) + assert(request_time >= curCycle()); + if (request_time > curCycle()) m_vc_arbiter->scheduleEventAbsolute(request_time); else vc_arbitrate(); @@ -180,22 +180,21 @@ Router::vc_arbitrate() InVcState *in_vc_state = m_in_vc_state[inport][invc]; - if (in_vc_state->isInState(VC_AB_, g_system_ptr->getTime())) { + if (in_vc_state->isInState(VC_AB_, curCycle())) { int outport = in_vc_state->get_outport(); vector<int> valid_vcs = get_valid_vcs(invc); for (int valid_vc_iter = 0; valid_vc_iter < valid_vcs.size(); valid_vc_iter++) { if (m_out_vc_state[outport][valid_vcs[valid_vc_iter]] - ->isInState(IDLE_, g_system_ptr->getTime())) { + ->isInState(IDLE_, curCycle())) { in_vc_state->grant_vc(valid_vcs[valid_vc_iter], - g_system_ptr->getTime()); + curCycle()); - m_in_link[inport]->grant_vc_link(invc, - g_system_ptr->getTime()); + m_in_link[inport]->grant_vc_link(invc, curCycle()); m_out_vc_state[outport][valid_vcs[valid_vc_iter]] - ->setState(VC_AB_, g_system_ptr->getTime()); + ->setState(VC_AB_, curCycle()); break; } } @@ -270,8 +269,7 @@ Router::routeCompute(flit *m_flit, int inport) assert(m_net_ptr->getNumPipeStages() >= 1); // Subtract 1 as 1 cycle will be consumed in scheduling the output link - m_flit->set_time(g_system_ptr->getTime() + - (m_net_ptr->getNumPipeStages() - 1)); + m_flit->set_time(curCycle() + (m_net_ptr->getNumPipeStages() - 1)); m_flit->set_vc(outvc); m_router_buffers[outport][outvc]->insert(m_flit); @@ -283,25 +281,18 @@ Router::routeCompute(flit *m_flit, int inport) NetDest destination = nm->getInternalDestination(); if (m_net_ptr->getNumPipeStages() > 1) { - m_out_vc_state[outport][outvc]->setState(VC_AB_, - g_system_ptr->getTime() + 1); - + m_out_vc_state[outport][outvc]->setState(VC_AB_, curCycle() + 1); m_out_link[outport]->request_vc_link(outvc, destination, - g_system_ptr->getTime() + 1); + curCycle() + 1); } else { - m_out_vc_state[outport][outvc]->setState(VC_AB_, - g_system_ptr->getTime()); - + m_out_vc_state[outport][outvc]->setState(VC_AB_, curCycle()); m_out_link[outport]->request_vc_link(outvc, destination, - g_system_ptr->getTime()); + curCycle()); } } if ((m_flit->get_type() == TAIL_) || (m_flit->get_type() == HEAD_TAIL_)) { - m_in_vc_state[inport][invc]->setState(IDLE_, - g_system_ptr->getTime() + 1); - - m_in_link[inport]->release_vc_link(invc, - g_system_ptr->getTime() + 1); + m_in_vc_state[inport][invc]->setState(IDLE_, curCycle() + 1); + m_in_link[inport]->release_vc_link(invc, curCycle() + 1); } } @@ -325,8 +316,7 @@ Router::wakeup() // checking the incoming link if (m_in_link[incoming_port]->isReady()) { - DPRINTF(RubyNetwork, "m_id: %d, Time: %lld\n", - m_id, g_system_ptr->getTime()); + DPRINTF(RubyNetwork, "m_id: %d, Time: %lld\n", m_id, curCycle()); t_flit = m_in_link[incoming_port]->peekLink(); routeCompute(t_flit, incoming_port); m_in_link[incoming_port]->consumeLink(); @@ -360,16 +350,16 @@ Router::scheduleOutputLinks() if (vc_tolookat == m_num_vcs) vc_tolookat = 0; - if (m_router_buffers[port][vc_tolookat]->isReady()) { + if (m_router_buffers[port][vc_tolookat]->isReady(curCycle())) { // models buffer backpressure if (m_out_vc_state[port][vc_tolookat]->isInState(ACTIVE_, - g_system_ptr->getTime()) && + curCycle()) && m_out_link[port]->isBufferNotFull_link(vc_tolookat)) { flit *t_flit = m_router_buffers[port][vc_tolookat]->getTopFlit(); - t_flit->set_time(g_system_ptr->getTime() + 1 ); + t_flit->set_time(curCycle() + 1 ); m_out_src_queue[port]->insert(t_flit); m_out_link[port]->scheduleEvent(1); break; // done for this port @@ -392,7 +382,7 @@ Router::checkReschedule() { for (int port = 0; port < m_out_link.size(); port++) { for (int vc = 0; vc < m_num_vcs; vc++) { - if (m_router_buffers[port][vc]->isReadyForNext()) { + if (m_router_buffers[port][vc]->isReadyForNext(curCycle())) { scheduleEvent(1); return; } @@ -405,9 +395,7 @@ Router::check_arbiter_reschedule() { for (int port = 0; port < m_in_link.size(); port++) { for (int vc = 0; vc < m_num_vcs; vc++) { - if (m_in_vc_state[port][vc]->isInState(VC_AB_, - g_system_ptr->getTime() + 1)) { - + if (m_in_vc_state[port][vc]->isInState(VC_AB_, curCycle() + 1)) { m_vc_arbiter->scheduleEvent(1); return; } |