1515#include "place_macro.h"
1616#include "grid_tile_lookup.h"
1717
18- /*
19- * Check that placement of each block is within the floorplan constraint region of that block (if the block has any constraints).
20- * Returns the number of errors (inconsistencies in adherence to floorplanning constraints).
18+ /**
19+ * @brief Check that placement of each block is within the floorplan constraint region
20+ * of that block (if the block has any constraints).
21+ *
22+ * @return int The number of errors (inconsistencies in adherence to floorplanning constraints).
2123 */
2224int check_placement_floorplanning ();
2325
24- /*
25- * Check if the block has floorplanning constraints
26+
27+ /**
28+ * @brief Check if the block has floorplanning constraints.
29+ *
30+ * @param blk_id The ID of the clustered block to be checked.
31+ * @return bool True if the block has floorplanning constraints, false otherwise.
2632 */
2733bool is_cluster_constrained (ClusterBlockId blk_id );
2834
29- /*
30- * Check if the placement location would respect floorplan constraints of the block, if it has any
35+ /**
36+ * @brief Check if the placement location would respect floorplan constraints of the block, if it has any.
37+ *
38+ * This function determines whether placing a block at a specified location adheres to its floorplan constraints.
39+ *
40+ * @param blk_id The ID of the clustered block to be checked.
41+ * @param loc The location where the block is to be placed.
42+ * @return bool True if the placement location respects the block's floorplan constraints, false otherwise.
3143 */
3244bool cluster_floorplanning_legal (ClusterBlockId blk_id , const t_pl_loc & loc );
3345
34- /*
35- * Check whether any member of the macro has floorplan constraints
46+
47+ /**
48+ * @brief Check whether any member of the macro has floorplan constraints.
49+ *
50+ * @param pl_macro The macro to be checked.
51+ * @return bool True if any member of the macro has floorplan constraints, false otherwise.
3652 */
3753bool is_macro_constrained (const t_pl_macro & pl_macro );
3854
39- /*
40- * Returns PartitionRegion for the head of the macro based on the floorplan constraints
41- * of all blocks in the macro. For example, if there was a macro of length two and each block has
42- * a constraint, this routine will shift and intersect the two constraint regions to calculate
43- * the tightest region constraint for the head macro.
55+ /**
56+ * @brief Returns PartitionRegion for the head of the macro based on the floorplan constraints
57+ * of all blocks in the macro.
58+ *
59+ * This function calculates the PartitionRegion for the head of a macro by considering the
60+ * floorplan constraints of all blocks in the macro. For example, if a macro has two blocks
61+ * and each block has a constraint, this routine will shift and intersect the two constraint
62+ * regions to determine the tightest region constraint for the macro's head.
63+ *
64+ * @param pl_macro The macro whose head's PartitionRegion is to be calculated.
65+ * @param grid_pr The PartitionRegion of the grid to be considered.
66+ * @return PartitionRegion The calculated PartitionRegion for the head of the macro.
4467 */
4568PartitionRegion update_macro_head_pr (const t_pl_macro & pl_macro , const PartitionRegion & grid_pr );
4669
47- /*
48- * Update the PartitionRegions of non-head members of a macro,
70+ /**
71+ * @brief Update the PartitionRegions of non-head members of a macro,
4972 * based on the constraint that was calculated for the head region, head_pr.
50- * The constraint on the head region must be the tightest possible (i.e. implied by the
51- * entire macro) before this routine is called.
52- * For each macro member, the updated constraint is essentially the head constraint
53- * with the member's offset applied.
73+ *
74+ * The constraint on the head region must be the tightest possible (i.e., implied by the
75+ * entire macro) before this routine is called. For each macro member, the updated constraint
76+ * is essentially the head constraint with the member's offset applied.
77+ *
78+ * @param head_pr The PartitionRegion constraint of the macro's head.
79+ * @param offset The offset of the macro member from the head.
80+ * @param grid_pr A PartitionRegion covering the entire grid.
81+ * @param pl_macro The placement macro whose members' PartitionRegions are to be updated.
82+ * @return PartitionRegion The updated PartitionRegion for the macro member.
5483 */
55- PartitionRegion update_macro_member_pr (PartitionRegion & head_pr , const t_pl_offset & offset , const PartitionRegion & grid_pr , const t_pl_macro & pl_macro );
84+ PartitionRegion update_macro_member_pr (const PartitionRegion & head_pr ,
85+ const t_pl_offset & offset ,
86+ const PartitionRegion & grid_pr ,
87+ const t_pl_macro & pl_macro );
5688
57- /*
58- * Updates the floorplan constraints information for all constrained macros.
89+ /**
90+ * @brief Updates the floorplan constraints information for all constrained macros.
91+ *
5992 * Updates the constraints to be the tightest constraints possible while adhering
60- * to the floorplan constraints of each macro member.
61- * This is done at the start of initial placement to ease floorplan legality checking
62- * while placing macros during initial placement.
93+ * to the floorplan constraints of each macro member. This is done at the start of
94+ * initial placement to ease floorplan legality checking while placing macros during
95+ * initial placement.
6396 */
6497void propagate_place_constraints ();
6598
@@ -83,21 +116,26 @@ inline bool floorplan_legal(const t_pl_blocks_to_be_moved& blocks_affected) {
83116 return true;
84117}
85118
86- /*
87- * Load cluster_constraints if the pack stage of VPR is skipped. The cluster_constraints
88- * data structure is normally loaded during packing, so this routine is called when the packing stage is not performed.
89- * If no constraints file is specified, every cluster is assigned
90- * an empty PartitionRegion. If a constraints file is specified, cluster_constraints is loaded according to
119+
120+ /**
121+ * @brief Load cluster_constraints if the pack stage of VPR is skipped.
122+ *
123+ * The cluster_constraints data structure is normally loaded during packing,
124+ * so this routine is called when the packing stage is not performed.
125+ * If no constraints file is specified, every cluster is assigned an empty PartitionRegion.
126+ * If a constraints file is specified, cluster_constraints is loaded according to
91127 * the floorplan constraints specified in the file.
92- * Load cluster_constraints according to the floorplan constraints specified in
93- * the constraints XML file.
128+ *
129+ * @note Load cluster_constraints according to the floorplan constraints specified in the constraints XML file.
94130 */
95131void load_cluster_constraints ();
96132
97- /*
98- * Marks blocks as fixed if they have a constraint region that specifies exactly one x, y,
99- * subtile location as legal.
100- * Marking them as fixed indicates that they cannot be moved during initial placement and simulated annealing
133+ /**
134+ * @brief Marks blocks as fixed if they have a constraint region that
135+ * specifies exactly one x, y, subtile location as legal.
136+ *
137+ * Marking them as fixed indicates that they cannot be moved
138+ * during initial placement and simulated annealing.
101139 */
102140void mark_fixed_blocks ();
103141
@@ -107,43 +145,70 @@ void mark_fixed_blocks();
107145 */
108146void alloc_and_load_compressed_cluster_constraints ();
109147
110- /*
111- * Returns the number of tiles covered by a floorplan region.
148+ /**
149+ * @brief Returns the number of tiles covered by a floorplan region.
150+ *
112151 * The return value of this routine will either be 0, 1, or 2. This
113152 * is because this routine is used to check whether the region covers no tile,
114153 * one tile, or more than one tile, and so as soon as it is seen that the number of tiles
115154 * covered is 2, no further information is needed.
155+ *
156+ * @param reg The region to be checked.
157+ * @param block_type The type of logical block.
158+ * @param loc The location of the tile, if only one tile is covered.
159+ * @return int The number of tiles covered by the region.
116160 */
117161int region_tile_cover (const Region & reg , t_logical_block_type_ptr block_type , t_pl_loc & loc );
118162
119- /*
120- * Returns a bool that indicates if the PartitionRegion covers exactly one compatible location.
121- * Used to decide whether to mark a block with the .is_fixed flag based on its floorplan
122- * region.
163+ /**
164+ * @brief Returns a bool that indicates if the PartitionRegion covers exactly one compatible location.
165+ *
166+ * Used to decide whether to mark a block with the .is_fixed flag based on its floorplan region.
123167 * block_type is used to determine whether the PartitionRegion is compatible with the cluster block type
124- * and loc is updated with the location covered by the PartitionRegion
168+ * and loc is updated with the location covered by the PartitionRegion.
169+ *
170+ * @param pr The PartitionRegion to be checked.
171+ * @param block_type The type of logical block.
172+ * @param loc The location covered by the PartitionRegion, if it covers exactly one compatible location.
173+ * @return bool True if the PartitionRegion covers exactly one compatible location, false otherwise.
125174 */
126- bool is_pr_size_one (PartitionRegion & pr , t_logical_block_type_ptr block_type , t_pl_loc & loc );
175+ bool is_pr_size_one (const PartitionRegion & pr , t_logical_block_type_ptr block_type , t_pl_loc & loc );
127176
128- /*
129- * Returns the number of grid tiles that are covered by the partition region and
130- * compatible with the cluster's block type.
131- * Used prior to initial placement to help sort blocks based on how difficult they
132- * are to place.
177+ /**
178+ * @brief Returns the number of grid tiles that are covered by the partition region
179+ * and compatible with the cluster's block type.
180+ *
181+ * Used prior to initial placement to help sort blocks based on how difficult they are to place.
182+ *
183+ * @param pr The PartitionRegion to be checked.
184+ * @param block_type The type of logical block.
185+ * @param grid_tiles The GridTileLookup containing information about the number of available subtiles
186+ * compatible the given block_type.
187+ * @return int The number of compatible grid tiles covered by the PartitionRegion.
133188 */
134189int get_part_reg_size (const PartitionRegion & pr ,
135190 t_logical_block_type_ptr block_type ,
136191 const GridTileLookup & grid_tiles );
137192
138- /*
139- * Return the floorplan score that will be used for sorting blocks during initial placement. This score is the
140- * total number of subtiles for the block type in the grid, minus the number of subtiles in the block's floorplan PartitionRegion.
141- * The resulting number is the number of tiles outside the block's floorplan region, meaning the higher
142- * it is, the more difficult the block is to place.
193+
194+ /**
195+ * @brief Return the floorplan score that will be used for sorting blocks during initial placement.
196+ *
197+ * This score is the total number of subtiles for the block type in the grid, minus the number of subtiles
198+ * in the block's floorplan PartitionRegion. The resulting number is the number of tiles outside the block's
199+ * floorplan region, meaning the higher it is, the more difficult the block is to place.
200+ *
201+ * @param blk_id The ID of the cluster block.
202+ * @param pr The PartitionRegion representing the floorplan region of the block.
203+ * @param block_type The type of logical block.
204+ * @param grid_tiles The GridTileLookup containing information about the number of available subtiles
205+ * compatible the given block_type.
206+ * @return double The floorplan score for the block.
143207 */
144208double get_floorplan_score (ClusterBlockId blk_id ,
145209 const PartitionRegion & pr ,
146210 t_logical_block_type_ptr block_type ,
147211 const GridTileLookup & grid_tiles );
148212
213+
149214#endif /* VPR_SRC_PLACE_PLACE_CONSTRAINTS_H_ */
0 commit comments