Skip to content

Commit 9b2d8e7

Browse files
committed
rr_graph: corrected condition to fixup indexed data
Signed-off-by: Alessandro Comodi <[email protected]>
1 parent 2475e85 commit 9b2d8e7

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

vpr/src/route/rr_graph_indexed_data.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -476,14 +476,18 @@ static void fixup_rr_indexed_data_T_values(size_t num_segment) {
476476
cost_index < CHANX_COST_INDEX_START + 2 * num_segment; cost_index++) {
477477
int ortho_cost_index = device_ctx.rr_indexed_data[cost_index].ortho_cost_index;
478478

479+
auto& indexed_data = device_ctx.rr_indexed_data[cost_index];
480+
auto& ortho_indexed_data = device_ctx.rr_indexed_data[ortho_cost_index];
479481
// Check if this data is uninitialized, but the orthogonal data is
480482
// initialized.
481-
if (!std::isfinite(device_ctx.rr_indexed_data[cost_index].T_linear)
482-
&& std::isfinite(device_ctx.rr_indexed_data[ortho_cost_index].T_linear)) {
483+
// Uninitialized data is set to zero by default.
484+
bool needs_fixup = indexed_data.T_linear == 0 && indexed_data.T_quadratic == 0 && indexed_data.C_load == 0;
485+
bool ortho_data_valid = ortho_indexed_data.T_linear != 0 || ortho_indexed_data.T_quadratic != 0 || ortho_indexed_data.C_load != 0;
486+
if (needs_fixup && ortho_data_valid) {
483487
// Copy orthogonal data over.
484-
device_ctx.rr_indexed_data[cost_index].T_linear = device_ctx.rr_indexed_data[ortho_cost_index].T_linear;
485-
device_ctx.rr_indexed_data[cost_index].T_quadratic = device_ctx.rr_indexed_data[ortho_cost_index].T_quadratic;
486-
device_ctx.rr_indexed_data[cost_index].C_load = device_ctx.rr_indexed_data[ortho_cost_index].C_load;
488+
indexed_data.T_linear = ortho_indexed_data.T_linear;
489+
indexed_data.T_quadratic = ortho_indexed_data.T_quadratic;
490+
indexed_data.C_load = ortho_indexed_data.C_load;
487491
}
488492
}
489493
}

0 commit comments

Comments
 (0)