@@ -136,7 +136,7 @@ static std::vector<t_grid_empty_locs_block_type> init_blk_types_empty_locations(
136
136
static inline void fix_IO_block_types (t_pl_macro pl_macro, t_pl_loc loc, enum e_pad_loc_type pad_loc_type);
137
137
138
138
/* *
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.
140
140
*
141
141
* @param loc The location at which the macro head member is placed.
142
142
* @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
271
271
// Check if the location is within its constraint region
272
272
for (auto reg : pr.get_partition_region ()) {
273
273
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
+ }
288
281
}
289
282
}
290
283
}
@@ -434,6 +427,10 @@ static bool try_centroid_placement(t_pl_macro pl_macro, PartitionRegion& pr, t_l
434
427
}
435
428
436
429
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 )];
437
434
438
435
VTR_ASSERT (device_ctx.grid [centroid_loc.x ][centroid_loc.y ].width_offset == 0 );
439
436
VTR_ASSERT (device_ctx.grid [centroid_loc.x ][centroid_loc.y ].height_offset == 0 );
0 commit comments