diff options
author | Nilay Vaish <nilay@cs.wisc.edu> | 2014-03-20 09:14:14 -0500 |
---|---|---|
committer | Nilay Vaish <nilay@cs.wisc.edu> | 2014-03-20 09:14:14 -0500 |
commit | 4b67ada89e2e47b26ad07562774ff65beb5633a5 (patch) | |
tree | a93e52d39595313eec559d9c4d9b164f76418706 /src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc | |
parent | 4f7ef51efba1c1688eadc14f628a1411512b235e (diff) | |
download | gem5-4b67ada89e2e47b26ad07562774ff65beb5633a5.tar.xz |
ruby: garnet: convert network interfaces into clocked objects
This helps in configuring the network interfaces from the python script and
these objects no longer rely on the network object for the timing information.
Diffstat (limited to 'src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc')
-rw-r--r-- | src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc | 57 |
1 files changed, 28 insertions, 29 deletions
diff --git a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc index fb918f95d..ba32abd44 100644 --- a/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc +++ b/src/mem/ruby/network/garnet/flexible-pipeline/NetworkInterface.cc @@ -42,14 +42,12 @@ using namespace std; using m5::stl_helpers::deletePointers; -NetworkInterface::NetworkInterface(int id, int virtual_networks, - GarnetNetwork *network_ptr) - : FlexibleConsumer(network_ptr) +NetworkInterface::NetworkInterface(const Params *p) + : ClockedObject(p), FlexibleConsumer(this) { - m_id = id; - m_net_ptr = network_ptr; - m_virtual_networks = virtual_networks; - m_vc_per_vnet = m_net_ptr->getVCsPerVnet(); + m_id = p->id; + m_virtual_networks = p->virt_nets; + m_vc_per_vnet = p->vcs_per_vnet; m_num_vcs = m_vc_per_vnet*m_virtual_networks; m_vc_round_robin = 0; @@ -105,9 +103,8 @@ NetworkInterface::addNode(vector<MessageBuffer*>& in, // protocol injects messages into the NI for (int j = 0; j < m_virtual_networks; j++) { inNode_ptr[j]->setConsumer(this); - inNode_ptr[j]->setReceiver(m_net_ptr); - - outNode_ptr[j]->setSender(m_net_ptr); + inNode_ptr[j]->setReceiver(this); + outNode_ptr[j]->setSender(this); } } @@ -169,20 +166,18 @@ NetworkInterface::flitisizeMessage(MsgPtr msg_ptr, int vnet) for (int i = 0; i < num_flits; i++) { m_net_ptr->increment_injected_flits(vnet); flit *fl = new flit(i, vc, vnet, num_flits, new_msg_ptr, - m_net_ptr->curCycle()); - fl->set_delay(m_net_ptr->curCycle() - - m_net_ptr->ticksToCycles(msg_ptr->getTime())); + curCycle()); + fl->set_delay(curCycle() - ticksToCycles(msg_ptr->getTime())); m_ni_buffers[vc]->insert(fl); } - m_out_vc_state[vc]->setState(VC_AB_, m_net_ptr->curCycle()); + m_out_vc_state[vc]->setState(VC_AB_, curCycle()); // setting an output vc request for the next hop. // This flit will be ready to traverse the link and into the next hop // only when an output vc is acquired at the next hop - outNetLink->request_vc_link(vc, - new_net_msg_ptr->getInternalDestination(), - m_net_ptr->curCycle()); + outNetLink->request_vc_link( + vc, new_net_msg_ptr->getInternalDestination(), curCycle()); } return true ; @@ -224,8 +219,8 @@ NetworkInterface::calculateVC(int vnet) if (m_vc_allocator[vnet] == vc_per_vnet) m_vc_allocator[vnet] = 0; - if (m_out_vc_state[(vnet*m_vc_per_vnet) + delta]->isInState(IDLE_, - m_net_ptr->curCycle())) { + if (m_out_vc_state[(vnet*m_vc_per_vnet) + delta]-> + isInState(IDLE_, curCycle())) { return ((vnet*m_vc_per_vnet) + delta); } } @@ -269,20 +264,19 @@ NetworkInterface::wakeup() flit *t_flit = inNetLink->consumeLink(); if (t_flit->get_type() == TAIL_ || t_flit->get_type() == HEAD_TAIL_) { DPRINTF(RubyNetwork, "m_id: %d, Message delivered at time: %lld\n", - m_id, m_net_ptr->curCycle()); + m_id, curCycle()); outNode_ptr[t_flit->get_vnet()]->enqueue( t_flit->get_msg_ptr(), Cycles(1)); // signal the upstream router that this vc can be freed now inNetLink->release_vc_link(t_flit->get_vc(), - m_net_ptr->curCycle() + Cycles(1)); + curCycle() + Cycles(1)); } int vnet = t_flit->get_vnet(); m_net_ptr->increment_received_flits(vnet); - Cycles network_delay = m_net_ptr->curCycle() - - t_flit->get_enqueue_time(); + Cycles network_delay = curCycle() - t_flit->get_enqueue_time(); Cycles queueing_delay = t_flit->get_delay(); m_net_ptr->increment_network_latency(network_delay, vnet); @@ -309,19 +303,18 @@ NetworkInterface::scheduleOutputLink() vc++; if (vc == m_num_vcs) vc = 0; - if (m_ni_buffers[vc]->isReady(m_net_ptr->curCycle())) { - if (m_out_vc_state[vc]->isInState(ACTIVE_, - m_net_ptr->curCycle()) && + if (m_ni_buffers[vc]->isReady(curCycle())) { + if (m_out_vc_state[vc]->isInState(ACTIVE_, curCycle()) && outNetLink->isBufferNotFull_link(vc)) { // buffer backpressure // Just removing the flit flit *t_flit = m_ni_buffers[vc]->getTopFlit(); - t_flit->set_time(m_net_ptr->curCycle() + Cycles(1)); + t_flit->set_time(curCycle() + Cycles(1)); outSrcQueue->insert(t_flit); // schedule the out link outNetLink-> - scheduleEventAbsolute(m_net_ptr->clockEdge(Cycles(1))); + scheduleEventAbsolute(clockEdge(Cycles(1))); return; } } @@ -338,7 +331,7 @@ NetworkInterface::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]->isReadyForNext(curCycle())) { scheduleEvent(Cycles(1)); return; } @@ -380,3 +373,9 @@ NetworkInterface::print(std::ostream& out) const { out << "[Network Interface]"; } + +NetworkInterface * +GarnetNetworkInterfaceParams::create() +{ + return new NetworkInterface(this); +} |