@@ -58,10 +58,6 @@ void remove_mol_from_cluster(const t_pack_molecule* molecule,
58
58
t_lb_router_data*& router_data) {
59
59
auto & helper_ctx = g_vpr_ctx.mutable_cl_helper ();
60
60
61
- // Determine the cluster ID
62
- old_clb = atom_to_cluster (molecule->atom_block_ids [molecule->root ]);
63
- // std::vector<AtomBlockId> old_clb_atoms = cluster_to_atoms(old_clb);
64
-
65
61
// re-build router_data structure for this cluster
66
62
router_data = lb_load_router_data (helper_ctx.lb_type_rr_graphs , old_clb, old_clb_atoms);
67
63
@@ -80,6 +76,7 @@ void commit_mol_move(const ClusterBlockId& old_clb,
80
76
bool new_clb_created) {
81
77
auto & device_ctx = g_vpr_ctx.device ();
82
78
79
+ // Place the new cluster if this function called during placement (after the initial placement is done)
83
80
if (!during_packing && new_clb_created) {
84
81
int imacro;
85
82
g_vpr_ctx.mutable_placement ().block_locs .resize (g_vpr_ctx.placement ().block_locs .size () + 1 );
@@ -166,6 +163,7 @@ bool start_new_cluster_for_mol(t_pack_molecule* molecule,
166
163
clb_index = cluster_ctx.clb_nlist .create_block (new_name.c_str (), pb, type);
167
164
helper_ctx.total_clb_num ++;
168
165
166
+ // If you are still in packing, update the clustering data. Otherwise, update the clustered netlist.
169
167
if (during_packing) {
170
168
clustering_data.intra_lb_routing .push_back ((*router_data)->saved_lb_nets );
171
169
(*router_data)->saved_lb_nets = nullptr ;
@@ -188,8 +186,8 @@ bool pack_mol_in_existing_cluster(t_pack_molecule* molecule,
188
186
const ClusterBlockId new_clb,
189
187
const std::vector<AtomBlockId>& new_clb_atoms,
190
188
bool during_packing,
191
- t_clustering_data& clustering_data,
192
189
bool is_swap,
190
+ t_clustering_data& clustering_data,
193
191
t_lb_router_data*& router_data) {
194
192
auto & helper_ctx = g_vpr_ctx.mutable_cl_helper ();
195
193
auto & cluster_ctx = g_vpr_ctx.mutable_clustering ();
@@ -204,7 +202,7 @@ bool pack_mol_in_existing_cluster(t_pack_molecule* molecule,
204
202
rebuild_cluster_placemet_stats (new_clb, new_clb_atoms, cluster_ctx.clb_nlist .block_type (new_clb)->index , cluster_ctx.clb_nlist .block_pb (new_clb)->mode );
205
203
206
204
// re-build router_data structure for this cluster
207
- if (!is_swap)
205
+ if (!is_swap)
208
206
router_data = lb_load_router_data (helper_ctx.lb_type_rr_graphs , new_clb, new_clb_atoms);
209
207
210
208
pack_result = try_pack_molecule (&(helper_ctx.cluster_placement_stats [block_type->index ]),
@@ -225,6 +223,7 @@ bool pack_mol_in_existing_cluster(t_pack_molecule* molecule,
225
223
226
224
// If clustering succeeds, add it to the clb netlist
227
225
if (pack_result == BLK_PASSED) {
226
+ // If you are still in packing, update the clustering data. Otherwise, update the clustered netlist.
228
227
if (during_packing) {
229
228
free_intra_lb_nets (clustering_data.intra_lb_routing [new_clb]);
230
229
clustering_data.intra_lb_routing [new_clb] = router_data->saved_lb_nets ;
@@ -235,12 +234,12 @@ bool pack_mol_in_existing_cluster(t_pack_molecule* molecule,
235
234
}
236
235
}
237
236
238
- if (pack_result == BLK_PASSED || !is_swap ) {
237
+ if (pack_result == BLK_PASSED || !is_swap) {
239
238
// Free clustering router data
240
239
free_router_data (router_data);
241
240
router_data = nullptr ;
242
241
}
243
-
242
+
244
243
return (pack_result == BLK_PASSED);
245
244
}
246
245
@@ -277,6 +276,7 @@ void revert_mol_move(const ClusterBlockId& old_clb,
277
276
temp_cluster_pr_original);
278
277
279
278
VTR_ASSERT (pack_result == BLK_PASSED);
279
+ // If you are still in packing, update the clustering data. Otherwise, update the clustered netlist.
280
280
if (during_packing) {
281
281
free_intra_lb_nets (clustering_data.intra_lb_routing [old_clb]);
282
282
clustering_data.intra_lb_routing [old_clb] = old_router_data->saved_lb_nets ;
@@ -384,8 +384,10 @@ static void fix_cluster_pins_after_moving(const ClusterBlockId clb_index) {
384
384
int iport, ipb_pin, ipin, rr_node_index;
385
385
386
386
ipin = 0 ;
387
+ // iterating over input ports
387
388
for (iport = 0 ; iport < num_input_ports; iport++) {
388
389
ClusterPortId input_port_id = cluster_ctx.clb_nlist .find_port (clb_index, block_type->pb_type ->ports [iport].name );
390
+ // iterating over physical block pins of each input port
389
391
for (ipb_pin = 0 ; ipb_pin < pb->pb_graph_node ->num_input_pins [iport]; ipb_pin++) {
390
392
pb_graph_pin = &pb->pb_graph_node ->input_pins [iport][ipb_pin];
391
393
rr_node_index = pb_graph_pin->pin_count_in_cluster ;
@@ -408,8 +410,10 @@ static void fix_cluster_pins_after_moving(const ClusterBlockId clb_index) {
408
410
}
409
411
}
410
412
413
+ // iterating over output ports
411
414
for (iport = 0 ; iport < num_output_ports; iport++) {
412
415
ClusterPortId output_port_id = cluster_ctx.clb_nlist .find_port (clb_index, block_type->pb_type ->ports [num_input_ports + iport].name );
416
+ // iterating over physical block pins of each output port
413
417
for (ipb_pin = 0 ; ipb_pin < pb->pb_graph_node ->num_output_pins [iport]; ipb_pin++) {
414
418
pb_graph_pin = &pb->pb_graph_node ->output_pins [iport][ipb_pin];
415
419
rr_node_index = pb_graph_pin->pin_count_in_cluster ;
@@ -437,8 +441,10 @@ static void fix_cluster_pins_after_moving(const ClusterBlockId clb_index) {
437
441
}
438
442
}
439
443
444
+ // iterating over clock ports
440
445
for (iport = 0 ; iport < num_clock_ports; iport++) {
441
446
ClusterPortId clock_port_id = cluster_ctx.clb_nlist .find_port (clb_index, block_type->pb_type ->ports [num_input_ports + num_output_ports + iport].name );
447
+ // iterating over physical block pins of each clock port
442
448
for (ipb_pin = 0 ; ipb_pin < pb->pb_graph_node ->num_clock_pins [iport]; ipb_pin++) {
443
449
pb_graph_pin = &pb->pb_graph_node ->clock_pins [iport][ipb_pin];
444
450
rr_node_index = pb_graph_pin->pin_count_in_cluster ;
@@ -651,6 +657,7 @@ void commit_mol_removal(const t_pack_molecule* molecule,
651
657
652
658
cleanup_pb (cluster_ctx.clb_nlist .block_pb (old_clb));
653
659
660
+ // If you are still in packing, update the clustering data. Otherwise, update the clustered netlist.
654
661
if (during_packing) {
655
662
free_intra_lb_nets (clustering_data.intra_lb_routing [old_clb]);
656
663
clustering_data.intra_lb_routing [old_clb] = router_data->saved_lb_nets ;
@@ -679,4 +686,4 @@ bool check_type_and_mode_compitability(const ClusterBlockId& old_clb,
679
686
}
680
687
681
688
return true ;
682
- }
689
+ }
0 commit comments