@@ -203,7 +203,8 @@ static std::vector<ClusterBlockId> find_centroid_loc(const t_pl_macro& pl_macro,
203
203
*
204
204
* @return true if the function can find any location near the centroid one, false otherwise.
205
205
*/
206
- static bool find_centroid_neighbor (t_pl_loc& centroid_loc,
206
+ static bool find_centroid_neighbor (ClusterBlockId block_id,
207
+ t_pl_loc& centroid_loc,
207
208
t_logical_block_type_ptr block_type,
208
209
bool search_for_empty,
209
210
int r_lim,
@@ -212,7 +213,8 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
212
213
213
214
/* *
214
215
* @brief tries to place a macro at a centroid location of its placed connections.
215
- *
216
+ *
217
+ * @param block_id The block to be placed.
216
218
* @param pl_macro The macro to be placed.
217
219
* @param pr The PartitionRegion of the macro - represents its floorplanning constraints, is the size of the whole chip if the macro is not
218
220
* constrained.
@@ -225,7 +227,8 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
225
227
*
226
228
* @return true if the macro gets placed, false if not.
227
229
*/
228
- static bool try_centroid_placement (const t_pl_macro& pl_macro,
230
+ static bool try_centroid_placement (ClusterBlockId block_id,
231
+ const t_pl_macro& pl_macro,
229
232
const PartitionRegion& pr,
230
233
t_logical_block_type_ptr block_type,
231
234
e_pad_loc_type pad_loc_type,
@@ -400,7 +403,8 @@ bool find_subtile_in_location(t_pl_loc& centroid,
400
403
return false ;
401
404
}
402
405
403
- static bool find_centroid_neighbor (t_pl_loc& centroid_loc,
406
+ static bool find_centroid_neighbor (ClusterBlockId block_id,
407
+ t_pl_loc& centroid_loc,
404
408
t_logical_block_type_ptr block_type,
405
409
bool search_for_empty,
406
410
int rlim,
@@ -425,6 +429,16 @@ static bool find_centroid_neighbor(t_pl_loc& centroid_loc,
425
429
426
430
int delta_cx = search_range.xmax - search_range.xmin ;
427
431
432
+ bool search_range_adjusted = adjust_search_range (block_type,
433
+ block_id,
434
+ search_range,
435
+ delta_cx,
436
+ centroid_loc_layer_num);
437
+
438
+ if (!search_range_adjusted) {
439
+ return false ;
440
+ }
441
+
428
442
// Block has not been placed yet, so the "from" coords will be (-1, -1)
429
443
int cx_from = OPEN;
430
444
int cy_from = OPEN;
@@ -832,7 +846,8 @@ static inline t_pl_loc find_nearest_compatible_loc(const t_flat_pl_loc& src_flat
832
846
return best_loc;
833
847
}
834
848
835
- static bool try_centroid_placement (const t_pl_macro& pl_macro,
849
+ static bool try_centroid_placement (ClusterBlockId block_id,
850
+ const t_pl_macro& pl_macro,
836
851
const PartitionRegion& pr,
837
852
t_logical_block_type_ptr block_type,
838
853
e_pad_loc_type pad_loc_type,
@@ -889,7 +904,7 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
889
904
// centroid suggestion was either occupied or does not match block type
890
905
// try to find a near location that meet these requirements
891
906
if (!found_legal_subtile) {
892
- bool neighbor_legal_loc = find_centroid_neighbor (centroid_loc, block_type, false , rlim, blk_loc_registry, rng);
907
+ bool neighbor_legal_loc = find_centroid_neighbor (block_id, centroid_loc, block_type, false , rlim, blk_loc_registry, rng);
893
908
if (!neighbor_legal_loc) { // no neighbor candidate found
894
909
return false ;
895
910
}
@@ -1300,7 +1315,7 @@ static bool place_macro(int macros_max_num_tries,
1300
1315
1301
1316
if (!macro_placed) {
1302
1317
VTR_LOGV_DEBUG (g_vpr_ctx.placement ().f_placer_debug , " \t\t\t Try centroid placement\n " );
1303
- macro_placed = try_centroid_placement (pl_macro, pr, block_type, pad_loc_type, block_scores, blk_loc_registry, flat_placement_info, rng);
1318
+ macro_placed = try_centroid_placement (blk_id, pl_macro, pr, block_type, pad_loc_type, block_scores, blk_loc_registry, flat_placement_info, rng);
1304
1319
}
1305
1320
VTR_LOGV_DEBUG (g_vpr_ctx.placement ().f_placer_debug , " \t\t\t Macro is placed: %d\n " , macro_placed);
1306
1321
// If macro is not placed yet, try to place the macro randomly for the max number of random tries
0 commit comments