78 int num_candidates = 0;
96 output_link_candidates.push_back(link);
101 if (output_link_candidates.size() == 0) {
102 fatal(
"Fatal Error:: No Route exists from this Router.");
109 candidate = rand() % num_candidates;
111 output_link = output_link_candidates.at(candidate);
156 switch (routing_algorithm) {
168 assert(outport != -1);
184 assert(num_rows > 0 && num_cols > 0);
187 int my_x = my_id % num_cols;
188 int my_y = my_id / num_cols;
191 int dest_x = dest_id % num_cols;
192 int dest_y = dest_id / num_cols;
194 int x_hops = abs(dest_x - my_x);
195 int y_hops = abs(dest_y - my_y);
197 bool x_dirn = (dest_x >= my_x);
198 bool y_dirn = (dest_y >= my_y);
201 assert(!(x_hops == 0 && y_hops == 0));
205 assert(inport_dirn ==
"Local" || inport_dirn ==
"West");
206 outport_dirn =
"East";
208 assert(inport_dirn ==
"Local" || inport_dirn ==
"East");
209 outport_dirn =
"West";
211 }
else if (y_hops > 0) {
214 assert(inport_dirn !=
"North");
215 outport_dirn =
"North";
218 assert(inport_dirn !=
"South");
219 outport_dirn =
"South";
225 panic(
"x_hops == y_hops == 0");
238 panic(
"%s placeholder executed", __FUNCTION__);
#define panic(...)
This implements a cprintf based panic() function.
std::map< int, PortDirection > m_inports_idx2dirn
#define fatal(...)
This implements a cprintf based fatal() function.
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)
int outportCompute(RouteInfo route, int inport, PortDirection inport_dirn)
void addOutDirection(PortDirection outport_dirn, int outport)
bool intersectionIsNotEmpty(const NetDest &other_netDest) const
std::vector< int > m_weight_table
std::vector< NetDest > m_routing_table
std::map< PortDirection, int > m_outports_dirn2idx
RoutingUnit(Router *router)
int getRoutingAlgorithm() const