Expand comment on orthogonal data fixup.
Signed-off-by: Keith Rothman <537074+litghost@users.noreply.github.com>
diff --git a/vpr/src/route/rr_graph_indexed_data.cpp b/vpr/src/route/rr_graph_indexed_data.cpp
index cdfb687..0c2e520 100644
--- a/vpr/src/route/rr_graph_indexed_data.cpp
+++ b/vpr/src/route/rr_graph_indexed_data.cpp
@@ -115,12 +115,22 @@
load_rr_indexed_data_T_values((CHANX_COST_INDEX_START + num_segment),
num_segment, CHANY, nodes_per_chan, L_rr_node_indices);
+ // Scan CHANX/CHANY indexed data and search for uninitialized costs.
+ //
+ // This would occur if a segment ends up only being used as CHANX or a
+ // CHANY, but not both. If this occurs, then copying the orthogonal
+ // pair's cost data is likely a better choice than leaving it as -1.
+ //
+ // The primary reason for this fixup is to avoid propagating negative
+ // values in cost functions.
for (int cost_index = CHANX_COST_INDEX_START;
cost_index < CHANX_COST_INDEX_START + 2 * num_segment; cost_index++) {
int ortho_cost_index = device_ctx.rr_indexed_data[cost_index].ortho_cost_index;
- /* If segments doesn't have data (e.g. doesn't exists), check if ortho
- * segment does exist. If so, copy that data. */
+
+ // Check if this data is uninitialized, but the orthogonal data is
+ // initialized.
if (device_ctx.rr_indexed_data[cost_index].T_linear == OPEN && device_ctx.rr_indexed_data[ortho_cost_index].T_linear != OPEN) {
+ // Copy orthogonal data over.
device_ctx.rr_indexed_data[cost_index].T_linear = device_ctx.rr_indexed_data[ortho_cost_index].T_linear;
device_ctx.rr_indexed_data[cost_index].T_quadratic = device_ctx.rr_indexed_data[ortho_cost_index].T_quadratic;
device_ctx.rr_indexed_data[cost_index].C_load = device_ctx.rr_indexed_data[ortho_cost_index].C_load;