35 #include "debug/RubyNetwork.hh"
53 :
Consumer(sw), m_switch_id(sid), m_switch(sw)
76 for (
int i = 0;
i < in.size(); ++
i) {
77 if (in[
i] !=
nullptr) {
78 in[
i]->setConsumer(
this);
79 in[
i]->setIncomingLink(port);
87 const NetDest& routing_table_entry)
116 for (
int counter = 0; counter <
m_in.size(); counter++) {
119 if (incoming >=
m_in.size()) {
124 if (
m_in[incoming].
size() <= vnet) {
129 if (buffer ==
nullptr) {
150 while (buffer->
isReady(current_time)) {
151 DPRINTF(RubyNetwork,
"incoming: %d\n", incoming);
155 net_msg_ptr = msg_ptr.get();
156 DPRINTF(RubyNetwork,
"Message: %s\n", (*net_msg_ptr));
158 output_links.clear();
159 output_link_destinations.clear();
172 for (
int out = 0; out <
m_out.size(); out++) {
178 for (
int out = 0; out <
m_out.size(); out++) {
179 int out_queue_length = 0;
181 out_queue_length +=
m_out[out][
v]->getSize(current_time);
184 (out_queue_length << 8) |
199 DPRINTF(RubyNetwork,
"dst: %s\n", dst);
205 output_links.push_back(link);
211 output_link_destinations.push_back(msg_dsts.
AND(dst));
218 assert(msg_dsts.
count() == 0);
222 for (
int i = 0;
i < output_links.size();
i++) {
223 int outgoing = output_links[
i];
225 if (!
m_out[outgoing][vnet]->areNSlotsAvailable(1, current_time))
228 DPRINTF(RubyNetwork,
"Checking if node is blocked ..."
229 "outgoing: %d, vnet: %d, enough: %d\n",
230 outgoing, vnet, enough);
236 DPRINTF(RubyNetwork,
"Can't deliver message since a node "
238 DPRINTF(RubyNetwork,
"Message: %s\n", (*net_msg_ptr));
242 MsgPtr unmodified_msg_ptr;
244 if (output_links.size() > 1) {
252 unmodified_msg_ptr = msg_ptr->clone();
260 for (
int i=0;
i<output_links.size();
i++) {
261 int outgoing = output_links[
i];
265 msg_ptr = unmodified_msg_ptr->clone();
270 net_msg_ptr = msg_ptr.get();
274 DPRINTF(RubyNetwork,
"Enqueuing net msg from "
275 "inport[%d][%d] to outport [%d][%d].\n",
276 incoming, vnet, outgoing, vnet);
278 m_out[outgoing][vnet]->enqueue(msg_ptr, current_time,
290 int lowest_prio_vnet = 0;
296 highest_prio_vnet = 0;
302 for (
int vnet = highest_prio_vnet;
303 (vnet * decrementer) >= (decrementer * lowest_prio_vnet);
304 vnet -= decrementer) {
virtual const NetDest & getDestination() const
Cycles is a wrapper class for representing cycle counts, i.e.
std::shared_ptr< Message > MsgPtr
uint32_t m_virtual_networks
void scheduleEvent(Cycles timeDelta)
Tick cyclesToTicks(Cycles c) const
bool getAdaptiveRouting()
bool intersectionIsNotEmpty(const NetDest &other_netDest) const
SimpleNetwork * m_network_ptr
std::vector< NetDest > m_routing_table
void storeEventInfo(int info)
bool isVNetOrdered(int vnet) const
const int PRIORITY_SWITCH_LIMIT
const SwitchID m_switch_id
std::enable_if< std::is_integral< T >::value, T >::type random()
Use the SFINAE idiom to choose an implementation based on whether the type is integral or floating po...
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
uint64_t Tick
Tick count type.
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...
std::vector< int > m_pending_message_count
std::vector< LinkOrder > m_link_order
void addOutPort(const std::vector< MessageBuffer * > &out, const NetDest &routing_table_entry)
void removeNetDest(const NetDest &netDest)
NetDest AND(const NetDest &andNetDest) const
std::vector< std::vector< MessageBuffer * > > m_in
void init(SimpleNetwork *)
std::vector< std::vector< MessageBuffer * > > m_out
bool isReady(Tick current_time) const
bool operator<(const LinkOrder &l1, const LinkOrder &l2)
void print(std::ostream &out) const
void operateVnet(int vnet)
PerfectSwitch(SwitchID sid, Switch *, uint32_t)
void addInPort(const std::vector< MessageBuffer * > &in)
void operateMessageBuffer(MessageBuffer *b, int incoming, int vnet)