@@ -736,9 +736,7 @@ int get_bidir_opin_connections(RRGraphBuilder& rr_graph_builder,
736736 * 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
737737 * or seg_inf_y for x-adjacent and y-adjacent segments respectively. This index is assigned in get_seg_details earlier
738738 * 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
739- * routine used in this function.
740- *
741- *
739+ * routine used in this function.
742740 */
743741int get_unidir_opin_connections (RRGraphBuilder& rr_graph_builder,
744742 const int opin_layer,
@@ -758,26 +756,22 @@ int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
758756 /* Gets a linked list of Fc nodes of specified seg_type_index to connect
759757 * to in given chan seg. Fc_ofs is used for the opin staggering pattern. */
760758
761- int num_inc_muxes, num_dec_muxes, iconn;
762- int inc_mux, dec_mux;
763- int inc_track, dec_track;
764- int x, y;
765- int num_edges;
759+ int num_inc_muxes, num_dec_muxes;
766760
767761 *Fc_clipped = false ;
768762
769763 /* Fc is assigned in pairs so check it is even. */
770764 VTR_ASSERT (Fc % 2 == 0 );
771765
772766 /* get_rr_node_indices needs x and y coords. */
773- x = ((e_rr_type::CHANX == chan_type) ? seg : chan);
774- y = ((e_rr_type::CHANX == chan_type) ? chan : seg);
767+ int x = ((e_rr_type::CHANX == chan_type) ? seg : chan);
768+ int y = ((e_rr_type::CHANX == chan_type) ? chan : seg);
775769
776770 /* Get the lists of possible muxes. */
777771 int dummy;
778772 std::vector<int > inc_muxes;
779773 std::vector<int > dec_muxes;
780- /* AA: Determine the channel width instead of using max channels to not create hanging nodes*/
774+ // Determine the channel width instead of using max channels to not create hanging nodes
781775 int max_chan_width = (e_rr_type::CHANX == chan_type) ? nodes_per_chan.x_list [y] : nodes_per_chan.y_list [x];
782776
783777 label_wire_muxes (chan, seg, seg_details, seg_type_index, max_len,
@@ -792,16 +786,16 @@ int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
792786 }
793787
794788 /* Assign tracks to meet Fc demand */
795- num_edges = 0 ;
796- for (iconn = 0 ; iconn < (Fc / 2 ); ++iconn) {
789+ int num_edges = 0 ;
790+ for (int iconn = 0 ; iconn < (Fc / 2 ); ++iconn) {
797791 /* Figure of the next mux to use for the 'inc' and 'dec' connections */
798- inc_mux = Fc_ofs[chan][seg][seg_type_index] % num_inc_muxes;
799- dec_mux = Fc_ofs[chan][seg][seg_type_index] % num_dec_muxes;
792+ int inc_mux = Fc_ofs[chan][seg][seg_type_index] % num_inc_muxes;
793+ int dec_mux = Fc_ofs[chan][seg][seg_type_index] % num_dec_muxes;
800794 ++Fc_ofs[chan][seg][seg_type_index];
801795
802796 /* Figure out the track it corresponds to. */
803- inc_track = inc_muxes[inc_mux];
804- dec_track = dec_muxes[dec_mux];
797+ int inc_track = inc_muxes[inc_mux];
798+ int dec_track = dec_muxes[dec_mux];
805799
806800 /* Figure the inodes of those muxes */
807801 RRNodeId inc_inode_index = rr_graph_builder.node_lookup ().find_node (track_layer, x, y, chan_type, inc_track);
@@ -812,7 +806,7 @@ int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
812806 }
813807
814808 /* Add to the list. */
815- auto to_switch = (opin_layer == track_layer) ? seg_details[inc_track].arch_opin_switch () : seg_details[inc_track].arch_inter_die_switch ();
809+ short to_switch = (opin_layer == track_layer) ? seg_details[inc_track].arch_opin_switch () : seg_details[inc_track].arch_inter_die_switch ();
816810 rr_edges_to_create.emplace_back (from_rr_node, inc_inode_index, to_switch, false );
817811 ++num_edges;
818812
@@ -1058,7 +1052,15 @@ static bool is_sb_conn_layer_crossing(enum e_side src_side, enum e_side dest_sid
10581052 return true ;
10591053}
10601054
1061- static bool check_3d_SB_RRnodes (RRGraphBuilder& rr_graph_builder, int x, int y, int from_wire, int from_wire_layer, e_rr_type from_wire_type, int to_wire, int to_wire_layer, e_rr_type to_wire_type) {
1055+ static bool check_3d_SB_RRnodes (RRGraphBuilder& rr_graph_builder,
1056+ int x,
1057+ int y,
1058+ int from_wire,
1059+ int from_wire_layer,
1060+ e_rr_type from_wire_type,
1061+ int to_wire,
1062+ int to_wire_layer,
1063+ e_rr_type to_wire_type) {
10621064 RRNodeId from_inode = rr_graph_builder.node_lookup ().find_node (from_wire_layer, x, y, from_wire_type, from_wire);
10631065 RRNodeId to_inode = rr_graph_builder.node_lookup ().find_node (to_wire_layer, x, y, to_wire_type, to_wire);
10641066
@@ -1073,40 +1075,41 @@ vtr::NdMatrix<int, 2> get_number_track_to_track_inter_die_conn(t_sb_connection_m
10731075 const int custom_3d_sb_fanin_fanout,
10741076 RRGraphBuilder& rr_graph_builder) {
10751077 const auto & grid_ctx = g_vpr_ctx.device ().grid ;
1076- vtr::NdMatrix<int , 2 > extra_nodes_per_switchblocks;
1077- extra_nodes_per_switchblocks.resize (std::array<size_t , 2 >{grid_ctx.width (), grid_ctx.height ()}, 0 );
1078+ vtr::NdMatrix<int , 2 > extra_nodes_per_switchblocks{{grid_ctx.width (), grid_ctx.height ()}, 0 };
10781079
10791080 for (size_t y = 0 ; y < grid_ctx.height (); y++) {
10801081 for (size_t x = 0 ; x < grid_ctx.width (); x++) {
1081- for (auto layer = 0 ; layer < grid_ctx.get_num_layers (); layer++) {
1082+ for (int layer = 0 ; layer < grid_ctx.get_num_layers (); layer++) {
1083+
10821084 int num_of_3d_conn = 0 ;
1083- for (auto from_side : TOTAL_3D_SIDES) {
1084- for (auto to_side : TOTAL_3D_SIDES) {
1085- if (!is_sb_conn_layer_crossing (from_side, to_side)) { // this connection is not crossing any layer
1085+ for (e_side from_side : TOTAL_3D_SIDES) {
1086+ for (e_side to_side : TOTAL_3D_SIDES) {
1087+ if (!is_sb_conn_layer_crossing (from_side, to_side)) { // this connection is not crossing any layer
10861088 continue ;
1087- } else {
1088- SwitchblockLookupKey sb_coord (x, y, layer, from_side, to_side);
1089- if (sb_conn_map-> count (sb_coord) > 0 ) {
1090- std::vector<t_switchblock_edge>& conn_vector = (*sb_conn_map)[sb_coord];
1091- for ( int iconn = 0 ; iconn < ( int )conn_vector. size (); ++iconn) {
1092- // check if both from_node and to_node exists in the rr-graph
1093- // CHANY -> CHANX connection
1094- if ( check_3d_SB_RRnodes (rr_graph_builder, x, y, conn_vector[iconn]. from_wire ,
1095- conn_vector[ iconn]. from_wire_layer , e_rr_type::CHANY ,
1096- conn_vector[ iconn]. to_wire , conn_vector[iconn]. to_wire_layer ,
1097- e_rr_type::CHANX)) {
1098- num_of_3d_conn++;
1099- }
1100- // CHANX -> CHANY connection
1101- if ( check_3d_SB_RRnodes (rr_graph_builder, x, y, conn_vector[iconn]. from_wire ,
1102- conn_vector[ iconn]. from_wire_layer , e_rr_type::CHANX ,
1103- conn_vector[ iconn]. to_wire , conn_vector[iconn]. to_wire_layer ,
1104- e_rr_type::CHANY)) {
1105- num_of_3d_conn++;
1106- }
1089+ }
1090+
1091+ SwitchblockLookupKey sb_coord (x, y, layer, from_side, to_side);
1092+ if (sb_conn_map-> count (sb_coord) > 0 ) {
1093+ std::vector<t_switchblock_edge>& conn_vector = (*sb_conn_map)[sb_coord];
1094+ for ( const t_switchblock_edge& iconn : conn_vector) {
1095+ // check if both from_node and to_node exists in the rr-graph
1096+ // CHANY -> CHANX connection
1097+ if ( check_3d_SB_RRnodes (rr_graph_builder, x, y, iconn. from_wire ,
1098+ iconn. from_wire_layer , e_rr_type::CHANY ,
1099+ iconn. to_wire , iconn. to_wire_layer ,
1100+ e_rr_type::CHANX)) {
1101+ num_of_3d_conn++;
1102+ }
1103+ // CHANX -> CHANY connection
1104+ if ( check_3d_SB_RRnodes (rr_graph_builder, x, y, iconn. from_wire ,
1105+ iconn. from_wire_layer , e_rr_type::CHANX ,
1106+ iconn. to_wire , iconn. to_wire_layer ,
1107+ e_rr_type::CHANY)) {
1108+ num_of_3d_conn++;
11071109 }
11081110 }
11091111 }
1112+
11101113 }
11111114 }
11121115 extra_nodes_per_switchblocks[x][y] += ((num_of_3d_conn + custom_3d_sb_fanin_fanout - 1 ) / custom_3d_sb_fanin_fanout);
@@ -1246,11 +1249,10 @@ int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
12461249 int to_chan, to_sb;
12471250 std::vector<int > conn_tracks;
12481251 bool from_is_sblock, is_behind, Fs_clipped;
1249- enum e_side from_side_a, from_side_b, to_side;
1250- bool custom_switch_block;
1252+ enum e_side to_side;
12511253
12521254 /* check whether a custom switch block will be used */
1253- custom_switch_block = false ;
1255+ bool custom_switch_block = false ;
12541256 if (sb_conn_map) {
12551257 custom_switch_block = true ;
12561258 VTR_ASSERT (switch_block_conn.empty ());
@@ -1268,7 +1270,8 @@ int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
12681270 // end of the current wire segment is located
12691271 int end_sb_seg = get_seg_end (from_seg_details, from_track, from_seg, from_chan, chan_len);
12701272
1271- /* Figure out the sides of SB the from_wire will use */
1273+ // Figure out the sides of SB the from_wire will use
1274+ e_side from_side_a, from_side_b;
12721275 if (e_rr_type::CHANX == from_type) {
12731276 from_side_a = RIGHT;
12741277 from_side_b = LEFT;
@@ -1278,13 +1281,12 @@ int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
12781281 from_side_b = BOTTOM;
12791282 }
12801283
1281- // Set the loop bounds so we iterate over the whole wire segment
1284+ // Set the loop bounds, so we iterate over the whole wire segment
12821285 int start = start_sb_seg;
12831286 int end = end_sb_seg;
12841287
1285- // If source and destination segments both lie along the same channel
1286- // we clip the loop bounds to the switch blocks of interest and proceed
1287- // normally
1288+ // If source and destination segments both lie along the same channel
1289+ // we clip the loop bounds to the switch blocks of interest and proceed normally
12881290 if (to_type == from_type) {
12891291 start = to_seg - 1 ;
12901292 end = to_seg;
@@ -1306,7 +1308,7 @@ int get_track_to_tracks(RRGraphBuilder& rr_graph_builder,
13061308 from_is_sblock = true ;
13071309 }
13081310
1309- auto switch_override = should_create_switchblock (grid, layer, from_chan, sb_seg, from_type, to_type);
1311+ int switch_override = should_create_switchblock (grid, layer, from_chan, sb_seg, from_type, to_type);
13101312 if (switch_override == NO_SWITCH) {
13111313 continue ; // Do not create an SB here
13121314 }
@@ -2221,7 +2223,6 @@ void load_sblock_pattern_lookup(const int i,
22212223 * This routine orders wire muxes by their natural order, i.e. track #
22222224 * If seg_type_index == UNDEFINED, all segments in the channel are considered. Otherwise this routine
22232225 * only looks at segments that belong to the specified segment type. */
2224-
22252226static void label_wire_muxes (const int chan_num,
22262227 const int seg_num,
22272228 const t_chan_seg_details* seg_details,
@@ -2233,13 +2234,10 @@ static void label_wire_muxes(const int chan_num,
22332234 std::vector<int >& labels,
22342235 int * num_wire_muxes,
22352236 int * num_wire_muxes_cb_restricted) {
2236- int itrack, start, end, num_labels, num_labels_restricted, pass;
2237- bool is_endpoint;
2238-
22392237 /* COUNT pass then a LOAD pass */
2240- num_labels = 0 ;
2241- num_labels_restricted = 0 ;
2242- for (pass = 0 ; pass < 2 ; ++pass) {
2238+ int num_labels = 0 ;
2239+ int num_labels_restricted = 0 ;
2240+ for (int pass = 0 ; pass < 2 ; ++pass) {
22432241 /* Alloc the list on LOAD pass */
22442242 if (pass > 0 ) {
22452243 labels.resize (num_labels);
@@ -2248,9 +2246,9 @@ static void label_wire_muxes(const int chan_num,
22482246 }
22492247
22502248 /* Find the tracks that are starting. */
2251- for (itrack = 0 ; itrack < max_chan_width; ++itrack) {
2252- start = get_seg_start (seg_details, itrack, chan_num, seg_num);
2253- end = get_seg_end (seg_details, itrack, start, chan_num, max_len);
2249+ for (int itrack = 0 ; itrack < max_chan_width; ++itrack) {
2250+ int start = get_seg_start (seg_details, itrack, chan_num, seg_num);
2251+ int end = get_seg_end (seg_details, itrack, start, chan_num, max_len);
22542252
22552253 /* Skip tracks that are undefined */
22562254 if (seg_details[itrack].length () == 0 ) {
@@ -2270,7 +2268,7 @@ static void label_wire_muxes(const int chan_num,
22702268 }
22712269
22722270 /* Determine if we are a wire startpoint */
2273- is_endpoint = (seg_num == start);
2271+ bool is_endpoint = (seg_num == start);
22742272 if (Direction::DEC == seg_details[itrack].direction ()) {
22752273 is_endpoint = (seg_num == end);
22762274 }
0 commit comments