Skip to content

Commit 462d1db

Browse files
litghostkmurray
authored andcommitted
Add useful error message on CHAN PTC check.
Previous error would only indicate out of bounds, but not which array or index. Signed-off-by: Keith Rothman <[email protected]>
1 parent 6d8a1bc commit 462d1db

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

vpr/src/route/rr_graph_reader.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -771,14 +771,24 @@ void process_rr_node_indices(const DeviceGrid& grid) {
771771
for (int iy = node.ylow(); iy <= node.yhigh(); iy++) {
772772
for (int ix = node.xlow(); ix <= node.xhigh(); ix++) {
773773
count = node.ptc_num();
774-
indices[CHANX][iy][ix][0].at(count) = inode;
774+
if(count >= indices[CHANX][iy][ix][0].size()) {
775+
VPR_THROW(VPR_ERROR_ROUTE,
776+
"Ptc index %d for CHANX (%d, %d) is out of bounds, size = %zu",
777+
count, ix, iy, indices[CHANX][iy][ix][0].size());
778+
}
779+
indices[CHANX][iy][ix][0][count] = inode;
775780
}
776781
}
777782
} else if (node.type() == CHANY) {
778783
for (int ix = node.xlow(); ix <= node.xhigh(); ix++) {
779784
for (int iy = node.ylow(); iy <= node.yhigh(); iy++) {
780785
count = node.ptc_num();
781-
indices[CHANY][ix][iy][0].at(count) = inode;
786+
if(count >= indices[CHANY][ix][iy][0].size()) {
787+
VPR_THROW(VPR_ERROR_ROUTE,
788+
"Ptc index %d for CHANY (%d, %d) is out of bounds, size = %zu",
789+
count, ix, iy, indices[CHANY][ix][iy][0].size());
790+
}
791+
indices[CHANY][ix][iy][0][count] = inode;
782792
}
783793
}
784794
}

0 commit comments

Comments
 (0)