34 #include "debug/RubyNetwork.hh"
52 for (
int v = 0;
v < routing_table_entry.size();
v++) {
67 if (sVnets.size() == 0) {
72 if (std::find(sVnets.begin(), sVnets.end(), vnet) != sVnets.end()) {
99 int num_candidates = 0;
118 output_link_candidates.push_back(link);
123 if (output_link_candidates.size() == 0) {
124 fatal(
"Fatal Error:: No Route exists from this Router.");
131 candidate = rand() % num_candidates;
133 output_link = output_link_candidates.at(candidate);
178 switch (routing_algorithm) {
190 assert(outport != -1);
206 assert(num_rows > 0 && num_cols > 0);
209 int my_x = my_id % num_cols;
210 int my_y = my_id / num_cols;
213 int dest_x = dest_id % num_cols;
214 int dest_y = dest_id / num_cols;
216 int x_hops = abs(dest_x - my_x);
217 int y_hops = abs(dest_y - my_y);
219 bool x_dirn = (dest_x >= my_x);
220 bool y_dirn = (dest_y >= my_y);
223 assert(!(x_hops == 0 && y_hops == 0));
227 assert(inport_dirn ==
"Local" || inport_dirn ==
"West");
228 outport_dirn =
"East";
230 assert(inport_dirn ==
"Local" || inport_dirn ==
"East");
231 outport_dirn =
"West";
233 }
else if (y_hops > 0) {
236 assert(inport_dirn !=
"North");
237 outport_dirn =
"North";
240 assert(inport_dirn !=
"South");
241 outport_dirn =
"South";
247 panic(
"x_hops == y_hops == 0");
260 panic(
"%s placeholder executed", __FUNCTION__);