Skip to content

Commit f09069e

Browse files
committed
Remove assumption about rr node order when reading XML.
Signed-off-by: Keith Rothman <[email protected]>
1 parent 771be2c commit f09069e

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

vpr/src/route/rr_graph_reader.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -864,8 +864,9 @@ void set_cost_indices(pugi::xml_node parent, const pugiutil::loc_data& loc_data,
864864
/*Go through each rr_node and use the segment ids to set CHANX and CHANY cost index*/
865865
rr_node = get_first_child(parent, "node", loc_data);
866866

867-
for (size_t i = 0; i < device_ctx.rr_nodes.size(); i++) {
868-
auto& node = device_ctx.rr_nodes[i];
867+
while (rr_node) {
868+
int inode = get_attribute(rr_node, "id", loc_data).as_int();
869+
auto& node = device_ctx.rr_nodes[inode];
869870

870871
/*CHANX and CHANY cost index is dependent on the segment id*/
871872

@@ -876,9 +877,9 @@ void set_cost_indices(pugi::xml_node parent, const pugiutil::loc_data& loc_data,
876877
int seg_id = get_attribute(segmentSubnode, "segment_id", loc_data).as_int(0);
877878
if (is_global_graph) {
878879
node.set_cost_index(0);
879-
} else if (device_ctx.rr_nodes[i].type() == CHANX) {
880+
} else if (node.type() == CHANX) {
880881
node.set_cost_index(CHANX_COST_INDEX_START + seg_id);
881-
} else if (device_ctx.rr_nodes[i].type() == CHANY) {
882+
} else if (node.type() == CHANY) {
882883
node.set_cost_index(CHANX_COST_INDEX_START + num_seg_types + seg_id);
883884
}
884885
}

0 commit comments

Comments
 (0)