1818#include " route_common.h"
1919#include " route_debug.h"
2020
21+ /* *
22+ * We will profile delay/congestion using this many tracks for each wire type.
23+ * Larger values increase the time to compute the lookahead, but may give
24+ * more accurate lookahead estimates during routing.
25+ */
26+ static constexpr int MAX_TRACK_OFFSET = 16 ;
27+
2128static void dijkstra_flood_to_wires (int itile, RRNodeId inode, util::t_src_opin_delays& src_opin_delays);
2229
2330static void dijkstra_flood_to_ipins (RRNodeId node, util::t_chan_ipins_delays& chan_ipins_delays);
@@ -51,13 +58,42 @@ static void expand_dijkstra_neighbours(util::PQ_Entry parent_entry,
5158 vtr::vector<RRNodeId, bool >& node_expanded,
5259 std::priority_queue<util::PQ_Entry>& pq);
5360
54- static std::pair<int , int > adjust_rr_position (const RRNodeId rr);
5561
56- static std::pair<int , int > adjust_rr_pin_position (const RRNodeId rr);
62+ /* *
63+ * @brief Computes the adjusted position of an RR graph node.
64+ * This function does not modify the position of the given node.
65+ * It only returns the computed adjusted position.
66+ * @param rr The ID of the node whose adjusted position is desired.
67+ * @return The adjusted position (x, y).
68+ */
69+ static std::pair<int , int > get_adjusted_rr_position (RRNodeId rr);
70+
71+ /* *
72+ * @brief Computes the adjusted location of a pin to match the position of
73+ * the channel it can reach based on which side of the block it is at.
74+ * @param rr The corresponding node of a pin whose adjusted positions
75+ * is desired.
76+ * @return The adjusted position (x, y).
77+ */
78+ static std::pair<int , int > get_adjusted_rr_pin_position (RRNodeId rr);
5779
58- static std::pair<int , int > adjust_rr_wire_position (const RRNodeId rr);
80+ /* *
81+ * @brief Computed the adjusted position of a node of type
82+ * CHANX or CHANY. For uni-directional wires, return the position
83+ * of the driver, and for bi-directional wires, compute the middle point.
84+ * @param rr The ID of the node whose adjusted position is desired.
85+ * @return The adjusted position (x, y).
86+ */
87+ static std::pair<int , int > get_adjusted_rr_wire_position (RRNodeId rr);
5988
60- static std::pair<int , int > adjust_rr_src_sink_position (const RRNodeId rr);
89+ /* *
90+ * @brief Computes the adjusted position and source and sink nodes.
91+ * SOURCE/SINK nodes assume the full dimensions of their associated block/
92+ * This function computes the average position for the given node.
93+ * @param rr SOURCE or SINK node whose adjusted position is needed.
94+ * @return The adjusted position (x, y).
95+ */
96+ static std::pair<int , int > get_adjusted_rr_src_sink_position (RRNodeId rr);
6197
6298// Constants needed to reduce the bounding box when expanding CHAN wires to reach the IPINs.
6399// These are used when finding all the delays to get to the IPINs of all the different tile types
@@ -549,7 +585,6 @@ RRNodeId get_start_node(int layer, int start_x, int start_y, int target_x, int t
549585 return result;
550586}
551587
552- /* returns the absolute delta_x and delta_y offset required to reach to_node from from_node */
553588std::pair<int , int > get_xy_deltas (RRNodeId from_node, RRNodeId to_node) {
554589 auto & device_ctx = g_vpr_ctx.device ();
555590 const auto & rr_graph = device_ctx.rr_graph ;
@@ -561,8 +596,8 @@ std::pair<int, int> get_xy_deltas(RRNodeId from_node, RRNodeId to_node) {
561596
562597 if (!is_chan (from_type) && !is_chan (to_type)) {
563598 // Alternate formulation for non-channel types
564- auto [from_x, from_y] = adjust_rr_position (from_node);
565- auto [to_x, to_y] = adjust_rr_position (to_node);
599+ auto [from_x, from_y] = get_adjusted_rr_position (from_node);
600+ auto [to_x, to_y] = get_adjusted_rr_position (to_node);
566601
567602 delta_x = to_x - from_x;
568603 delta_y = to_y - from_y;
@@ -757,7 +792,7 @@ t_routing_cost_map get_routing_cost_map(int longest_seg_length,
757792 routing_cost_map.fill (Expansion_Cost_Entry ());
758793
759794 // to avoid multiple memory allocation and de-allocations in run_dijkstra()
760- // dijkstra_data is created outside the for loop as passed by reference to dijkstra_data()
795+ // dijkstra_data is created outside the for loop and passed by reference to dijkstra_data()
761796 t_dijkstra_data dijkstra_data;
762797
763798 for (RRNodeId sample_node : sample_nodes) {
@@ -1375,23 +1410,23 @@ static void expand_dijkstra_neighbours(util::PQ_Entry parent_entry,
13751410 }
13761411}
13771412
1378- static std::pair<int , int > adjust_rr_position (const RRNodeId rr) {
1413+ static std::pair<int , int > get_adjusted_rr_position (const RRNodeId rr) {
13791414 auto & device_ctx = g_vpr_ctx.device ();
13801415 const auto & rr_graph = device_ctx.rr_graph ;
13811416
13821417 e_rr_type rr_type = rr_graph.node_type (rr);
13831418
13841419 if (is_chan (rr_type)) {
1385- return adjust_rr_wire_position (rr);
1420+ return get_adjusted_rr_wire_position (rr);
13861421 } else if (is_pin (rr_type)) {
1387- return adjust_rr_pin_position (rr);
1422+ return get_adjusted_rr_pin_position (rr);
13881423 } else {
13891424 VTR_ASSERT_SAFE (is_src_sink (rr_type));
1390- return adjust_rr_src_sink_position (rr);
1425+ return get_adjusted_rr_src_sink_position (rr);
13911426 }
13921427}
13931428
1394- static std::pair<int , int > adjust_rr_pin_position (const RRNodeId rr) {
1429+ static std::pair<int , int > get_adjusted_rr_pin_position (const RRNodeId rr) {
13951430 /*
13961431 * VPR uses a co-ordinate system where wires above and to the right of a block
13971432 * are at the same location as the block:
@@ -1458,7 +1493,7 @@ static std::pair<int, int> adjust_rr_pin_position(const RRNodeId rr) {
14581493 return {x, y};
14591494}
14601495
1461- static std::pair<int , int > adjust_rr_wire_position (const RRNodeId rr) {
1496+ static std::pair<int , int > get_adjusted_rr_wire_position (const RRNodeId rr) {
14621497 auto & device_ctx = g_vpr_ctx.device ();
14631498 const auto & rr_graph = device_ctx.rr_graph ;
14641499
@@ -1481,7 +1516,7 @@ static std::pair<int, int> adjust_rr_wire_position(const RRNodeId rr) {
14811516 }
14821517}
14831518
1484- static std::pair<int , int > adjust_rr_src_sink_position (const RRNodeId rr) {
1519+ static std::pair<int , int > get_adjusted_rr_src_sink_position (const RRNodeId rr) {
14851520 // SOURCE/SINK nodes assume the full dimensions of their
14861521 // associated block
14871522
0 commit comments