Skip to content

Commit a79a4c3

Browse files
widen CHANX and CHANY limits in check_rr_node()
1 parent 641de49 commit a79a4c3

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

libs/librrgraph/src/base/check_rr_graph.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,10 @@ void check_rr_node(const RRGraphView& rr_graph,
334334
int tracks_per_node;
335335
RRNodeId rr_node = RRNodeId(inode);
336336

337+
const int grid_width = grid.width();
338+
const int grid_height = grid.height();
339+
const int grid_layers = grid.get_num_layers();
340+
337341
e_rr_type rr_type = rr_graph.node_type(rr_node);
338342
int xlow = rr_graph.node_xlow(rr_node);
339343
int xhigh = rr_graph.node_xhigh(rr_node);
@@ -343,19 +347,18 @@ void check_rr_node(const RRGraphView& rr_graph,
343347
int ptc_num = rr_graph.node_ptc_num(rr_node);
344348
int capacity = rr_graph.node_capacity(rr_node);
345349
RRIndexedDataId cost_index = rr_graph.node_cost_index(rr_node);
346-
t_physical_tile_type_ptr type = nullptr;
347350

348351
if (xlow > xhigh || ylow > yhigh) {
349352
VPR_ERROR(VPR_ERROR_ROUTE,
350353
"in check_rr_node: rr endpoints are (%d,%d) and (%d,%d).\n", xlow, ylow, xhigh, yhigh);
351354
}
352355

353-
if (xlow < 0 || xhigh > int(grid.width()) - 1 || ylow < 0 || yhigh > int(grid.height()) - 1) {
356+
if (xlow < 0 || xhigh > grid_width - 1 || ylow < 0 || yhigh > grid_height - 1) {
354357
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
355358
"in check_rr_node: rr endpoints (%d,%d) and (%d,%d) are out of range.\n", xlow, ylow, xhigh, yhigh);
356359
}
357360

358-
if (layer_num < 0 || layer_num > int(grid.get_num_layers()) - 1) {
361+
if (layer_num < 0 || layer_num > grid_layers - 1) {
359362
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
360363
"in check_rr_node: rr endpoints layer_num (%d) is out of range.\n", layer_num);
361364
}
@@ -370,8 +373,8 @@ void check_rr_node(const RRGraphView& rr_graph,
370373
"in check_rr_node: node %d cost index (%d) is out of range.\n", inode, cost_index);
371374
}
372375

373-
/* Check that the segment is within the array and such. */
374-
type = grid.get_physical_type({xlow, ylow, layer_num});
376+
// Check that the segment is within the array and such.
377+
t_physical_tile_type_ptr type = grid.get_physical_type({xlow, ylow, layer_num});
375378

376379
switch (rr_type) {
377380
case e_rr_type::SOURCE:
@@ -411,7 +414,7 @@ void check_rr_node(const RRGraphView& rr_graph,
411414
break;
412415

413416
case e_rr_type::CHANX:
414-
if (xlow < 1 || xhigh > int(grid.width()) - 2 || yhigh > int(grid.height()) - 2 || yhigh != ylow) {
417+
if (xlow < 1 || xhigh > grid_width - 1 || yhigh > grid_height - 1 || yhigh != ylow) {
415418
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
416419
"in check_rr_node: CHANX out of range for endpoints (%d,%d) and (%d,%d)\n", xlow, ylow, xhigh, yhigh);
417420
}
@@ -422,7 +425,7 @@ void check_rr_node(const RRGraphView& rr_graph,
422425
break;
423426

424427
case e_rr_type::CHANY:
425-
if (xhigh > int(grid.width()) - 2 || ylow < 1 || yhigh > int(grid.height()) - 2 || xlow != xhigh) {
428+
if (xhigh > grid_width - 1 || ylow < 1 || yhigh > grid_height - 1 || xlow != xhigh) {
426429
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
427430
"Error in check_rr_node: CHANY out of range for endpoints (%d,%d) and (%d,%d)\n", xlow, ylow, xhigh, yhigh);
428431
}
@@ -433,7 +436,7 @@ void check_rr_node(const RRGraphView& rr_graph,
433436
break;
434437

435438
case e_rr_type::CHANZ:
436-
if (xhigh != xlow || yhigh != ylow || xhigh > int(grid.width()) - 1 || ylow < 1 || yhigh > int(grid.height()) - 1) {
439+
if (xhigh != xlow || yhigh != ylow || xhigh > grid_width - 1 || ylow < 1 || yhigh > grid_height - 1) {
437440
VPR_FATAL_ERROR(VPR_ERROR_ROUTE,
438441
"Error in check_rr_node: CHANZ out of range for endpoints (%d,%d) and (%d,%d)\n", xlow, ylow, xhigh, yhigh);
439442
}

0 commit comments

Comments
 (0)