Skip to content

Commit dda2e43

Browse files
Add static function declarations to rr_graph_interposer.cpp
1 parent 0fc6d07 commit dda2e43

File tree

1 file changed

+47
-28
lines changed

1 file changed

+47
-28
lines changed

vpr/src/route/rr_graph_generation/rr_graph_interposer.cpp

Lines changed: 47 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,57 @@
1515

1616
#include "rr_graph_interposer.h"
1717

18+
// Static function declarations
19+
1820
/**
1921
* @brief Takes location of a source and a sink and determines wether it crosses cut_loc or not.
2022
* For example, the interval (1, 4) is cut by 3, while it is not cut by 5 or 0.
2123
*/
24+
static bool should_cut(int src_loc, int sink_loc, int cut_loc);
25+
26+
/**
27+
* @brief Calculates the starting x point of node based on it's directionality.
28+
*/
29+
static short node_xstart(const RRGraphView& rr_graph, RRNodeId node);
30+
31+
/**
32+
* @brief Calculates the starting y point of node based on it's directionality.
33+
*/
34+
static short node_ystart(const RRGraphView& rr_graph, RRNodeId node);
35+
36+
/**
37+
* @brief Update a CHANY node's bounding box in RRGraph and SpatialLookup entries.
38+
* This function assumes that the channel node actually crosses the cut location and
39+
* might not function correctly otherwise.
40+
*
41+
* This is a low level function, you should use cut_channel_node that wraps this up in a nicer API.
42+
*/
43+
static void cut_chan_y_node(RRNodeId node, int x_low, int y_low, int x_high, int y_high, int layer, int ptc_num, int cut_loc_y,
44+
Direction node_direction, RRGraphBuilder& rr_graph_builder, RRSpatialLookup& spatial_lookup);
45+
46+
/**
47+
* @brief Update a CHANX node's bounding box in RRGraph and SpatialLookup entries.
48+
* This function assumes that the channel node actually crosses the cut location and
49+
* might not function correctly otherwise.
50+
*
51+
* This is a low level function, you should use cut_channel_node that wraps this up in a nicer API.
52+
*/
53+
static void cut_chan_x_node(RRNodeId node, int x_low, int y_low, int x_high, int y_high, int layer, int ptc_num, int cut_loc_x,
54+
Direction node_direction, RRGraphBuilder& rr_graph_builder, RRSpatialLookup& spatial_lookup);
55+
56+
/**
57+
* @brief Update a CHANX or CHANY node's bounding box in RRGraph and SpatialLookup entries if it crosses cut_loc
58+
*
59+
* @param node Channel segment RR graph node that might cross the interposer cut line
60+
* @param cut_loc location of vertical interposer cut line
61+
* @param interposer_cut_type Type of the interposer cut line (Horizontal or vertical)
62+
* @param sg_node_indices Sorted list of scatter-gather node IDs. We do not want to cut these nodes as they're allowed to cross an interposer cut line.
63+
*/
64+
static void cut_channel_node(RRNodeId node, int cut_loc, e_interposer_cut_type interposer_cut_type, const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_builder,
65+
RRSpatialLookup& spatial_lookup, const std::vector<std::pair<RRNodeId, int>>& sg_node_indices);
66+
67+
// Function definitions
68+
2269
static bool should_cut(int src_loc, int sink_loc, int cut_loc) {
2370
int src_delta = src_loc - cut_loc;
2471
int sink_delta = sink_loc - cut_loc;
@@ -31,9 +78,6 @@ static bool should_cut(int src_loc, int sink_loc, int cut_loc) {
3178
}
3279
}
3380

34-
/**
35-
* @brief Calculates the starting x point of node based on it's directionality.
36-
*/
3781
static short node_xstart(const RRGraphView& rr_graph, RRNodeId node) {
3882
e_rr_type node_type = rr_graph.node_type(node);
3983
Direction node_direction = rr_graph.node_direction(node);
@@ -67,9 +111,6 @@ static short node_xstart(const RRGraphView& rr_graph, RRNodeId node) {
67111
}
68112
}
69113

70-
/**
71-
* @brief Calculates the starting y point of node based on it's directionality.
72-
*/
73114
static short node_ystart(const RRGraphView& rr_graph, RRNodeId node) {
74115
e_rr_type node_type = rr_graph.node_type(node);
75116
Direction node_direction = rr_graph.node_direction(node);
@@ -147,13 +188,6 @@ std::vector<RREdgeId> mark_interposer_cut_edges_for_removal(const RRGraphView& r
147188
return edges_to_be_removed;
148189
}
149190

150-
/**
151-
* @brief Update a CHANY node's bounding box in RRGraph and SpatialLookup entries.
152-
* This function assumes that the channel node actually crosses the cut location and
153-
* might not function correctly otherwise.
154-
*
155-
* This is a low level function, you should use cut_channel_node that wraps this up in a nicer API.
156-
*/
157191
static void cut_chan_y_node(RRNodeId node, int x_low, int y_low, int x_high, int y_high, int layer, int ptc_num, int cut_loc_y,
158192
Direction node_direction, RRGraphBuilder& rr_graph_builder, RRSpatialLookup& spatial_lookup) {
159193
if (node_direction == Direction::INC) {
@@ -177,13 +211,6 @@ static void cut_chan_y_node(RRNodeId node, int x_low, int y_low, int x_high, int
177211
}
178212
}
179213

180-
/**
181-
* @brief Update a CHANX node's bounding box in RRGraph and SpatialLookup entries.
182-
* This function assumes that the channel node actually crosses the cut location and
183-
* might not function correctly otherwise.
184-
*
185-
* This is a low level function, you should use cut_channel_node that wraps this up in a nicer API.
186-
*/
187214
static void cut_chan_x_node(RRNodeId node, int x_low, int y_low, int x_high, int y_high, int layer, int ptc_num, int cut_loc_x,
188215
Direction node_direction, RRGraphBuilder& rr_graph_builder, RRSpatialLookup& spatial_lookup) {
189216
if (node_direction == Direction::INC) {
@@ -207,14 +234,6 @@ static void cut_chan_x_node(RRNodeId node, int x_low, int y_low, int x_high, int
207234
}
208235
}
209236

210-
/**
211-
* @brief Update a CHANX or CHANY node's bounding box in RRGraph and SpatialLookup entries if it crosses cut_loc
212-
*
213-
* @param node Channel segment RR graph node that might cross the interposer cut line
214-
* @param cut_loc location of vertical interposer cut line
215-
* @param interposer_cut_type Type of the interposer cut line (Horizontal or vertical)
216-
* @param sg_node_indices Sorted list of scatter-gather node IDs. We do not want to cut these nodes as they're allowed to cross an interposer cut line.
217-
*/
218237
static void cut_channel_node(RRNodeId node, int cut_loc, e_interposer_cut_type interposer_cut_type, const RRGraphView& rr_graph, RRGraphBuilder& rr_graph_builder,
219238
RRSpatialLookup& spatial_lookup, const std::vector<std::pair<RRNodeId, int>>& sg_node_indices) {
220239
constexpr auto node_indice_compare = [](RRNodeId l, RRNodeId r) noexcept { return size_t(l) < size_t(r); };

0 commit comments

Comments
 (0)