Skip to content

Commit 690cc63

Browse files
committed
[vpr][route] fix max seg idx
1 parent faecc12 commit 690cc63

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

vpr/src/route/router_lookahead_map_utils.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -676,9 +676,13 @@ std::pair<int, int> get_xy_deltas(RRNodeId from_node, RRNodeId to_node) {
676676
// If the routing channel starts from the perimeter of the grid,
677677
// and it is heading towards the outside of the grid, we should
678678
// not increment the delta_seg by 1.
679-
if (!((from_seg_low == 0 && from_dir == Direction::DEC) ||
680-
(from_seg_low == static_cast<int>(device_ctx.grid.height()) - 1 &&
681-
from_dir == Direction::INC))) {
679+
int max_seg_index = -1;
680+
if (from_type == CHANX) {
681+
max_seg_index = static_cast<int>(device_ctx.grid.width()) - 1;
682+
} else {
683+
max_seg_index = static_cast<int>(device_ctx.grid.height()) - 1;
684+
}
685+
if (!((from_seg_low == 0 && from_dir == Direction::DEC) || (from_seg_low == max_seg_index && from_dir == Direction::INC))) {
682686
delta_seg++;
683687
}
684688
}

0 commit comments

Comments
 (0)