Skip to content

Commit c7253ce

Browse files
committed
formating the initial placement code
1 parent 19d2799 commit c7253ce

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

vpr/src/place/initial_placement.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,10 @@ static bool try_centroid_placement(t_pl_macro pl_macro, PartitionRegion& pr, t_l
415415

416416
//centroid suggestion was either occupied or does not match block type
417417
//try to find a near location that meet these requirements
418+
bool neighbor_legal_loc;
418419
if (!is_loc_legal(centroid_loc, pr, block_type)) {
419-
if (!find_centroid_neighbor(centroid_loc, block_type)) { //no neighbor candidate found
420+
neighbor_legal_loc = find_centroid_neighbor(centroid_loc, block_type);
421+
if (!neighbor_legal_loc) { //no neighbor candidate found
420422
return false;
421423
}
422424
}
@@ -428,10 +430,14 @@ static bool try_centroid_placement(t_pl_macro pl_macro, PartitionRegion& pr, t_l
428430

429431
auto& device_ctx = g_vpr_ctx.device();
430432
//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)];
434-
433+
//if the location is found within the "find_centroid_neighbor", it already has a subtile
434+
//we don't need to find one agian
435+
if(!neighbor_legal_loc){
436+
const auto& compressed_block_grid = g_vpr_ctx.placement().compressed_block_grids[block_type->index];
437+
auto& compatible_sub_tiles = compressed_block_grid.compatible_sub_tiles_for_tile.at(device_ctx.grid[centroid_loc.x][centroid_loc.y].type->index);
438+
centroid_loc.sub_tile = compatible_sub_tiles[vtr::irand((int)compatible_sub_tiles.size() - 1)];
439+
}
440+
435441
VTR_ASSERT(device_ctx.grid[centroid_loc.x][centroid_loc.y].width_offset == 0);
436442
VTR_ASSERT(device_ctx.grid[centroid_loc.x][centroid_loc.y].height_offset == 0);
437443

0 commit comments

Comments
 (0)