35#include "debug/RubyNetwork.hh"
62 for (
int v = 0;
v < routing_table_entry.size();
v++) {
77 if (sVnets.size() == 0) {
82 if (std::find(sVnets.begin(), sVnets.end(), vnet) != sVnets.end()) {
106 int output_link = -1;
109 int num_candidates = 0;
128 output_link_candidates.push_back(link);
133 if (output_link_candidates.size() == 0) {
134 fatal(
"Fatal Error:: No Route exists from this Router.");
141 candidate = rand() % num_candidates;
143 output_link = output_link_candidates.at(candidate);
188 switch (routing_algorithm) {
200 assert(outport != -1);
216 assert(num_rows > 0 && num_cols > 0);
219 int my_x = my_id % num_cols;
220 int my_y = my_id / num_cols;
223 int dest_x = dest_id % num_cols;
224 int dest_y = dest_id / num_cols;
226 int x_hops = abs(dest_x - my_x);
227 int y_hops = abs(dest_y - my_y);
229 bool x_dirn = (dest_x >= my_x);
230 bool y_dirn = (dest_y >= my_y);
233 assert(!(x_hops == 0 && y_hops == 0));
237 assert(inport_dirn ==
"Local" || inport_dirn ==
"West");
238 outport_dirn =
"East";
240 assert(inport_dirn ==
"Local" || inport_dirn ==
"East");
241 outport_dirn =
"West";
243 }
else if (y_hops > 0) {
246 assert(inport_dirn !=
"North");
247 outport_dirn =
"North";
250 assert(inport_dirn !=
"South");
251 outport_dirn =
"South";
257 panic(
"x_hops == y_hops == 0");
270 panic(
"%s placeholder executed", __FUNCTION__);
bool intersectionIsNotEmpty(const NetDest &other_netDest) const
int getRoutingAlgorithm() const
GarnetNetwork * get_net_ptr()
void addOutDirection(PortDirection outport_dirn, int outport)
int outportComputeCustom(RouteInfo route, int inport, PortDirection inport_dirn)
int lookupRoutingTable(int vnet, NetDest net_dest)
void addInDirection(PortDirection inport_dirn, int inport)
std::vector< int > m_weight_table
std::vector< std::vector< NetDest > > m_routing_table
std::map< int, PortDirection > m_inports_idx2dirn
int outportComputeXY(RouteInfo route, int inport, PortDirection inport_dirn)
void addRoute(std::vector< NetDest > &routing_table_entry)
RoutingUnit(Router *router)
std::map< int, PortDirection > m_outports_idx2dirn
bool supportsVnet(int vnet, std::vector< int > sVnets)
std::map< PortDirection, int > m_outports_dirn2idx
void addWeight(int link_weight)
std::map< PortDirection, int > m_inports_dirn2idx
int outportCompute(RouteInfo route, int inport, PortDirection inport_dirn)
#define panic(...)
This implements a cprintf based panic() function.
#define fatal(...)
This implements a cprintf based fatal() function.
std::string PortDirection
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.