@@ -130,6 +130,17 @@ static int vpr_to_phy_track(const int itrack,
130130 const t_chan_seg_details* seg_details,
131131 const enum e_directionality directionality);
132132
133+
134+ /* *
135+ * @brief Identifies and labels all mux endpoints at a given channel segment coordinate.
136+ *
137+ * This routine scans all routing tracks within a channel segment (specified by
138+ * 'chan_num' and 'seg_num') and collects the track indices corresponding to
139+ * valid mux endpoints that can be driven by OPINs in that channel segment.
140+ * The resulting list of eligible tracks is returned in natural (increasing) track order.
141+ *
142+ * @details If @p seg_type_index is UNDEFINED, all segment types are considered.
143+ */
133144static void label_wire_muxes (const int chan_num,
134145 const int seg_num,
135146 const t_chan_seg_details* seg_details,
@@ -673,7 +684,7 @@ int get_bidir_opin_connections(RRGraphBuilder& rr_graph_builder,
673684 return num_conn;
674685}
675686
676- /* AA: Actually builds the edges from the OPIN nodes already allocated to their correct tracks for segment seg_Inf[seg_type_index].
687+ /* Actually builds the edges from the OPIN nodes already allocated to their correct tracks for segment seg_Inf[seg_type_index].
677688 * Note that this seg_inf vector is NOT the segment_info vectored as stored in the device variable. This index is w.r.t to seg_inf_x
678689 * or seg_inf_y for x-adjacent and y-adjacent segments respectively. This index is assigned in get_seg_details earlier
679690 * in the rr_graph_builder routine. This t_seg_detail is then used to build t_chan_seg_details which is passed in to label_wire mux
@@ -696,21 +707,20 @@ int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
696707 /* Gets a linked list of Fc nodes of specified seg_type_index to connect
697708 * to in given chan seg. Fc_ofs is used for the opin staggering pattern. */
698709
699- int num_inc_muxes, num_dec_muxes;
700-
701710 *Fc_clipped = false ;
702711
703- /* Fc is assigned in pairs so check it is even. */
712+ // Fc is assigned in pairs so check it is even.
704713 VTR_ASSERT (Fc % 2 == 0 );
705714
706- /* get_rr_node_indices needs x and y coords. */
707- int x = (( e_rr_type::CHANX == chan_type) ? seg : chan) ;
708- int y = (( e_rr_type::CHANX == chan_type) ? chan : seg) ;
715+ // get_rr_node_indices needs x and y coords.
716+ int x = (e_rr_type::CHANX == chan_type) ? seg : chan;
717+ int y = (e_rr_type::CHANX == chan_type) ? chan : seg;
709718
710- /* Get the lists of possible muxes. */
719+ // Get the lists of possible muxes.
711720 int dummy;
712721 std::vector<int > inc_muxes;
713722 std::vector<int > dec_muxes;
723+ int num_inc_muxes, num_dec_muxes;
714724 // Determine the channel width instead of using max channels to not create hanging nodes
715725 int max_chan_width = (e_rr_type::CHANX == chan_type) ? nodes_per_chan.x_list [y] : nodes_per_chan.y_list [x];
716726
@@ -719,33 +729,33 @@ int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
719729 label_wire_muxes (chan, seg, seg_details, seg_type_index, max_len,
720730 Direction::DEC, max_chan_width, true , dec_muxes, &num_dec_muxes, &dummy);
721731
722- /* Clip Fc to the number of muxes. */
732+ // Clip Fc to the number of muxes.
723733 if (((Fc / 2 ) > num_inc_muxes) || ((Fc / 2 ) > num_dec_muxes)) {
724734 *Fc_clipped = true ;
725735 Fc = 2 * std::min (num_inc_muxes, num_dec_muxes);
726736 }
727737
728- /* Assign tracks to meet Fc demand */
738+ // Assign tracks to meet Fc demand
729739 int num_edges = 0 ;
730740 for (int iconn = 0 ; iconn < (Fc / 2 ); ++iconn) {
731- /* Figure of the next mux to use for the 'inc' and 'dec' connections */
741+ // Figure of the next mux to use for the 'inc' and 'dec' connections
732742 int inc_mux = Fc_ofs[chan][seg][seg_type_index] % num_inc_muxes;
733743 int dec_mux = Fc_ofs[chan][seg][seg_type_index] % num_dec_muxes;
734744 ++Fc_ofs[chan][seg][seg_type_index];
735745
736- /* Figure out the track it corresponds to. */
746+ // Figure out the track it corresponds to.
737747 int inc_track = inc_muxes[inc_mux];
738748 int dec_track = dec_muxes[dec_mux];
739749
740- /* Figure the inodes of those muxes */
750+ // Figure the inodes of those muxes
741751 RRNodeId inc_inode_index = rr_graph_builder.node_lookup ().find_node (layer, x, y, chan_type, inc_track);
742752 RRNodeId dec_inode_index = rr_graph_builder.node_lookup ().find_node (layer, x, y, chan_type, dec_track);
743753
744754 if (!inc_inode_index || !dec_inode_index) {
745755 continue ;
746756 }
747757
748- /* Add to the list. */
758+ // Add to the list.
749759 short to_switch = seg_details[inc_track].arch_opin_switch ();
750760 rr_edges_to_create.emplace_back (from_rr_node, inc_inode_index, to_switch, false );
751761 ++num_edges;
@@ -1962,11 +1972,6 @@ void load_sblock_pattern_lookup(const int i,
19621972 }
19631973}
19641974
1965- /* Labels the muxes on that side (seg_num, chan_num, direction). The returned array
1966- * maps a label to the actual track #: array[0] = <the track number of the first/lowest mux>
1967- * This routine orders wire muxes by their natural order, i.e. track #
1968- * If seg_type_index == UNDEFINED, all segments in the channel are considered. Otherwise this routine
1969- * only looks at segments that belong to the specified segment type. */
19701975static void label_wire_muxes (const int chan_num,
19711976 const int seg_num,
19721977 const t_chan_seg_details* seg_details,
@@ -1985,7 +1990,7 @@ static void label_wire_muxes(const int chan_num,
19851990 /* Alloc the list on LOAD pass */
19861991 if (pass > 0 ) {
19871992 labels.resize (num_labels);
1988- std::fill (labels. begin (), labels. end () , 0 );
1993+ std::ranges:: fill (labels, 0 );
19891994 num_labels = 0 ;
19901995 }
19911996
0 commit comments