@@ -1103,19 +1103,19 @@ static void load_chan_rr_indices(const int max_chan_width,
1103
1103
const auto & device_ctx = g_vpr_ctx.device ();
1104
1104
1105
1105
for (int layer = 0 ; layer < grid.get_num_layers (); layer++) {
1106
- /* Skip the current die if architecture file specifies that it doesn't require global resource routing */
1106
+ // Skip the current die if architecture file specifies that it doesn't require global resource routing
1107
1107
if (!device_ctx.inter_cluster_prog_routing_resources .at (layer)) {
1108
1108
continue ;
1109
1109
}
1110
1110
1111
1111
for (int chan = 0 ; chan < num_chans - 1 ; ++chan) {
1112
1112
for (int seg = 1 ; seg < chan_len - 1 ; ++seg) {
1113
- /* Assign an inode to the starts of tracks */
1114
- int x = type == e_rr_type::CHANX ? seg : chan;
1115
- int y = type == e_rr_type::CHANX ? chan : seg;
1113
+ // Assign an inode to the starts of tracks
1114
+ const int x = ( type == e_rr_type::CHANX) ? seg : chan;
1115
+ const int y = ( type == e_rr_type::CHANX) ? chan : seg;
1116
1116
const t_chan_seg_details* seg_details = chan_details[x][y].data ();
1117
1117
1118
- /* Reserve nodes in lookup to save memory */
1118
+ // Reserve nodes in lookup to save memory
1119
1119
rr_graph_builder.node_lookup ().reserve_nodes (layer, chan, seg, type, max_chan_width);
1120
1120
1121
1121
for (int track = 0 ; track < max_chan_width; ++track) {
@@ -1124,24 +1124,19 @@ static void load_chan_rr_indices(const int max_chan_width,
1124
1124
continue ;
1125
1125
1126
1126
int start = get_seg_start (seg_details, track, chan, seg);
1127
+ int node_start_x = (type == e_rr_type::CHANX) ? start : chan;
1128
+ int node_start_y = (type == e_rr_type::CHANX) ? chan : start;
1127
1129
1128
- /* TODO: Now we still use the (y, x) convention here for CHANX. Should rework later */
1129
- int node_x = chan;
1130
- int node_y = start;
1131
- if (e_rr_type::CHANX == type) {
1132
- std::swap (node_x, node_y);
1133
- }
1134
-
1135
- // If the start of the wire doesn't have an inode, assign one to it.
1136
- RRNodeId inode = rr_graph_builder.node_lookup ().find_node (layer, node_x, node_y, type, track);
1130
+ // If the start of the wire doesn't have an RRNodeId, assign one to it.
1131
+ RRNodeId inode = rr_graph_builder.node_lookup ().find_node (layer, node_start_x, node_start_y, type, track);
1137
1132
if (!inode) {
1138
1133
inode = RRNodeId (*index );
1139
1134
++(*index );
1140
1135
rr_graph_builder.node_lookup ().add_node (inode, layer, chan, start, type, track);
1141
1136
}
1142
1137
1143
- /* Assign inode of start of wire to current position */
1144
- rr_graph_builder.node_lookup ().add_node (inode, layer, chan, seg , type, track);
1138
+ // Assign RRNodeId of start of wire to current position
1139
+ rr_graph_builder.node_lookup ().add_node (inode, layer, x, y , type, track);
1145
1140
}
1146
1141
}
1147
1142
}
@@ -1219,7 +1214,7 @@ vtr::NdMatrix<int, 2> get_number_track_to_track_inter_die_conn(t_sb_connection_m
1219
1214
}
1220
1215
1221
1216
void alloc_and_load_inter_die_rr_node_indices (RRGraphBuilder& rr_graph_builder,
1222
- const t_chan_width* nodes_per_chan,
1217
+ const t_chan_width& nodes_per_chan,
1223
1218
const DeviceGrid& grid,
1224
1219
const vtr::NdMatrix<int , 2 >& extra_nodes_per_switchblock,
1225
1220
int * index) {
@@ -1232,31 +1227,32 @@ void alloc_and_load_inter_die_rr_node_indices(RRGraphBuilder& rr_graph_builder,
1232
1227
* 3) ptc = [max_chanx_width:max_chanx_width+number_of_connection-1]
1233
1228
* 4) direction = NONE
1234
1229
*/
1235
- auto & device_ctx = g_vpr_ctx.device ();
1230
+ const auto & device_ctx = g_vpr_ctx.device ();
1236
1231
1237
1232
for (int layer = 0 ; layer < grid.get_num_layers (); layer++) {
1238
1233
/* Skip the current die if architecture file specifies that it doesn't have global resource routing */
1239
1234
if (!device_ctx.inter_cluster_prog_routing_resources .at (layer)) {
1240
1235
continue ;
1241
1236
}
1237
+
1242
1238
for (size_t y = 0 ; y < grid.height () - 1 ; ++y) {
1243
1239
for (size_t x = 1 ; x < grid.width () - 1 ; ++x) {
1244
- // count how many track-to-track connection go from current layer to other layers
1240
+ // count how many track-to-track connection go from current layer to other layers
1245
1241
int conn_count = extra_nodes_per_switchblock[x][y];
1246
1242
1247
- // skip if no connection is required
1243
+ // skip if no connection is required
1248
1244
if (conn_count == 0 ) {
1249
1245
continue ;
1250
1246
}
1251
1247
1252
- // reserve extra nodes for inter-die track-to-track connection
1253
- rr_graph_builder.node_lookup ().reserve_nodes (layer, y, x , e_rr_type::CHANX, conn_count + nodes_per_chan-> max );
1248
+ // reserve extra nodes for inter-die track-to-track connection
1249
+ rr_graph_builder.node_lookup ().reserve_nodes (layer, x, y , e_rr_type::CHANX, conn_count + nodes_per_chan. max );
1254
1250
for (int rr_node_offset = 0 ; rr_node_offset < conn_count; rr_node_offset++) {
1255
- RRNodeId inode = rr_graph_builder.node_lookup ().find_node (layer, x, y, e_rr_type::CHANX, nodes_per_chan-> max + rr_node_offset);
1251
+ RRNodeId inode = rr_graph_builder.node_lookup ().find_node (layer, x, y, e_rr_type::CHANX, nodes_per_chan. max + rr_node_offset);
1256
1252
if (!inode) {
1257
1253
inode = RRNodeId (*index );
1258
1254
++(*index );
1259
- rr_graph_builder.node_lookup ().add_node (inode, layer, y, x , e_rr_type::CHANX, nodes_per_chan-> max + rr_node_offset);
1255
+ rr_graph_builder.node_lookup ().add_node (inode, layer, x, y , e_rr_type::CHANX, nodes_per_chan. max + rr_node_offset);
1260
1256
}
1261
1257
}
1262
1258
}
0 commit comments