Skip to content

Commit ccdb004

Browse files
committed
pass actual Fc through connection blocks functions to use pin-specific fc instead of maximum fc
1 parent 97b1be6 commit ccdb004

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

vpr/src/route/rr_graph.cpp

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,10 @@ static vtr::NdMatrix<std::vector<int>, 5> alloc_and_load_pin_to_track_map(const
105105
const int* sets_per_seg_type);
106106

107107
static vtr::NdMatrix<int, 6> alloc_and_load_pin_to_seg_type(const e_pin_type pin_type,
108+
const vtr::Matrix<int>& Fc,
108109
const int seg_type_tracks,
109-
const int Fc,
110+
const int seg_index,
111+
const int max_Fc,
110112
const t_physical_tile_type_ptr Type,
111113
const std::set<int> type_layer,
112114
const bool perturb_switch_pattern,
@@ -283,9 +285,10 @@ static void alloc_and_load_tile_rr_graph(RRGraphBuilder& rr_graph_builder,
283285
static float pattern_fmod(float a, float b);
284286
static void load_uniform_connection_block_pattern(vtr::NdMatrix<int, 6>& tracks_connected_to_pin,
285287
const std::vector<t_pin_loc>& pin_locations,
288+
const vtr::Matrix<int>& Fc,
289+
const int seg_index,
286290
const int x_chan_width,
287291
const int y_chan_width,
288-
const int Fc,
289292
const enum e_directionality directionality);
290293

291294
static void load_perturbed_connection_block_pattern(vtr::NdMatrix<int, 6>& tracks_connected_to_pin,
@@ -1144,7 +1147,7 @@ static void build_rr_graph(const t_graph_type graph_type,
11441147
segment_inf[k].name.c_str(),
11451148
Fc_out[i][j][k],
11461149
Fc_in[i][j][k]);
1147-
#endif /* VERBOSE */
1150+
#endif
11481151
VTR_ASSERT_MSG(Fc_out[i][j][k] == 0 || Fc_in[i][j][k] == 0,
11491152
"Pins must be inputs or outputs (i.e. can not have both non-zero Fc_out and Fc_in)");
11501153
}
@@ -3259,7 +3262,7 @@ static vtr::NdMatrix<std::vector<int>, 5> alloc_and_load_pin_to_track_map(const
32593262
}
32603263

32613264
/* get pin connections to tracks of the current segment type */
3262-
auto pin_to_seg_type_map = alloc_and_load_pin_to_seg_type(pin_type, num_seg_type_tracks, max_Fc, Type, type_layer, perturb_switch_pattern[seg_inf[iseg].seg_index], directionality);
3265+
auto pin_to_seg_type_map = alloc_and_load_pin_to_seg_type(pin_type, Fc, num_seg_type_tracks, seg_inf[iseg].seg_index, max_Fc, Type, type_layer, perturb_switch_pattern[seg_inf[iseg].seg_index], directionality);
32633266

32643267
/* connections in pin_to_seg_type_map are within that seg type -- i.e. in the [0,num_seg_type_tracks-1] range.
32653268
* now load up 'result' array with these connections, but offset them so they are relative to the channel
@@ -3296,8 +3299,10 @@ static vtr::NdMatrix<std::vector<int>, 5> alloc_and_load_pin_to_track_map(const
32963299
}
32973300

32983301
static vtr::NdMatrix<int, 6> alloc_and_load_pin_to_seg_type(const e_pin_type pin_type,
3302+
const vtr::Matrix<int>& Fc,
32993303
const int num_seg_type_tracks,
3300-
const int Fc,
3304+
const int seg_index,
3305+
const int max_Fc,
33013306
const t_physical_tile_type_ptr Type,
33023307
const std::set<int> type_layer,
33033308
const bool perturb_switch_pattern,
@@ -3331,7 +3336,7 @@ static vtr::NdMatrix<int, 6> alloc_and_load_pin_to_seg_type(const e_pin_type pin
33313336
size_t(Type->height), //[0..height-1]
33323337
size_t(grid.get_num_layers()), //[0..layer-1]
33333338
NUM_SIDES, //[0..NUM_SIDES-1]
3334-
size_t(Fc) //[0..Fc-1]
3339+
size_t(max_Fc) //[0..Fc-1]
33353340
},
33363341
OPEN); //Unconnected
33373342

@@ -3471,11 +3476,11 @@ static vtr::NdMatrix<int, 6> alloc_and_load_pin_to_seg_type(const e_pin_type pin
34713476
if (perturb_switch_pattern) {
34723477
load_perturbed_connection_block_pattern(tracks_connected_to_pin,
34733478
pin_ordering,
3474-
num_seg_type_tracks, num_seg_type_tracks, Fc, directionality);
3479+
num_seg_type_tracks, num_seg_type_tracks, max_Fc, directionality);
34753480
} else {
34763481
load_uniform_connection_block_pattern(tracks_connected_to_pin,
3477-
pin_ordering,
3478-
num_seg_type_tracks, num_seg_type_tracks, Fc, directionality);
3482+
pin_ordering, Fc, seg_index,
3483+
num_seg_type_tracks, num_seg_type_tracks, directionality);
34793484
}
34803485

34813486
#ifdef ENABLE_CHECK_ALL_TRACKS
@@ -3620,9 +3625,10 @@ static float pattern_fmod(float a, float b) {
36203625

36213626
static void load_uniform_connection_block_pattern(vtr::NdMatrix<int, 6>& tracks_connected_to_pin,
36223627
const std::vector<t_pin_loc>& pin_locations,
3628+
const vtr::Matrix<int>& Fc,
3629+
const int seg_index,
36233630
const int x_chan_width,
36243631
const int y_chan_width,
3625-
const int Fc,
36263632
enum e_directionality directionality) {
36273633
/* Loads the tracks_connected_to_pin array with an even distribution of *
36283634
* switches across the tracks for each pin. For example, each pin connects *
@@ -3700,7 +3706,7 @@ static void load_uniform_connection_block_pattern(vtr::NdMatrix<int, 6>& tracks_
37003706
group_size = 2;
37013707
}
37023708

3703-
VTR_ASSERT((x_chan_width % group_size == 0) && (y_chan_width % group_size == 0) && (Fc % group_size == 0));
3709+
VTR_ASSERT((x_chan_width % group_size == 0) && (y_chan_width % group_size == 0));
37043710

37053711
/* offset is used to move to a different point in the track space if it is detected that
37063712
* the tracks being assigned overlap recently assigned tracks, with the goal of increasing
@@ -3714,19 +3720,23 @@ static void load_uniform_connection_block_pattern(vtr::NdMatrix<int, 6>& tracks_
37143720
int width = pin_locations[i].width_offset;
37153721
int height = pin_locations[i].height_offset;
37163722
int layer = pin_locations[i].layer_offset;
3723+
int pin_fc = Fc[pin][seg_index];
3724+
3725+
VTR_ASSERT(pin_fc % group_size == 0);
3726+
VTR_LOG("pin %d, side %d, width %d, height %d, layer %d, pin_fc %d\n", pin, side, width, height, layer, pin_fc);
37173727

37183728
/* Bi-directional treats each track separately, uni-directional works with pairs of tracks */
3719-
for (int j = 0; j < (Fc / group_size); ++j) {
3729+
for (int j = 0; j < (pin_fc / group_size); ++j) {
37203730
int max_chan_width = (((side == TOP) || (side == BOTTOM)) ? x_chan_width : y_chan_width);
37213731

37223732
// if the number of tracks we can assign is zero break from the loop
37233733
if (max_chan_width == 0) {
37243734
break;
37253735
}
3726-
float step_size = (float)max_chan_width / (float)(Fc * num_phys_pins);
3736+
float step_size = (float)max_chan_width / (float)(pin_fc * num_phys_pins);
37273737

3728-
VTR_ASSERT(Fc > 0);
3729-
float fc_step = (float)max_chan_width / (float)Fc;
3738+
VTR_ASSERT(pin_fc > 0);
3739+
float fc_step = (float)max_chan_width / (float)pin_fc;
37303740

37313741
/* We may go outside the track ID space, because of offset, so use modulo arithmetic below. */
37323742

@@ -3753,7 +3763,7 @@ static void load_uniform_connection_block_pattern(vtr::NdMatrix<int, 6>& tracks_
37533763
int num_unassigned_tracks = 0;
37543764
int num_total_tracks = 0;
37553765

3756-
for (int j2 = 0; j2 < (Fc / group_size); ++j2) {
3766+
for (int j2 = 0; j2 < (pin_fc / group_size); ++j2) {
37573767
ftrack = pattern_fmod((i + offset + offset_increment) * step_size, fc_step) + (j2 * fc_step);
37583768
itrack = ((int)ftrack) * group_size;
37593769

0 commit comments

Comments
 (0)