@@ -631,7 +631,14 @@ void t_rr_graph_storage::set_node_direction(RRNodeId id, Direction new_direction
631631
632632void t_rr_graph_storage::set_node_ptc_nums (RRNodeId node, const std::vector<int >& ptc_numbers) {
633633 VTR_ASSERT (size_t (node) < node_storage_.size ());
634- VTR_ASSERT (ptc_numbers.size () >= 1 );
634+ VTR_ASSERT (!ptc_numbers.empty ());
635+ // The default VTR RR graph generator assigns only one PTC number per node, which is
636+ // stored in the node_ptc_ field of rr_graph_storage. However, when the tileable RR
637+ // graph is used, CHANX/CHANY nodes can have multiple PTC numbers.
638+ //
639+ // To satisfy VPR's requirements, we store the PTC number for offset = 0 in the
640+ // node_ptc_ field, and store all PTC numbers assigned to the node in the
641+ // node_tileable_track_nums_ field.
635642 set_node_ptc_num (node, ptc_numbers[0 ]);
636643 if (ptc_numbers.size () > 1 ) {
637644 VTR_ASSERT (size_t (node) < node_tilable_track_nums_.size ());
@@ -649,12 +656,13 @@ void t_rr_graph_storage::add_node_tilable_track_num(RRNodeId node, size_t node_o
649656 " Track number valid only for CHANX/CHANY RR nodes" );
650657
651658 size_t node_length = std::abs (node_xhigh (node) - node_xlow (node))
652- + std::abs (node_yhigh (node) - node_ylow (node));
653- if (node_length + 1 != node_tilable_track_nums_[node].size ()) {
654- node_tilable_track_nums_[node].resize (node_length + 1 );
655- }
659+ + std::abs (node_yhigh (node) - node_ylow (node))
660+ + 1 ;
661+ VTR_ASSERT (node_offset < node_length-1 ); // Since the offset starts from 0, the last index is node_length-1
656662
657- VTR_ASSERT (node_offset < node_tilable_track_nums_[node].size ());
663+ if (node_length != node_tilable_track_nums_[node].size ()) {
664+ node_tilable_track_nums_[node].resize (node_length);
665+ }
658666
659667 node_tilable_track_nums_[node][node_offset] = track_id;
660668}
0 commit comments