diff --git a/vpr7_x2p/vpr/SRC/device/rr_graph/rr_graph_builder_utils.cpp b/vpr7_x2p/vpr/SRC/device/rr_graph/rr_graph_builder_utils.cpp index 6752def9e..167d6d161 100644 --- a/vpr7_x2p/vpr/SRC/device/rr_graph/rr_graph_builder_utils.cpp +++ b/vpr7_x2p/vpr/SRC/device/rr_graph/rr_graph_builder_utils.cpp @@ -341,6 +341,33 @@ void add_edges_for_two_rr_nodes(const t_rr_graph* rr_graph, } +/************************************************************************ + * Get the track_id of a routing track w.r.t its coordinator + * In tileable routing architecture, the track_id changes SB by SB. + * Therefore the track_ids are stored in a vector, indexed by the relative coordinator + * based on the starting point of the track + * For routing tracks in INC_DIRECTION + * (xlow, ylow) should be the starting point + * + * (xlow, ylow) (xhigh, yhigh) + * track_id[0] -------------------------------> track_id[xhigh - xlow + yhigh - ylow] + * + * For routing tracks in DEC_DIRECTION + * (xhigh, yhigh) should be the starting point + * + * (xlow, ylow) (xhigh, yhigh) + * track_id[0] <------------------------------- track_id[xhigh - xlow + yhigh - ylow] + * + * + ***********************************************************************/ +short get_rr_node_actual_track_id(const t_rr_node* track_rr_node, + const DeviceCoordinator& coord) { + DeviceCoordinator low_coord(track_rr_node->xlow, track_rr_node->ylow); + size_t offset = (int)abs((int)coord.get_x() - (int)low_coord.get_x() + (int)coord.get_y() - (int)low_coord.get_y()); + return track_rr_node->track_ids[offset]; +} + + /************************************************************************ * Get the coordinator of a starting point of a routing track * For routing tracks in INC_DIRECTION diff --git a/vpr7_x2p/vpr/SRC/device/rr_graph/rr_graph_builder_utils.h b/vpr7_x2p/vpr/SRC/device/rr_graph/rr_graph_builder_utils.h index c213546d5..5ef5382f3 100644 --- a/vpr7_x2p/vpr/SRC/device/rr_graph/rr_graph_builder_utils.h +++ b/vpr7_x2p/vpr/SRC/device/rr_graph/rr_graph_builder_utils.h @@ -35,6 +35,9 @@ void add_edges_for_two_rr_nodes(const t_rr_graph* rr_graph, const std::vector des_rr_node, const std::vector driver_switches); +short get_rr_node_actual_track_id(const t_rr_node* track_rr_node, + const DeviceCoordinator& coord); + DeviceCoordinator get_track_rr_node_start_coordinator(const t_rr_node* track_rr_node); DeviceCoordinator get_track_rr_node_end_coordinator(const t_rr_node* track_rr_node); diff --git a/vpr7_x2p/vpr/SRC/route/route_common.c b/vpr7_x2p/vpr/SRC/route/route_common.c index ad8f2d8eb..83b7c8070 100755 --- a/vpr7_x2p/vpr/SRC/route/route_common.c +++ b/vpr7_x2p/vpr/SRC/route/route_common.c @@ -20,6 +20,8 @@ #include "buffer_insertion.h" /* end */ +#include "rr_graph_builder_utils.h" + /* Xifan TANG: useful functions for pb_pin_eq_auto_detect */ void reassign_rr_node_net_num_from_scratch(); @@ -1214,7 +1216,18 @@ void print_route(char *route_file) { break; } - fprintf(fp, "%d ", rr_node[inode].ptc_num); + /* A kind of dirty fix for tileable routing, + * the track_ids is allocated by tileable routing. + * If the vector is not empty, it means tileable routing is enabled + * we need another function to get the track_id rather than ptc_num + */ + if (0 == rr_node[inode].track_ids.size()) { + fprintf(fp, "%d ", rr_node[inode].ptc_num); + } else { + /* Xifan Tang: for routing tracks, get the actual track ids */ + DeviceCoordinator cur_coord(ilow, jlow); + fprintf(fp, "%d ", get_rr_node_actual_track_id(&(rr_node[inode]), cur_coord)); + } /* Uncomment line below if you're debugging and want to see the switch types * * used in the routing. */