Skip to content

Commit 19d2799

Browse files
committed
is_loc_legal minor bug fixed
1 parent ed54bcc commit 19d2799

File tree

1 file changed

+12
-15
lines changed

1 file changed

+12
-15
lines changed

vpr/src/place/initial_placement.cpp

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ static std::vector<t_grid_empty_locs_block_type> init_blk_types_empty_locations(
136136
static inline void fix_IO_block_types(t_pl_macro pl_macro, t_pl_loc loc, enum e_pad_loc_type pad_loc_type);
137137

138138
/**
139-
* @brief Determine whether a specific macro can be placed in a specific location and choose the location's subtile if the location is legal.
139+
* @brief Determine whether a specific macro can be placed in a specific location.
140140
*
141141
* @param loc The location at which the macro head member is placed.
142142
* @param pr The PartitionRegion of the macro head member - represents its floorplanning constraints, is the size of the whole chip if the macro is not
@@ -271,20 +271,13 @@ static bool is_loc_legal(t_pl_loc& loc, PartitionRegion& pr, t_logical_block_typ
271271
//Check if the location is within its constraint region
272272
for (auto reg : pr.get_partition_region()) {
273273
if (reg.get_region_rect().contains(vtr::Point<int>(loc.x, loc.y))) {
274-
//Check if the location is an anchor position
275-
if (grid[loc.x][loc.y].height_offset == 0 && grid[loc.x][loc.y].width_offset == 0) {
276-
legal = true;
277-
break;
278-
}
279-
}
280-
}
281-
282-
if (legal) { // location (x,y) is legal for the block type, a compatible subtile should be choosen to place the block
283-
legal = false;
284-
for (auto subtile = 0; subtile < grid[loc.x][loc.y].type->capacity; subtile++) {
285-
if (is_sub_tile_compatible(grid[loc.x][loc.y].type, block_type, loc.sub_tile)) {
286-
loc.sub_tile = subtile;
287-
legal = true;
274+
//check if the location is compatible with the block type
275+
if (is_tile_compatible(grid[loc.x][loc.y].type, block_type)) {
276+
//Check if the location is an anchor position
277+
if (grid[loc.x][loc.y].height_offset == 0 && grid[loc.x][loc.y].width_offset == 0) {
278+
legal = true;
279+
break;
280+
}
288281
}
289282
}
290283
}
@@ -434,6 +427,10 @@ static bool try_centroid_placement(t_pl_macro pl_macro, PartitionRegion& pr, t_l
434427
}
435428

436429
auto& device_ctx = g_vpr_ctx.device();
430+
//choose the location's subtile if the centroid location is legal.
431+
const auto& compressed_block_grid = g_vpr_ctx.placement().compressed_block_grids[block_type->index];
432+
auto& compatible_sub_tiles = compressed_block_grid.compatible_sub_tiles_for_tile.at(device_ctx.grid[centroid_loc.x][centroid_loc.y].type->index);
433+
centroid_loc.sub_tile = compatible_sub_tiles[vtr::irand((int)compatible_sub_tiles.size() - 1)];
437434

438435
VTR_ASSERT(device_ctx.grid[centroid_loc.x][centroid_loc.y].width_offset == 0);
439436
VTR_ASSERT(device_ctx.grid[centroid_loc.x][centroid_loc.y].height_offset == 0);

0 commit comments

Comments
 (0)