Skip to content

Commit c065ae8

Browse files
committed
Enchanced code comments.
Signed-off-by: Maciej Kurc <[email protected]>
1 parent 86060ce commit c065ae8

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

vpr/src/pack/cluster.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,18 @@ static void alloc_and_load_pb_stats(t_pb* pb, const int feasible_block_array_siz
11811181

11821182
/**
11831183
* Cleans up a pb after unsuccessful molecule packing
1184+
*
1185+
* Recursively frees pbs from a t_pb tree. The given root pb itself is not
1186+
* deleted.
1187+
*
1188+
* If a pb object has its children allocated then before freeing them the
1189+
* function checks if there is no atom that corresponds to any of them. The
1190+
* check is performed only for leaf (primitive) pbs. The function recurses for
1191+
* non-primitive pbs.
1192+
*
1193+
* The cleaning itself includes deleting all child pbs, resetting mode of the
1194+
* pb and also freeing its name. This prepares the pb for another round of
1195+
* molecule packing tryout.
11841196
*/
11851197
static bool cleanup_pb(t_pb* pb) {
11861198
bool can_free = true;
@@ -1417,7 +1429,9 @@ static enum e_block_pack_status try_pack_molecule(t_cluster_placement_stats* clu
14171429
}
14181430
}
14191431

1420-
/* Placement failed, clean the pb */
1432+
/* Packing failed, but a part of the pb tree is still allocated and pbs have their modes set.
1433+
* Before trying to pack next molecule the unused pbs need to be freed and, the most important,
1434+
* their modes reset. This task is performed by the cleanup_pb() function below. */
14211435
cleanup_pb(pb);
14221436

14231437
} else {

0 commit comments

Comments
 (0)