Skip to content

Commit e1d3211

Browse files
committed
Added comments to data members of GridTileLookup class
1 parent be92c46 commit e1d3211

File tree

2 files changed

+17
-6
lines changed

2 files changed

+17
-6
lines changed

vpr/src/place/grid_tile_lookup.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ void GridTileLookup::initialize_grid_tile_matrices() {
44
auto& device_ctx = g_vpr_ctx.device();
55

66
//Will store the max number of tile locations for each logical block type
7-
max_tile_counts.resize(device_ctx.logical_block_types.size());
7+
max_placement_locations.resize(device_ctx.logical_block_types.size());
88

99
for (const auto& type : device_ctx.logical_block_types) {
1010
vtr::NdMatrix<int, 2> type_count({device_ctx.grid.width(), device_ctx.grid.height()});
@@ -24,7 +24,7 @@ void GridTileLookup::fill_type_matrix(t_logical_block_type_ptr block_type, vtr::
2424
* the correct type at each location. For each location, we store the cumulative
2525
* number of tiles of the type up to that location - meaning we store the number of
2626
* subtiles at the location, plus the number of subtiles at the locations above and to
27-
* the left of it.
27+
* the right of it.
2828
*/
2929
for (int i_col = type_count.dim_size(0) - 1; i_col >= 0; i_col--) {
3030
for (int j_row = type_count.dim_size(1) - 1; j_row >= 0; j_row--) {
@@ -52,15 +52,15 @@ void GridTileLookup::fill_type_matrix(t_logical_block_type_ptr block_type, vtr::
5252
}
5353

5454
//The total number of subtiles for the block type will be at [0][0]
55-
max_tile_counts[block_type->index] = type_count[0][0];
55+
max_placement_locations[block_type->index] = type_count[0][0];
5656
}
5757

5858
vtr::NdMatrix<int, 2>& GridTileLookup::get_type_grid(t_logical_block_type_ptr block_type) {
5959
return block_type_matrices[block_type->index];
6060
}
6161

6262
int GridTileLookup::total_type_tiles(t_logical_block_type_ptr block_type) {
63-
return max_tile_counts[block_type->index];
63+
return max_placement_locations[block_type->index];
6464
}
6565

6666
/*

vpr/src/place/grid_tile_lookup.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* This class is used to store a grid for each logical block type that stores the cumulative number of subtiles
33
* for that type available at each location in the grid. The cumulative number of subtiles is the subtiles at the
4-
* location plus the subtiles available at the grid locations above and to the left of the locations.
4+
* location plus the subtiles available at the grid locations above and to the right of the locations.
55
* Having these grids allows for O(1) lookups about the number of subtiles available for a given type of block
66
* in a rectangular region.
77
* This lookup class is used during initial placement when sorting blocks by the size of their floorplan constraint
@@ -30,9 +30,20 @@ class GridTileLookup {
3030
int total_type_tiles(t_logical_block_type_ptr block_type);
3131

3232
private:
33+
/*
34+
* Stores the cumulative total of subtiles available at each location in the grid for each block type.
35+
* Therefore, the length of the vector will be the number of logical block types. To access the cumulative
36+
* number of subtiles at a location, you would use block_type_matrices[iblock_type][x][y] - this would
37+
* give the number of placement locations that are at, or above and to the right of the given [x,y] for
38+
* the given block type.
39+
*/
3340
std::vector<vtr::NdMatrix<int, 2>> block_type_matrices;
3441

35-
std::vector<int> max_tile_counts;
42+
/*
43+
* Stores the total number of placement locations (i.e. compatible subtiles) for each block type.
44+
* To access the max_placement locations for a particular block type, use max_placement_locations[block_type->index]
45+
*/
46+
std::vector<int> max_placement_locations;
3647
};
3748

3849
#endif /* VPR_SRC_PLACE_GRID_TILE_LOOKUP_H_ */

0 commit comments

Comments
 (0)