Go to the documentation of this file.
39 #include "debug/RubyNetwork.hh"
49 m_virtual_networks(
p->virt_nets), m_vc_per_vnet(0),
50 m_vc_allocator(m_virtual_networks, 0),
51 m_deadlock_threshold(
p->garnet_deadlock_threshold),
52 vc_busy_counter(m_virtual_networks, 0)
64 DPRINTF(RubyNetwork,
"Adding input port:%s with vnets %s\n",
79 SwitchID router_id, uint32_t consumerVcs)
84 assert(consumerVcs > 0);
96 for (
int i = 0;
i < m_num_vcs;
i++) {
109 "%s: Connected Physical links have different vc requests: %d and %d\n",
113 DPRINTF(RubyNetwork,
"OutputPort:%s Vnet: %s\n",
129 for (
auto& it : in) {
131 it->setConsumer(
this);
158 Tick queueing_delay = src_queueing_delay + dest_queueing_delay;
186 std::ostringstream oss;
188 oss << oPort->routerID() <<
"[" << oPort->printVnets() <<
"] ";
190 DPRINTF(RubyNetwork,
"Network Interface %d connected to router:%s "
199 for (
int vnet = 0; vnet <
inNode_ptr.size(); ++vnet) {
205 if (
b->isReady(curTime)) {
206 msg_ptr =
b->peekMsgPtr();
220 DPRINTF(RubyNetwork,
"Number of input ports: %d\n",
inPorts.size());
225 DPRINTF(RubyNetwork,
"Recieved flit:%s\n", *t_flit);
226 assert(t_flit->
m_width == iPort->bitWidth());
236 if (!iPort->messageEnqueuedThisCycle &&
237 outNode_ptr[vnet]->areNSlotsAvailable(1, curTime)) {
246 iPort->sendCredit(cFlit);
255 iPort->m_stall_queue.push_back(t_flit);
258 outNode_ptr[vnet]->registerDequeueCallback([
this]() {
267 iPort->sendCredit(cFlit);
279 CreditLink *inCreditLink = oPort->inCreditLink();
297 if (iPort->outCreditQueue()->getSize() > 0) {
298 DPRINTF(RubyNetwork,
"Sending a credit %s via %s at %ld\n",
299 *(iPort->outCreditQueue()->peekTopFlit()),
301 iPort->outCreditLink()->
314 iPort->messageEnqueuedThisCycle =
false;
317 if (!iPort->m_stall_queue.empty()) {
318 for (
auto stallIter = iPort->m_stall_queue.begin();
319 stallIter != iPort->m_stall_queue.end(); ) {
320 flit *stallFlit = *stallIter;
334 iPort->sendCredit(cFlit);
342 iPort->m_stall_queue.erase(stallIter);
350 iPort->messageEnqueuedThisCycle =
true;
364 Message *net_msg_ptr = msg_ptr.get();
377 DPRINTF(RubyNetwork,
"Message Size:%d vnet:%d bitWidth:%d\n",
382 for (
int ctr = 0; ctr < dest_nodes.size(); ctr++) {
390 MsgPtr new_msg_ptr = msg_ptr->clone();
391 NodeID destID = dest_nodes[ctr];
393 Message *new_net_msg_ptr = new_msg_ptr.get();
394 if (dest_nodes.size() > 1) {
396 for (
int m = 0;
m < (int) MachineType_NUM;
m++) {
397 if ((destID >= MachineType_base_number((MachineType)
m)) &&
398 destID < MachineType_base_number((MachineType) (
m+1))) {
400 personal_dest.
clear();
402 MachineType_base_number((MachineType)
m))});
431 for (
int i = 0;
i < num_flits;
i++) {
433 flit *fl =
new flit(
i, vc, vnet, route, num_flits, new_msg_ptr,
467 "%s: Possible network deadlock in vnet: %d at time: %llu \n",
489 bool is_candidate_vc =
true;
495 int t_vc = vc_base + vc_offset;
499 is_candidate_vc =
false;
505 if (!is_candidate_vc)
554 if (iPort->isVnetSupported(vnet)) {
572 if (oPort->isVnetSupported(vnet)) {
585 DPRINTF(RubyNetwork,
"Scheduling at %s time:%ld flit:%s Message:%s\n",
593 panic(
"No output port found for vnet:%d\n", t_flit->
get_vnet());
605 fatal(
"Could not determine vc");
647 CreditLink *inCreditLink = oPort->inCreditLink();
658 out <<
"[Network Interface]";
664 uint32_t num_functional_writes = 0;
666 num_functional_writes += ni_out_vc.functionalWrite(pkt);
670 num_functional_writes += oPort->outFlitQueue()->functionalWrite(pkt);
672 return num_functional_writes;
676 GarnetNetworkInterfaceParams::create()
void addInPort(NetworkLink *in_link, CreditLink *credit_link)
void increment_received_flits(int vnet)
#define fatal(...)
This implements a cprintf based fatal() function.
void increment_total_hops(int hops)
void add(MachineID newElement)
void increment_flit_network_latency(Tick latency, int vnet)
void print(std::ostream &out) const
virtual const NetDest & getDestination() const
int get_router_id(int ni, int vnet)
virtual void setVcsPerVnet(uint32_t consumerVcs)
GarnetNetwork * m_net_ptr
uint64_t Tick
Tick count type.
flitBuffer * outFlitQueue()
void increment_packet_queueing_latency(Tick latency, int vnet)
virtual const MessageSizeType & getMessageSize() const
std::vector< OutVcState > outVcState
std::vector< int > m_vc_allocator
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
void increment_injected_flits(int vnet)
void increment_injected_packets(int vnet)
void increment_received_packets(int vnet)
void increment_packet_network_latency(Tick latency, int vnet)
T divCeil(const T &a, const U &b)
void set_dequeue_time(Tick time)
void addOutPort(NetworkLink *out_link, CreditLink *credit_link, SwitchID router_id, uint32_t consumerVcs)
Tick cyclesToTicks(Cycles c) const
void set_src_delay(Tick delay)
std::vector< int > vc_busy_counter
std::vector< InputPort * > inPorts
const int m_virtual_networks
std::vector< MessageBuffer * > outNode_ptr
GarnetNetworkInterfaceParams Params
void addNode(std::vector< MessageBuffer * > &inNode, std::vector< MessageBuffer * > &outNode)
void scheduleOutputLink()
This function looks at the NI buffers if some buffer has flits which are ready to traverse the link i...
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
void increment_flit_queueing_latency(Tick latency, int vnet)
static uint32_t MessageSizeType_to_int(MessageSizeType size_type)
void scheduleFlit(flit *t_flit)
InputPort * getInportForVnet(int vnet)
void incrementStats(flit *t_flit)
std::shared_ptr< Message > MsgPtr
void setLinkConsumer(Consumer *consumer)
bool isVnetSupported(int pVnet)
int calculateVC(int vnet)
virtual const std::string name() const
bool isVNetOrdered(int vnet) const
NetworkInterface(const Params *p)
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
void scheduleEventAbsolute(Tick timeAbs)
void setSourceQueue(flitBuffer *src_queue, ClockedObject *srcClockObject)
Overload hash function for BasicBlockRange type.
bool flitisizeMessage(MsgPtr msg_ptr, int vnet)
Cycles ticksToCycles(Tick t) const
std::vector< int > m_stall_count
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
NetworkLink * outNetLink()
Cycles is a wrapper class for representing cycle counts, i.e.
std::vector< flitBuffer > niOutVcs
std::vector< Tick > m_ni_out_vcs_enqueue_time
OutputPort * getOutportForVnet(int vnet)
std::vector< OutputPort * > outPorts
#define fatal_if(cond,...)
Conditional fatal macro that checks the supplied condition and only causes a fatal error if the condi...
std::vector< NodeID > getAllDest()
bool isReady(Tick curTime)
uint32_t functionalWrite(Packet *)
void removeNetDest(const NetDest &netDest)
void scheduleEvent(Cycles timeDelta)
#define panic(...)
This implements a cprintf based panic() function.
std::vector< MessageBuffer * > inNode_ptr
void scheduleOutputPort(OutputPort *oPort)
Tick curTick()
The current simulated tick.
Generated on Wed Sep 30 2020 14:02:13 for gem5 by doxygen 1.8.17