Go to the documentation of this file.
39 #include "debug/RubyNetwork.hh"
47 m_virtual_networks(
p.virt_nets), m_vc_per_vnet(0),
48 m_vc_allocator(m_virtual_networks, 0),
49 m_deadlock_threshold(
p.garnet_deadlock_threshold),
50 vc_busy_counter(m_virtual_networks, 0)
62 DPRINTF(RubyNetwork,
"Adding input port:%s with vnets %s\n",
77 SwitchID router_id, uint32_t consumerVcs)
82 assert(consumerVcs > 0);
94 for (
int i = 0;
i < m_num_vcs;
i++) {
107 "%s: Connected Physical links have different vc requests: %d and %d\n",
111 DPRINTF(RubyNetwork,
"OutputPort:%s Vnet: %s\n",
127 for (
auto& it : in) {
129 it->setConsumer(
this);
156 Tick queueing_delay = src_queueing_delay + dest_queueing_delay;
184 std::ostringstream oss;
186 oss << oPort->routerID() <<
"[" << oPort->printVnets() <<
"] ";
188 DPRINTF(RubyNetwork,
"Network Interface %d connected to router:%s "
197 for (
int vnet = 0; vnet <
inNode_ptr.size(); ++vnet) {
203 if (
b->isReady(curTime)) {
204 msg_ptr =
b->peekMsgPtr();
218 DPRINTF(RubyNetwork,
"Number of input ports: %d\n",
inPorts.size());
223 DPRINTF(RubyNetwork,
"Recieved flit:%s\n", *t_flit);
224 assert(t_flit->
m_width == iPort->bitWidth());
234 if (!iPort->messageEnqueuedThisCycle &&
235 outNode_ptr[vnet]->areNSlotsAvailable(1, curTime)) {
244 iPort->sendCredit(cFlit);
253 iPort->m_stall_queue.push_back(t_flit);
256 outNode_ptr[vnet]->registerDequeueCallback([
this]() {
265 iPort->sendCredit(cFlit);
277 CreditLink *inCreditLink = oPort->inCreditLink();
295 if (iPort->outCreditQueue()->getSize() > 0) {
296 DPRINTF(RubyNetwork,
"Sending a credit %s via %s at %ld\n",
297 *(iPort->outCreditQueue()->peekTopFlit()),
299 iPort->outCreditLink()->
312 iPort->messageEnqueuedThisCycle =
false;
315 if (!iPort->m_stall_queue.empty()) {
316 for (
auto stallIter = iPort->m_stall_queue.begin();
317 stallIter != iPort->m_stall_queue.end(); ) {
318 flit *stallFlit = *stallIter;
332 iPort->sendCredit(cFlit);
340 iPort->m_stall_queue.erase(stallIter);
348 iPort->messageEnqueuedThisCycle =
true;
362 Message *net_msg_ptr = msg_ptr.get();
375 DPRINTF(RubyNetwork,
"Message Size:%d vnet:%d bitWidth:%d\n",
380 for (
int ctr = 0; ctr < dest_nodes.size(); ctr++) {
388 MsgPtr new_msg_ptr = msg_ptr->clone();
389 NodeID destID = dest_nodes[ctr];
391 Message *new_net_msg_ptr = new_msg_ptr.get();
392 if (dest_nodes.size() > 1) {
394 for (
int m = 0;
m < (int) MachineType_NUM;
m++) {
395 if ((destID >= MachineType_base_number((MachineType)
m)) &&
396 destID < MachineType_base_number((MachineType) (
m+1))) {
398 personal_dest.
clear();
400 MachineType_base_number((MachineType)
m))});
429 for (
int i = 0;
i < num_flits;
i++) {
431 flit *fl =
new flit(
i, vc, vnet, route, num_flits, new_msg_ptr,
465 "%s: Possible network deadlock in vnet: %d at time: %llu \n",
487 bool is_candidate_vc =
true;
493 int t_vc = vc_base + vc_offset;
497 is_candidate_vc =
false;
503 if (!is_candidate_vc)
552 if (iPort->isVnetSupported(vnet)) {
570 if (oPort->isVnetSupported(vnet)) {
583 DPRINTF(RubyNetwork,
"Scheduling at %s time:%ld flit:%s Message:%s\n",
591 panic(
"No output port found for vnet:%d\n", t_flit->
get_vnet());
603 fatal(
"Could not determine vc");
645 CreditLink *inCreditLink = oPort->inCreditLink();
656 out <<
"[Network Interface]";
662 uint32_t num_functional_writes = 0;
664 num_functional_writes += ni_out_vc.functionalWrite(pkt);
668 num_functional_writes += oPort->outFlitQueue()->functionalWrite(pkt);
670 return num_functional_writes;
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)
NetworkInterface(const Params &p)
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
#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)
bool flitisizeMessage(MsgPtr msg_ptr, int vnet)
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
Tick curTick()
The universal simulation clock.
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)
Generated on Tue Mar 23 2021 19:41:28 for gem5 by doxygen 1.8.17