@@ -547,7 +547,7 @@ static RRNodeId get_start_node(int start_x, int start_y, int target_x, int targe
547
547
const auto & temp_rr_graph = device_ctx.rr_graph ; // TODO rename to rr_graph once the rr_graph below is unneeded
548
548
auto & rr_graph = device_ctx.rr_nodes ;
549
549
550
- int result = UNDEFINED ;
550
+ RRNodeId result = RRNodeId::INVALID () ;
551
551
552
552
if (rr_type != CHANX && rr_type != CHANY) {
553
553
VPR_FATAL_ERROR (VPR_ERROR_ROUTE, " Must start lookahead routing from CHANX or CHANY node\n " );
@@ -561,19 +561,11 @@ static RRNodeId get_start_node(int start_x, int start_y, int target_x, int targe
561
561
562
562
int start_lookup_x = start_x;
563
563
int start_lookup_y = start_y;
564
- if (rr_type == CHANX) {
565
- // Bizarely, rr_node_indices stores CHANX with swapped x/y...
566
- std::swap (start_lookup_x, start_lookup_y);
567
- }
568
564
569
- const std::vector<int >& channel_node_list = device_ctx.rr_node_indices [rr_type][start_lookup_x][start_lookup_y][0 ];
570
565
571
566
/* find first node in channel that has specified segment index and goes in the desired direction */
572
- for (unsigned itrack = 0 ; itrack < channel_node_list.size (); itrack++) {
573
- int node_ind = channel_node_list[itrack];
574
- if (node_ind < 0 ) continue ;
575
-
576
- RRNodeId node_id (node_ind);
567
+ for (const RRNodeId& node_id : device_ctx.rr_graph .node_lookup ().find_channel_nodes (start_lookup_x, start_lookup_y, rr_type)) {
568
+ if (!node_id) continue ;
577
569
578
570
VTR_ASSERT (temp_rr_graph.node_type (node_id) == rr_type);
579
571
@@ -583,15 +575,15 @@ static RRNodeId get_start_node(int start_x, int start_y, int target_x, int targe
583
575
584
576
if ((node_direction == direction || node_direction == BI_DIRECTION) && node_seg_ind == seg_index) {
585
577
/* found first track that has the specified segment index and goes in the desired direction */
586
- result = node_ind ;
578
+ result = node_id ;
587
579
if (track_offset == 0 ) {
588
580
break ;
589
581
}
590
582
track_offset -= 2 ;
591
583
}
592
584
}
593
585
594
- return RRNodeId ( result) ;
586
+ return result;
595
587
}
596
588
597
589
/* runs Dijkstra's algorithm from specified node until all nodes have been visited. Each time a pin is visited, the delay/congestion information
0 commit comments