Skip to content

Commit 7295447

Browse files
weigh sink block locations in centroid calculation
When averaging over the sinks connected to block, I use the inverse of the number of sinks driven by a net as weight
1 parent 355ba50 commit 7295447

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

vpr/src/place/initial_placement.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,9 @@ static std::vector<ClusterBlockId> find_centroid_loc(const t_pl_macro& pl_macro,
419419
if (cluster_ctx.clb_nlist.net_is_ignored(net_id)) {
420420
continue;
421421
}
422+
423+
float n_sinks_inv = 1.0f / (float)cluster_ctx.clb_nlist.net_sinks(net_id).size();
424+
422425
for (auto sink_pin_id : cluster_ctx.clb_nlist.net_sinks(net_id)) {
423426
/* Ignore if one of the sinks is the block itself*/
424427
if (pin_id == sink_pin_id)
@@ -435,9 +438,9 @@ static std::vector<ClusterBlockId> find_centroid_loc(const t_pl_macro& pl_macro,
435438
VTR_ASSERT(tile_loc.layer_num != OPEN);
436439
layer_count[tile_loc.layer_num]++;
437440
}
438-
acc_x += tile_loc.x;
439-
acc_y += tile_loc.y;
440-
acc_weight++;
441+
acc_x += (float)tile_loc.x * n_sinks_inv;
442+
acc_y += (float)tile_loc.y * n_sinks_inv;
443+
acc_weight += n_sinks_inv;
441444
}
442445
}
443446

0 commit comments

Comments
 (0)