6
6
#include " alloc_and_load_rr_indexed_data.h"
7
7
#include " get_parallel_segs.h"
8
8
#include " physical_types_util.h"
9
+ #include " rr_graph_view.h"
9
10
#include " rr_rc_data.h"
11
+ #include " switchblock_types.h"
12
+ #include " vpr_context.h"
10
13
#include " vtr_assert.h"
11
14
12
15
#include " vtr_util.h"
@@ -63,9 +66,6 @@ std::set<int> get_layers_pin_is_connected_to(const t_physical_tile_type_ptr type
63
66
// /@brief given a specific layer number and type, it returns layers which have same pin_index connected to the given layer
64
67
std::set<int > get_layers_connected_to_pin (const t_physical_tile_type_ptr type, int to_layer, int pin_index);
65
68
66
- // /@brief checks whether the channel width has been changed or not
67
- bool channel_widths_unchanged (const t_chan_width& current, const t_chan_width& proposed);
68
-
69
69
/* *
70
70
* @brief This routine calculates pin connections to tracks for either all input or all output pins based on the Fc value defined in the architecture file.
71
71
* For the requested pin type (input or output), it will loop through all segments and calculate how many connections should be made,
@@ -668,14 +668,14 @@ void create_rr_graph(e_graph_type graph_type,
668
668
const std::vector<t_direct_inf>& directs,
669
669
int * Warnings,
670
670
bool is_flat) {
671
- const auto & device_ctx = g_vpr_ctx.device ();
672
- auto & mutable_device_ctx = g_vpr_ctx.mutable_device ();
671
+ const DeviceContext & device_ctx = g_vpr_ctx.device ();
672
+ DeviceContext & mutable_device_ctx = g_vpr_ctx.mutable_device ();
673
673
bool echo_enabled = getEchoEnabled () && isEchoFileEnabled (E_ECHO_RR_GRAPH_INDEXED_DATA);
674
674
const char * echo_file_name = getEchoFileName (E_ECHO_RR_GRAPH_INDEXED_DATA);
675
675
bool load_rr_graph = !det_routing_arch.read_rr_graph_filename .empty ();
676
676
677
- if (channel_widths_unchanged ( device_ctx.chan_width , nodes_per_chan) && !device_ctx.rr_graph .empty ()) {
678
- // No change in channel width, so skip re-building RR graph
677
+ if (device_ctx.chan_width == nodes_per_chan && !device_ctx.rr_graph .empty ()) {
678
+ // No change in channel width, so skip re-building RR graph
679
679
if (is_flat && !device_ctx.rr_graph_is_flat ) {
680
680
VTR_LOG (" RR graph channel widths unchanged, intra-cluster resources should be added...\n " );
681
681
} else {
@@ -965,20 +965,6 @@ std::set<int> get_layers_connected_to_pin(const t_physical_tile_type_ptr type, i
965
965
return layers_connected_to_pin;
966
966
}
967
967
968
- bool channel_widths_unchanged (const t_chan_width& current, const t_chan_width& proposed) {
969
- if (current.max != proposed.max
970
- || current.x_max != proposed.x_max
971
- || current.y_max != proposed.y_max
972
- || current.x_min != proposed.x_min
973
- || current.y_min != proposed.y_min
974
- || current.x_list != proposed.x_list
975
- || current.y_list != proposed.y_list ) {
976
- return false ; // Different max/min or channel widths
977
- }
978
-
979
- return true ; // Identical
980
- }
981
-
982
968
static void build_rr_graph (e_graph_type graph_type,
983
969
const std::vector<t_physical_tile_type>& types,
984
970
const DeviceGrid& grid,
@@ -1022,8 +1008,8 @@ static void build_rr_graph(e_graph_type graph_type,
1022
1008
1023
1009
VTR_ASSERT (max_chan_width_x > 0 && max_chan_width_y > 0 );
1024
1010
1025
- auto & device_ctx = g_vpr_ctx.mutable_device ();
1026
- const auto & rr_graph = device_ctx.rr_graph ;
1011
+ DeviceContext & device_ctx = g_vpr_ctx.mutable_device ();
1012
+ const RRGraphView & rr_graph = device_ctx.rr_graph ;
1027
1013
1028
1014
std::vector<t_clb_to_clb_directs> clb_to_clb_directs = alloc_and_load_clb_to_clb_directs (directs, delayless_switch);
1029
1015
@@ -1232,43 +1218,38 @@ static void build_rr_graph(e_graph_type graph_type,
1232
1218
1233
1219
if (is_global_graph) {
1234
1220
switch_block_conn = alloc_and_load_switch_block_conn (&nodes_per_chan, SUBSET, 3 );
1235
- } else if (BI_DIRECTIONAL == directionality) {
1236
- if (sb_type == CUSTOM) {
1237
- sb_conn_map = alloc_and_load_switchblock_permutations (chan_details_x, chan_details_y,
1238
- grid, inter_cluster_prog_rr,
1239
- switchblocks, nodes_per_chan, directionality,
1240
- switchpoint_rng);
1241
- } else {
1242
- switch_block_conn = alloc_and_load_switch_block_conn (&nodes_per_chan, sb_type, Fs);
1243
- }
1244
1221
} else {
1245
- VTR_ASSERT (UNI_DIRECTIONAL == directionality);
1246
-
1247
1222
if (sb_type == CUSTOM) {
1248
1223
sb_conn_map = alloc_and_load_switchblock_permutations (chan_details_x, chan_details_y,
1249
- grid,
1250
- inter_cluster_prog_rr,
1251
- switchblocks, nodes_per_chan, directionality,
1252
- switchpoint_rng);
1224
+ grid, inter_cluster_prog_rr,
1225
+ switchblocks, nodes_per_chan, directionality,
1226
+ switchpoint_rng);
1253
1227
} else {
1254
- // it looks like we get unbalanced muxing from this switch block code with Fs > 3
1255
- VTR_ASSERT (Fs == 3 );
1256
-
1257
- unidir_sb_pattern = alloc_sblock_pattern_lookup (grid, nodes_per_chan);
1258
- for (size_t i = 0 ; i < grid.width () - 1 ; i++) {
1259
- for (size_t j = 0 ; j < grid.height () - 1 ; j++) {
1260
- load_sblock_pattern_lookup (i, j, grid, nodes_per_chan,
1261
- chan_details_x, chan_details_y,
1262
- Fs, sb_type, unidir_sb_pattern);
1228
+ if (directionality == BI_DIRECTIONAL) {
1229
+ switch_block_conn = alloc_and_load_switch_block_conn (&nodes_per_chan, sb_type, Fs);
1230
+ } else {
1231
+ // it looks like we get unbalanced muxing from this switch block code with Fs > 3
1232
+ VTR_ASSERT (Fs == 3 );
1233
+ // Since directionality is a C enum it could technically be any value. This assertion makes sure it's either BI_DIRECTIONAL or UNI_DIRECTIONAL
1234
+ VTR_ASSERT (directionality == UNI_DIRECTIONAL);
1235
+
1236
+ unidir_sb_pattern = alloc_sblock_pattern_lookup (grid, nodes_per_chan);
1237
+ for (size_t i = 0 ; i < grid.width () - 1 ; i++) {
1238
+ for (size_t j = 0 ; j < grid.height () - 1 ; j++) {
1239
+ load_sblock_pattern_lookup (i, j, grid, nodes_per_chan,
1240
+ chan_details_x, chan_details_y,
1241
+ Fs, sb_type, unidir_sb_pattern);
1242
+ }
1263
1243
}
1264
- }
1265
1244
1266
- if (getEchoEnabled () && isEchoFileEnabled (E_ECHO_SBLOCK_PATTERN)) {
1267
- dump_sblock_pattern (unidir_sb_pattern, max_chan_width, grid,
1268
- getEchoFileName (E_ECHO_SBLOCK_PATTERN));
1245
+ if (getEchoEnabled () && isEchoFileEnabled (E_ECHO_SBLOCK_PATTERN)) {
1246
+ dump_sblock_pattern (unidir_sb_pattern, max_chan_width, grid,
1247
+ getEchoFileName (E_ECHO_SBLOCK_PATTERN));
1248
+ }
1269
1249
}
1270
1250
}
1271
1251
}
1252
+
1272
1253
// END SB LOOKUP
1273
1254
1274
1255
// Check whether RR graph need to allocate new nodes for 3D custom switch blocks.
@@ -1291,7 +1272,7 @@ static void build_rr_graph(e_graph_type graph_type,
1291
1272
t_track_to_pin_lookup track_to_pin_lookup_x (types.size ());
1292
1273
t_track_to_pin_lookup track_to_pin_lookup_y (types.size ());
1293
1274
1294
- for (unsigned int itype = 0 ; itype < types.size (); ++itype) {
1275
+ for (size_t itype = 0 ; itype < types.size (); ++itype) {
1295
1276
std::set<int > type_layer = get_layers_of_physical_types (&types[itype]);
1296
1277
1297
1278
ipin_to_track_map_x[itype] = alloc_and_load_pin_to_track_map (RECEIVER,
@@ -1333,9 +1314,9 @@ static void build_rr_graph(e_graph_type graph_type,
1333
1314
// Create opin map lookups
1334
1315
t_pin_to_track_lookup opin_to_track_map (types.size ()); // [0..device_ctx.physical_tile_types.size()-1][0..num_pins-1][0..width][0..height][0..3][0..Fc-1]
1335
1316
if (BI_DIRECTIONAL == directionality) {
1336
- for (unsigned int itype = 0 ; itype < types.size (); ++itype) {
1337
- auto type_layer = get_layers_of_physical_types (&types[itype]);
1338
- auto perturb_opins = alloc_and_load_perturb_opins (&types[itype], Fc_out[itype],
1317
+ for (size_t itype = 0 ; itype < types.size (); ++itype) {
1318
+ std::set< int > type_layer = get_layers_of_physical_types (&types[itype]);
1319
+ std::vector< bool > perturb_opins = alloc_and_load_perturb_opins (&types[itype], Fc_out[itype],
1339
1320
max_chan_width, segment_inf);
1340
1321
opin_to_track_map[itype] = alloc_and_load_pin_to_track_map (DRIVER,
1341
1322
Fc_out[itype], &types[itype], type_layer, perturb_opins, directionality,
@@ -2658,7 +2639,7 @@ void free_rr_graph() {
2658
2639
// a routing graph exists and can be freed. Hence, you can call this routine even if you're not sure of whether a rr_graph exists or not.
2659
2640
2660
2641
// Before adding any more free calls here, be sure the data is NOT chunk allocated, as ALL the chunk allocated data is already free!
2661
- auto & device_ctx = g_vpr_ctx.mutable_device ();
2642
+ DeviceContext & device_ctx = g_vpr_ctx.mutable_device ();
2662
2643
2663
2644
device_ctx.loaded_rr_graph_filename .clear ();
2664
2645
device_ctx.loaded_rr_edge_override_filename .clear ();
0 commit comments