@@ -148,18 +148,17 @@ static bool is_loc_legal(const t_pl_loc& loc,
148
148
t_logical_block_type_ptr block_type);
149
149
150
150
/* *
151
- * @brief Helper function to choose a subtile in specified location if compatible and available one exits .
151
+ * @brief Helper function to choose a subtile in specified location if the type is compatible and an available one exists .
152
152
*
153
- * @param centroid The centroid location at which the subtile will be selected using its x,y, and layer.
154
- * @param block_type Logical block type of the macro head member.
155
- * @param block_loc_registry Placement block location information. To be filled with the location
156
- * where pl_macro is placed.
157
- * @param pr The PartitionRegion of the macro head member - represents its floorplanning constraints, is the size of
158
- * the whole chip if the macro is not constrained.
159
- * @param rng A random number generator to select subtile from available and compatible ones.
153
+ * @param centroid The centroid location at which the subtile will be selected using its x, y, and layer.
154
+ * @param block_type Logical block type we would like to place here.
155
+ * @param block_loc_registry Information on where other blocks have been placed.
156
+ * @param pr The PartitionRegion of the block we are trying to place - represents its floorplanning constraints;
157
+ * it is the size of the whole chip if the block is not constrained.
158
+ * @param rng A random number generator to select a subtile from the available and compatible ones.
160
159
*
161
- * @return False if location on chip, legal, but no available subtile found. True otherwise. False leads us to
162
- * neighbour placement currently.
160
+ * @return True if the location is on the chip, legal, and at least one available subtile is found at that location;
161
+ * false otherwise.
163
162
*/
164
163
static bool find_subtile_in_location (t_pl_loc& centroid,
165
164
t_logical_block_type_ptr block_type,
@@ -367,13 +366,13 @@ bool find_subtile_in_location(t_pl_loc& centroid,
367
366
vtr::RngContainer& rng) {
368
367
// check if the location is on chip and legal, if yes try to update subtile
369
368
if (is_loc_on_chip ({centroid.x , centroid.y , centroid.layer }) && is_loc_legal (centroid, pr, block_type)) {
370
- // finding the subtile location
369
+ // find the compatible subtiles
371
370
const auto & device_ctx = g_vpr_ctx.device ();
372
371
const auto & compressed_block_grid = g_vpr_ctx.placement ().compressed_block_grids [block_type->index ];
373
372
const auto & type = device_ctx.grid .get_physical_type ({centroid.x , centroid.y , centroid.layer });
374
373
const auto & compatible_sub_tiles = compressed_block_grid.compatible_sub_tile_num (type->index );
375
374
376
- // filter out occupied subtiles
375
+ // filter out the occupied subtiles
377
376
const GridBlock& grid_blocks = blk_loc_registry.grid_blocks ();
378
377
std::vector<int > available_sub_tiles;
379
378
available_sub_tiles.reserve (compatible_sub_tiles.size ());
@@ -384,16 +383,13 @@ bool find_subtile_in_location(t_pl_loc& centroid,
384
383
}
385
384
}
386
385
387
- // If there is at least one available subtile, update the centroid. Otherwise, sincel location
388
- // is legal and on chip but no subtile found, return false for trying neighbour placement.
389
386
if (!available_sub_tiles.empty ()) {
390
387
centroid.sub_tile = available_sub_tiles[rng.irand ((int )available_sub_tiles.size () - 1 )];
391
- } else {
392
- return false ;
388
+ return true ;
393
389
}
394
390
}
395
391
396
- return true ;
392
+ return false ;
397
393
}
398
394
399
395
static bool find_centroid_neighbor (t_pl_loc& centroid_loc,
@@ -607,14 +603,14 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
607
603
t_pl_loc centroid_loc (OPEN, OPEN, OPEN, OPEN);
608
604
std::vector<ClusterBlockId> unplaced_blocks_to_update_their_score;
609
605
610
- bool try_neighbour_due_to_subtile = false ;
606
+ bool found_legal_subtile = false ;
611
607
612
608
if (!flat_placement_info.valid ) {
613
609
// If a flat placement is not provided, use the centroid of connected
614
610
// blocks which have already been placed.
615
611
unplaced_blocks_to_update_their_score = find_centroid_loc (pl_macro, centroid_loc, blk_loc_registry);
616
- if (! find_subtile_in_location (centroid_loc, block_type, blk_loc_registry, pr, rng)) {
617
- try_neighbour_due_to_subtile = true ;
612
+ if (find_subtile_in_location (centroid_loc, block_type, blk_loc_registry, pr, rng)) {
613
+ found_legal_subtile = true ;
618
614
}
619
615
} else {
620
616
// If a flat placement is provided, use the flat placement to get the
@@ -628,8 +624,8 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
628
624
if (!is_loc_on_chip ({centroid_loc.x , centroid_loc.y , centroid_loc.layer }) ||
629
625
!is_loc_legal (centroid_loc, pr, block_type)) {
630
626
unplaced_blocks_to_update_their_score = find_centroid_loc (pl_macro, centroid_loc, blk_loc_registry);
631
- if (! find_subtile_in_location (centroid_loc, block_type, blk_loc_registry, pr, rng)) {
632
- try_neighbour_due_to_subtile = true ;
627
+ if (find_subtile_in_location (centroid_loc, block_type, blk_loc_registry, pr, rng)) {
628
+ found_legal_subtile = true ;
633
629
}
634
630
}
635
631
}
@@ -641,7 +637,7 @@ static bool try_centroid_placement(const t_pl_macro& pl_macro,
641
637
642
638
// centroid suggestion was either occupied or does not match block type
643
639
// try to find a near location that meet these requirements
644
- if (!is_loc_legal (centroid_loc, pr, block_type) || try_neighbour_due_to_subtile ) {
640
+ if (!found_legal_subtile ) {
645
641
bool neighbor_legal_loc = find_centroid_neighbor (centroid_loc, block_type, false , blk_loc_registry, rng);
646
642
if (!neighbor_legal_loc) { // no neighbor candidate found
647
643
return false ;
0 commit comments