Skip to content

Commit c1f3c80

Browse files
committed
[vpr] fixed a bug on access invalid grid nodes
1 parent 46dd4bf commit c1f3c80

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

vpr/src/tileable_rr_graph/rr_graph_view_util.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,9 @@ std::vector<RRNodeId> find_rr_graph_grid_nodes(const RRGraphView& rr_graph,
101101
VTR_ASSERT(rr_type == IPIN || rr_type == OPIN);
102102

103103
/* Ensure that (x, y) is a valid location in grids */
104-
VTR_ASSERT(size_t(x) <= device_grid.width() && size_t(y) <= device_grid.height());
104+
if (size_t(x) > device_grid.width() - 1 || size_t(y) > device_grid.height() - 1) {
105+
return indices;
106+
}
105107

106108
/* Ensure we have a valid side */
107109
VTR_ASSERT(side != NUM_SIDES);
@@ -110,6 +112,7 @@ std::vector<RRNodeId> find_rr_graph_grid_nodes(const RRGraphView& rr_graph,
110112
t_physical_tile_loc tile_loc(x, y, layer);
111113
int width_offset = device_grid.get_width_offset(tile_loc);
112114
int height_offset = device_grid.get_height_offset(tile_loc);
115+
113116
for (int pin = 0; pin < device_grid.get_physical_type(tile_loc)->num_pins; ++pin) {
114117
/* Skip those pins have been ignored during rr_graph build-up */
115118
if (true == device_grid.get_physical_type(tile_loc)->is_ignored_pin[pin]) {

0 commit comments

Comments
 (0)