@@ -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.
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 .
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
@@ -145,7 +145,7 @@ static inline void fix_IO_block_types(t_pl_macro pl_macro, t_pl_loc loc, enum e_
145
145
*
146
146
* @return True if the location is legal for the macro head member, false otherwise.
147
147
*/
148
- static bool is_loc_legal (t_pl_loc loc, PartitionRegion& pr, t_logical_block_type_ptr block_type);
148
+ static bool is_loc_legal (t_pl_loc& loc, PartitionRegion& pr, t_logical_block_type_ptr block_type);
149
149
150
150
/* *
151
151
* @brief Calculates a centroid location for a block based on its placed connections.
@@ -264,24 +264,31 @@ static bool is_block_placed(ClusterBlockId blk_id) {
264
264
return (!(place_ctx.block_locs [blk_id].loc .x == INVALID_X));
265
265
}
266
266
267
- static bool is_loc_legal (t_pl_loc loc, PartitionRegion& pr, t_logical_block_type_ptr block_type) {
267
+ static bool is_loc_legal (t_pl_loc& loc, PartitionRegion& pr, t_logical_block_type_ptr block_type) {
268
268
const auto & grid = g_vpr_ctx.device ().grid ;
269
- auto & place_ctx = g_vpr_ctx.mutable_placement ();
270
269
bool legal = false ;
271
270
272
271
// Check if the location is within its constraint region
273
272
for (auto reg : pr.get_partition_region ()) {
274
273
if (reg.get_region_rect ().contains (vtr::Point<int >(loc.x , loc.y ))) {
275
- // Check if blk_id type and the location physical types match
276
- if (is_tile_compatible (grid[loc.x ][loc.y ].type , block_type)) {
277
- // Check if the location is an anchor position
278
- if (grid[loc.x ][loc.y ].height_offset == 0 && grid[loc.x ][loc.y ].width_offset == 0 ) {
279
- legal = true ;
280
- break ;
281
- }
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 ;
282
278
}
283
279
}
284
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 ;
288
+ }
289
+ }
290
+ }
291
+
285
292
return legal;
286
293
}
287
294
@@ -426,26 +433,12 @@ static bool try_centroid_placement(t_pl_macro pl_macro, PartitionRegion& pr, t_l
426
433
return false ;
427
434
}
428
435
429
- auto & grid = g_vpr_ctx.device ().grid ;
430
- auto to_type = grid[centroid_loc.x ][centroid_loc.y ].type ;
431
-
432
436
auto & device_ctx = g_vpr_ctx.device ();
433
- auto & place_ctx = g_vpr_ctx.mutable_placement ();
434
-
435
- centroid_loc.sub_tile = 0 ;
436
-
437
- for (int subtile = 0 ; subtile < to_type->capacity ; subtile++) {
438
- if (place_ctx.grid_blocks [centroid_loc.x ][centroid_loc.y ].blocks [subtile] == EMPTY_BLOCK_ID) {
439
- if (is_sub_tile_compatible (to_type, block_type, subtile)) {
440
- centroid_loc.sub_tile = subtile;
441
- }
442
- }
443
- }
444
437
445
438
VTR_ASSERT (device_ctx.grid [centroid_loc.x ][centroid_loc.y ].width_offset == 0 );
446
439
VTR_ASSERT (device_ctx.grid [centroid_loc.x ][centroid_loc.y ].height_offset == 0 );
447
440
448
- bool legal = false ;
441
+ bool legal;
449
442
450
443
legal = try_place_macro (pl_macro, centroid_loc);
451
444
@@ -892,7 +885,7 @@ static void place_all_blocks(vtr::vector<ClusterBlockId, t_block_score>& block_s
892
885
893
886
auto blk_id_type = cluster_ctx.clb_nlist .block_type (blk_id);
894
887
blocks_placed_since_heap_update++;
895
-
888
+
896
889
bool block_placed = place_one_block (blk_id, pad_loc_type, &blk_types_empty_locs_in_grid[blk_id_type->index ], &block_scores);
897
890
898
891
// update heap based on update_heap_freq calculated above
0 commit comments