80 int num_candidates = 0;
98 output_link_candidates.push_back(link);
103 if (output_link_candidates.size() == 0) {
104 fatal(
"Fatal Error:: No Route exists from this Router.");
111 candidate = rand() % num_candidates;
113 output_link = output_link_candidates.at(candidate);
158 switch (routing_algorithm) {
170 assert(outport != -1);
186 assert(num_rows > 0 && num_cols > 0);
189 int my_x = my_id % num_cols;
190 int my_y = my_id / num_cols;
193 int dest_x = dest_id % num_cols;
194 int dest_y = dest_id / num_cols;
196 int x_hops = abs(dest_x - my_x);
197 int y_hops = abs(dest_y - my_y);
199 bool x_dirn = (dest_x >= my_x);
200 bool y_dirn = (dest_y >= my_y);
203 assert(!(x_hops == 0 && y_hops == 0));
207 assert(inport_dirn ==
"Local" || inport_dirn ==
"West");
208 outport_dirn =
"East";
210 assert(inport_dirn ==
"Local" || inport_dirn ==
"East");
211 outport_dirn =
"West";
213 }
else if (y_hops > 0) {
216 assert(inport_dirn !=
"North");
217 outport_dirn =
"North";
220 assert(inport_dirn !=
"South");
221 outport_dirn =
"South";
std::map< int, PortDirection > m_inports_idx2dirn
bool intersectionIsNotEmpty(const NetDest &other_netDest) const
int outportComputeXY(RouteInfo route, int inport, PortDirection inport_dirn)
void addWeight(int link_weight)
int lookupRoutingTable(int vnet, NetDest net_dest)
std::string PortDirection
std::map< int, PortDirection > m_outports_idx2dirn
GarnetNetwork * get_net_ptr()
void addRoute(const NetDest &routing_table_entry)
std::map< PortDirection, int > m_inports_dirn2idx
int outportComputeCustom(RouteInfo route, int inport, PortDirection inport_dirn)
void addInDirection(PortDirection inport_dirn, int inport)
static const int NumArgumentRegs M5_VAR_USED
int outportCompute(RouteInfo route, int inport, PortDirection inport_dirn)
void addOutDirection(PortDirection outport_dirn, int outport)
int getRoutingAlgorithm() const
std::vector< int > m_weight_table
std::vector< NetDest > m_routing_table
std::map< PortDirection, int > m_outports_dirn2idx
RoutingUnit(Router *router)