Skip to content

Commit cd680d7

Browse files
clean get_track_to_pins a bit
1 parent c3ea108 commit cd680d7

File tree

2 files changed

+14
-18
lines changed

2 files changed

+14
-18
lines changed

vpr/src/route/rr_graph_generation/rr_graph2.cpp

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,24 +1005,18 @@ int get_track_to_pins(RRGraphBuilder& rr_graph_builder,
10051005
int wire_to_ipin_switch,
10061006
int wire_to_pin_between_dice_switch,
10071007
e_directionality directionality) {
1008-
/*
1009-
* Adds the fan-out edges from wire segment at (chan, seg, track) to adjacent
1010-
* blocks along the wire's length
1011-
*/
1012-
1013-
int j, pass, iconn, phy_track, end, max_conn, ipin, x, y, num_conn;
1014-
1015-
auto& device_ctx = g_vpr_ctx.device();
1008+
const DeviceContext& device_ctx = g_vpr_ctx.device();
10161009

1017-
/* End of this wire */
1018-
end = get_seg_end(seg_details, track, seg, chan, chan_length);
1010+
// End of this wire
1011+
int end = get_seg_end(seg_details, track, seg, chan, chan_length);
10191012

1020-
num_conn = 0;
1013+
int num_conn = 0;
10211014

1022-
for (j = seg; j <= end; j++) {
1015+
for (int j = seg; j <= end; j++) {
10231016
if (is_cblock(chan, j, track, seg_details)) {
1024-
for (pass = 0; pass < 2; ++pass) { //pass == 0 => TOP/RIGHT, pass == 1 => BOTTOM/LEFT
1017+
for (int pass = 0; pass < 2; ++pass) { //pass == 0 => TOP/RIGHT, pass == 1 => BOTTOM/LEFT
10251018
e_side side;
1019+
int x, y;
10261020
if (e_rr_type::CHANX == chan_type) {
10271021
x = j;
10281022
y = chan + pass;
@@ -1044,17 +1038,17 @@ int get_track_to_pins(RRGraphBuilder& rr_graph_builder,
10441038
* - algorithm assigns ipin connections to same physical track index
10451039
* so that the logical track gets distributed uniformly */
10461040

1047-
phy_track = vpr_to_phy_track(track, chan, j, seg_details, directionality);
1041+
int phy_track = vpr_to_phy_track(track, chan, j, seg_details, directionality);
10481042
phy_track %= tracks_per_chan;
10491043

10501044
/* We need the type to find the ipin map for this type */
10511045

10521046
int width_offset = device_ctx.grid.get_width_offset({x, y, layer_index});
10531047
int height_offset = device_ctx.grid.get_height_offset({x, y, layer_index});
10541048

1055-
max_conn = track_to_pin_lookup[type->index][phy_track][width_offset][height_offset][layer][side].size();
1056-
for (iconn = 0; iconn < max_conn; iconn++) {
1057-
ipin = track_to_pin_lookup[type->index][phy_track][width_offset][height_offset][layer][side][iconn];
1049+
const int max_conn = track_to_pin_lookup[type->index][phy_track][width_offset][height_offset][layer][side].size();
1050+
for (int iconn = 0; iconn < max_conn; iconn++) {
1051+
const int ipin = track_to_pin_lookup[type->index][phy_track][width_offset][height_offset][layer][side][iconn];
10581052
if (!is_pin_conencted_to_layer(type, ipin, layer_index, layer, device_ctx.grid.get_num_layers())) {
10591053
continue;
10601054
}
@@ -1071,7 +1065,8 @@ int get_track_to_pins(RRGraphBuilder& rr_graph_builder,
10711065
}
10721066
}
10731067
}
1074-
return (num_conn);
1068+
1069+
return num_conn;
10751070
}
10761071

10771072
/*

vpr/src/route/rr_graph_generation/rr_graph2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ int get_unidir_opin_connections(RRGraphBuilder& rr_graph_builder,
9191
const t_chan_width& nodes_per_chan,
9292
bool* Fc_clipped);
9393

94+
/// Adds the fan-out edges from wire segment at (chan, seg, track) to adjacent blocks along the wire's length
9495
int get_track_to_pins(RRGraphBuilder& rr_graph_builder,
9596
int layer,
9697
int seg,

0 commit comments

Comments
 (0)