41 #include "debug/RubyNetwork.hh"
52 m_virtual_networks(p->virt_nets), m_vc_per_vnet(p->vcs_per_vnet),
53 m_num_vcs(m_vc_per_vnet * m_virtual_networks),
54 m_deadlock_threshold(p->garnet_deadlock_threshold),
55 vc_busy_counter(m_virtual_networks, 0)
125 for (
auto& it : in) {
127 it->setConsumer(
this);
153 Cycles queueing_delay = src_queueing_delay + dest_queueing_delay;
181 DPRINTF(RubyNetwork,
"Network Interface %d connected to router %d "
189 for (
int vnet = 0; vnet <
inNode_ptr.size(); ++vnet) {
219 if (!messageEnqueuedThisCycle &&
220 outNode_ptr[vnet]->areNSlotsAvailable(1, curTime)) {
283 bool messageEnqueuedThisCycle =
false;
289 flit *stallFlit = *stallIter;
293 if (
outNode_ptr[vnet]->areNSlotsAvailable(1, curTime)) {
314 messageEnqueuedThisCycle =
true;
322 return messageEnqueuedThisCycle;
329 Message *net_msg_ptr = msg_ptr.get();
341 for (
int ctr = 0; ctr < dest_nodes.size(); ctr++) {
349 MsgPtr new_msg_ptr = msg_ptr->clone();
350 NodeID destID = dest_nodes[ctr];
352 Message *new_net_msg_ptr = new_msg_ptr.get();
353 if (dest_nodes.size() > 1) {
355 for (
int m = 0;
m < (int) MachineType_NUM;
m++) {
356 if ((destID >= MachineType_base_number((MachineType)
m)) &&
357 destID < MachineType_base_number((MachineType) (m+1))) {
359 personal_dest.
clear();
360 personal_dest.
add((
MachineID) {(MachineType) m, (destID -
361 MachineType_base_number((MachineType) m))});
389 for (
int i = 0;
i < num_flits;
i++) {
391 flit *fl =
new flit(
i, vc, vnet, route, num_flits, new_msg_ptr,
417 return ((vnet*m_vc_per_vnet) + delta);
423 "%s: Possible network deadlock in vnet: %d at time: %llu \n",
453 bool is_candidate_vc =
true;
460 int t_vc = vc_base + vc_offset;
464 is_candidate_vc =
false;
470 if (!is_candidate_vc)
498 fatal(
"Could not determine vc");
530 out <<
"[Network Interface]";
536 uint32_t num_functional_writes = 0;
538 num_functional_writes +=
m_ni_out_vcs[
i]->functionalWrite(pkt);
542 return num_functional_writes;
546 GarnetNetworkInterfaceParams::create()
void set_dequeue_time(Cycles time)
std::vector< int > m_stall_count
virtual const MessageSizeType & getMessageSize() const
bool isVNetOrdered(int vnet) const
void incrementStats(flit *t_flit)
std::vector< Cycles > m_ni_out_vcs_enqueue_time
void set_time(Cycles time)
virtual const NetDest & getDestination() const
Cycles is a wrapper class for representing cycle counts, i.e.
std::shared_ptr< Message > MsgPtr
void increment_injected_flits(int vnet)
void sendCredit(flit *t_flit, bool is_free)
GarnetNetworkInterfaceParams Params
Cycles ticksToCycles(Tick t) const
void addOutPort(NetworkLink *out_link, CreditLink *credit_link, SwitchID router_id)
void scheduleEvent(Cycles timeDelta)
Tick cyclesToTicks(Cycles c) const
panic_if(!root,"Invalid expression\n")
int calculateVC(int vnet)
std::vector< flitBuffer * > m_ni_out_vcs
void scheduleOutputLink()
This function looks at the NI buffers if some buffer has flits which are ready to traverse the link i...
std::vector< int > vc_busy_counter
void increment_total_hops(int hops)
std::deque< flit * > m_stall_queue
void add(MachineID newElement)
void addInPort(NetworkLink *in_link, CreditLink *credit_link)
void scheduleEventAbsolute(Tick timeAbs)
NetworkInterface(const Params *p)
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
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...
const MsgPtr & peekMsgPtr() const
Tick curTick()
The current simulated tick.
std::vector< OutVcState * > m_out_vc_state
flitBuffer * outFlitQueue
uint64_t Tick
Tick count type.
void increment_packet_queueing_latency(Cycles latency, int vnet)
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
void set_src_delay(Cycles delay)
flitBuffer * outCreditQueue
Tick dequeue(Tick current_time, bool decrement_messages=true)
Updates the delay cycles of the message at the head of the queue, removes it from the queue and retur...
uint32_t functionalWrite(Packet *)
void increment_injected_packets(int vnet)
void deletePointers(C< T, A > &container)
Cycles get_dequeue_time()
bool flitisizeMessage(MsgPtr msg_ptr, int vnet)
void removeNetDest(const NetDest &netDest)
uint32_t getNiFlitSize() const
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
CreditLink * inCreditLink
void increment_packet_network_latency(Cycles latency, int vnet)
void print(std::ostream &out) const
int get_router_id(int ni)
void addNode(std::vector< MessageBuffer * > &inNode, std::vector< MessageBuffer * > &outNode)
static uint32_t MessageSizeType_to_int(MessageSizeType size_type)
std::vector< int > m_vc_allocator
Cycles get_enqueue_time()
bool isReady(Cycles curTime)
bool isReady(Tick current_time) const
CreditLink * outCreditLink
void increment_received_packets(int vnet)
void increment_flit_queueing_latency(Cycles latency, int vnet)
virtual const std::string name() const
std::vector< MessageBuffer * > outNode_ptr
std::vector< MessageBuffer * > inNode_ptr
void setSourceQueue(flitBuffer *srcQueue)
void increment_flit_network_latency(Cycles latency, int vnet)
void setLinkConsumer(Consumer *consumer)
const int m_virtual_networks
std::vector< NodeID > getAllDest()
GarnetNetwork * m_net_ptr
uint32_t functionalWrite(Packet *pkt)
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
void increment_received_flits(int vnet)