Skip to content

Commit 674623e

Browse files
committed
document some functions in rr_graph.cpp
1 parent b017a26 commit 674623e

File tree

1 file changed

+63
-10
lines changed

1 file changed

+63
-10
lines changed

vpr/src/route/rr_graph.cpp

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,25 @@ std::set<int> get_layers_pin_is_connected_to(const t_physical_tile_type_ptr type
9494
///@brief given a specific layer number and type, it returns layers which have same pin_index connected to the given layer
9595
std::set<int> get_layers_connected_to_pin(const t_physical_tile_type_ptr type, int to_layer, int pin_index);
9696

97+
///@brief checks whether the channel width has been changed or not
9798
bool channel_widths_unchanged(const t_chan_width& current, const t_chan_width& proposed);
9899

100+
/**
101+
* @brief This routine calculate pin connections to tracks for a specific type on the Fc value defined for each pin in the architecture file.
102+
* For each type, it will loop through all segments and calculate how many connections should be made, returns the connections for all pins of that type.
103+
*
104+
* @param pin_type Specifies whether the routine should connect tracks to *INPUT* pins or connect *OUTPUT* pins to tracks.
105+
* @param Fc Actual Fc value described in the architecture file for all pins of the specific phyiscal type ([0..number_of_pins-1][0..number_of_segments-1]).
106+
* @param Type Physical type information, such as total number of pins, block width, block height, and etc.
107+
* @param type_layer Layer indicies on which the physical type located.
108+
* @param perturb_switch_pattern Specifies whether connections should be distributed unevenly across the channel or not.
109+
* @param directionality Segment directionality, should be either *UNI-DIRECTIONAL* or *BI-DIRECTIONAL*
110+
* @param seg_inf Segments informations, such as length, frequency, and etc.
111+
* @param sets_per_seg_type Number of available sets within the channel_width of each segment type
112+
*
113+
* @return an 5D matrix which keeps the track indicies connected to each pin ([0..num_pins-1][0..width-1][0..height-1][0..layer-1][0..sides-1]).
114+
*
115+
*/
99116
static vtr::NdMatrix<std::vector<int>, 5> alloc_and_load_pin_to_track_map(const e_pin_type pin_type,
100117
const vtr::Matrix<int>& Fc,
101118
const t_physical_tile_type_ptr Type,
@@ -104,7 +121,24 @@ static vtr::NdMatrix<std::vector<int>, 5> alloc_and_load_pin_to_track_map(const
104121
const e_directionality directionality,
105122
const std::vector<t_segment_inf>& seg_inf,
106123
const int* sets_per_seg_type);
107-
124+
/**
125+
* @brief This routine calculate pin connections to tracks for a specific type and a specific segment based on the Fc value
126+
* defined for each pin in the architecture file. This routine is called twice for each combination of block type and segment
127+
* type: 1) connecting tracks to input pins 2) connecting output pins to tracks.
128+
*
129+
* @param pin_type Specifies whether the routine should connect tracks to *INPUT* pins or connect *OUTPUT* pins to tracks.
130+
* @param Fc Actual Fc value described in the architecture file for all pins of the specific phyiscal type ([0..number_of_pins-1][0..number_of_segments-1]).
131+
* @param seg_type_tracks Number of tracks that is avaliable for the specific segment.
132+
* @param seg_index The segment index that the function is trying to connect to pins.
133+
* @param max_Fc Used to allocate max possible space for simplicity.
134+
* @param Type Physical type information, such as total number of pins, block width, block height, and etc.
135+
* @param type_layer Layer indicies on which the physical type located.
136+
* @param perturb_switch_pattern Specifies whether connections should be distributed unevenly across the channel or not.
137+
* @param directionality Segment directionality, should be either *UNI-DIRECTIONAL* or *BI-DIRECTIONAL*
138+
*
139+
* @return an 6D matrix which keeps the track indicies connected to each pin ([0..num_pins-1][0..width-1][0..height-1][0..layer-1][0..sides-1][0..Fc-1]).
140+
*
141+
*/
108142
static vtr::NdMatrix<int, 6> alloc_and_load_pin_to_seg_type(const e_pin_type pin_type,
109143
const vtr::Matrix<int>& Fc,
110144
const int seg_type_tracks,
@@ -297,6 +331,20 @@ static void alloc_and_load_tile_rr_graph(RRGraphBuilder& rr_graph_builder,
297331
const int delayless_switch);
298332

299333
static float pattern_fmod(float a, float b);
334+
335+
336+
/**
337+
* @brief Loads the tracks_connected_to_pin array with an even distribution of switches across the tracks for each pin.
338+
*
339+
* @param tracks_connected_to_pin The funtion loads up this data structure with a track index for each pin ([0..num_pins-1][0..width-1][0..height-1][0..layer-1][0..sides-1][0..Fc-1]]).
340+
* @param pin_locations Physical pin informations, such as pin_index in the physical type, side, and etc.
341+
* @param Fc Actual Fc value described in the architecture file for all pins of the specific phyiscal type ([0..number_of_pins-1][0..number_of_segments-1]).
342+
* @param seg_index The segment index that the function is trying to connect to pins.
343+
* @param x_chan_width Number of tracks in x-axis.
344+
* @param y_chan_width Number of tracks in y-axis.
345+
* @param directionality Segment directionality, should be either *UNI-DIRECTIONAL* or *BI-DIRECTIONAL*
346+
*
347+
*/
300348
static void load_uniform_connection_block_pattern(vtr::NdMatrix<int, 6>& tracks_connected_to_pin,
301349
const std::vector<t_pin_loc>& pin_locations,
302350
const vtr::Matrix<int>& Fc,
@@ -305,6 +353,18 @@ static void load_uniform_connection_block_pattern(vtr::NdMatrix<int, 6>& tracks_
305353
const int y_chan_width,
306354
const enum e_directionality directionality);
307355

356+
/**
357+
* @brief Loads the tracks_connected_to_pin array with an unevenly distributed set of switches across the channel.
358+
*
359+
* @param tracks_connected_to_pin The funtion loads up this data structure with a track index for each pin ([0..num_pins-1][0..width-1][0..height-1][0..layer-1][0..sides-1][0..Fc-1]]).
360+
* @param pin_locations Physical pin informations, such as pin_index in the physical type, side, and etc.
361+
* @param x_chan_width Number of tracks in x-axis.
362+
* @param y_chan_width Number of tracks in y-axis.
363+
* @param Fc Actual Fc value described in the architecture file for all pins of the specific phyiscal type ([0..number_of_pins-1][0..number_of_segments-1]).
364+
* @param seg_index The segment index that the function is trying to connect to pins.
365+
* @param directionality Segment directionality, should be either *UNI-DIRECTIONAL* or *BI-DIRECTIONAL*
366+
*
367+
*/
308368
static void load_perturbed_connection_block_pattern(vtr::NdMatrix<int, 6>& tracks_connected_to_pin,
309369
const std::vector<t_pin_loc>& pin_locations,
310370
const int x_chan_width,
@@ -1276,8 +1336,8 @@ static void build_rr_graph(const t_graph_type graph_type,
12761336
/* START IPIN MAP */
12771337
/* Create ipin map lookups */
12781338

1279-
t_pin_to_track_lookup ipin_to_track_map_x(types.size()); /* [0..device_ctx.physical_tile_types.size()-1][0..num_pins-1][0..width][0..height][0..3][0..Fc-1] */
1280-
t_pin_to_track_lookup ipin_to_track_map_y(types.size()); /* [0..device_ctx.physical_tile_types.size()-1][0..max_chan_width-1][0..width][0..height][0..3] */
1339+
t_pin_to_track_lookup ipin_to_track_map_x(types.size()); /* [0..device_ctx.physical_tile_types.size()-1][0..num_pins-1][0..width-1][0..height-1][0..layers-1][0..sides-1][0..Fc-1] */
1340+
t_pin_to_track_lookup ipin_to_track_map_y(types.size()); /* [0..device_ctx.physical_tile_types.size()-1][0..num_pins-1][0..width-1][0..height-1][0..layers-1][0..sides-1][0..Fc-1] */
12811341

12821342
t_track_to_pin_lookup track_to_pin_lookup_x(types.size());
12831343
t_track_to_pin_lookup track_to_pin_lookup_y(types.size());
@@ -3339,13 +3399,6 @@ static vtr::NdMatrix<int, 6> alloc_and_load_pin_to_seg_type(const e_pin_type pin
33393399
* If pin ipin on side iside does not exist or is of the wrong type,
33403400
* tracks_connected_to_pin[ipin][iside][0] = OPEN. */
33413401

3342-
/* AA: I think we're currently not doing anything with the ability to specify different Fc values
3343-
* for each segment. Cause we're passing in max_Fc into this function by finding the max_Fc for that
3344-
* segment type by going through Fc[ipin][iseg] (this is a matrix for each type btw, not the overall
3345-
* Fc[itype][ipin][iseg] matrix). Probably should update this to allow finer control over cb along with
3346-
* allowing different specification of the segment parallel_axis.
3347-
*/
3348-
33493402
auto& grid = g_vpr_ctx.device().grid;
33503403

33513404
if (Type->num_pins < 1) {

0 commit comments

Comments
 (0)