38 #include "debug/RubyNetwork.hh" 48 m_virtual_networks(p->virt_nets), m_vc_per_vnet(p->vcs_per_vnet),
49 m_router_id(-1), m_vc_allocator(m_virtual_networks, 0),
50 m_vc_round_robin(0), outFlitQueue(), outCreditQueue(),
51 m_deadlock_threshold(p->garnet_deadlock_threshold),
52 vc_busy_counter(m_virtual_networks, 0)
71 for (
int i = 0;
i < num_vcs;
i++) {
107 for (
auto& it : in) {
109 it->setConsumer(
this);
135 Cycles queueing_delay = src_queueing_delay + dest_queueing_delay;
163 DPRINTF(RubyNetwork,
"Network Interface %d connected to router %d " 171 for (
int vnet = 0; vnet <
inNode_ptr.size(); ++vnet) {
201 if (!messageEnqueuedThisCycle &&
202 outNode_ptr[vnet]->areNSlotsAvailable(1, curTime)) {
265 bool messageEnqueuedThisCycle =
false;
271 flit *stallFlit = *stallIter;
275 if (
outNode_ptr[vnet]->areNSlotsAvailable(1, curTime)) {
296 messageEnqueuedThisCycle =
true;
304 return messageEnqueuedThisCycle;
311 Message *net_msg_ptr = msg_ptr.get();
323 for (
int ctr = 0; ctr < dest_nodes.size(); ctr++) {
331 MsgPtr new_msg_ptr = msg_ptr->clone();
332 NodeID destID = dest_nodes[ctr];
334 Message *new_net_msg_ptr = new_msg_ptr.get();
335 if (dest_nodes.size() > 1) {
337 for (
int m = 0;
m < (int) MachineType_NUM;
m++) {
338 if ((destID >= MachineType_base_number((MachineType)
m)) &&
339 destID < MachineType_base_number((MachineType) (m+1))) {
341 personal_dest.
clear();
342 personal_dest.
add((
MachineID) {(MachineType) m, (destID -
343 MachineType_base_number((MachineType) m))});
371 for (
int i = 0;
i < num_flits;
i++) {
373 flit *fl =
new flit(
i, vc, vnet, route, num_flits, new_msg_ptr,
396 if (
outVcState[(vnet*m_vc_per_vnet) + delta].isInState(
399 return ((vnet*m_vc_per_vnet) + delta);
405 "%s: Possible network deadlock in vnet: %d at time: %llu \n",
432 bool is_candidate_vc =
true;
439 int t_vc = vc_base + vc_offset;
443 is_candidate_vc =
false;
449 if (!is_candidate_vc)
479 fatal(
"Could not determine vc");
511 out <<
"[Network Interface]";
517 uint32_t num_functional_writes = 0;
519 num_functional_writes += ni_out_vc.functionalWrite(pkt);
523 return num_functional_writes;
527 GarnetNetworkInterfaceParams::create()
void set_dequeue_time(Cycles time)
std::vector< int > m_stall_count
bool isReady(Tick current_time) const
void incrementStats(flit *t_flit)
std::vector< Cycles > m_ni_out_vcs_enqueue_time
void set_time(Cycles time)
Cycles is a wrapper class for representing cycle counts, i.e.
#define fatal(...)
This implements a cprintf based fatal() function.
std::shared_ptr< Message > MsgPtr
void increment_injected_flits(int vnet)
void sendCredit(flit *t_flit, bool is_free)
flitBuffer outCreditQueue
GarnetNetworkInterfaceParams Params
void addOutPort(NetworkLink *out_link, CreditLink *credit_link, SwitchID router_id)
void scheduleEvent(Cycles timeDelta)
int calculateVC(int vnet)
void scheduleOutputLink()
This function looks at the NI buffers if some buffer has flits which are ready to traverse the link i...
Overload hash function for BasicBlockRange type.
std::vector< int > vc_busy_counter
void increment_total_hops(int hops)
std::deque< flit * > m_stall_queue
void add(MachineID newElement)
flitBuffer outFlitQueue
Used to model link contention.
virtual const NetDest & getDestination() const
void addInPort(NetworkLink *in_link, CreditLink *credit_link)
void scheduleEventAbsolute(Tick timeAbs)
NetworkInterface(const Params *p)
Tick cyclesToTicks(Cycles c) const
Tick curTick()
The current simulated tick.
bool isVNetOrdered(int vnet) const
void addNode(std::vector< MessageBuffer *> &inNode, std::vector< MessageBuffer *> &outNode)
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 setSourceQueue(flitBuffer *src_queue)
void set_src_delay(Cycles delay)
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)
Cycles curCycle() const
Determine the current cycle, corresponding to a tick aligned to a clock edge.
Cycles get_dequeue_time()
bool flitisizeMessage(MsgPtr msg_ptr, int vnet)
void removeNetDest(const NetDest &netDest)
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
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...
CreditLink * inCreditLink
void increment_packet_network_latency(Cycles latency, int vnet)
void print(std::ostream &out) const
int get_router_id(int ni)
static uint32_t MessageSizeType_to_int(MessageSizeType size_type)
std::vector< flitBuffer > niOutVcs
std::vector< int > m_vc_allocator
Cycles get_enqueue_time()
bool isReady(Cycles curTime)
CreditLink * outCreditLink
void increment_received_packets(int vnet)
virtual const std::string name() const
void increment_flit_queueing_latency(Cycles latency, int vnet)
Cycles ticksToCycles(Tick t) const
std::vector< MessageBuffer * > outNode_ptr
uint32_t getNiFlitSize() const
std::vector< MessageBuffer * > inNode_ptr
virtual const MessageSizeType & getMessageSize() const
std::vector< OutVcState > outVcState
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
#define panic_if(cond,...)
Conditional panic macro that checks the supplied condition and only panics if the condition is true a...
const MsgPtr & peekMsgPtr() const
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)