Skip to content

Commit 014cda7

Browse files
authored
Merge pull request #2937 from verilog-to-routing/print_initial_placement_wl
Initial Placement Wirelength Est.
2 parents ba2c1dd + 080e533 commit 014cda7

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

vpr/src/place/net_cost_handler.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1625,6 +1625,20 @@ void NetCostHandler::recompute_costs_from_scratch(const PlaceDelayModel* delay_m
16251625
}
16261626
}
16271627

1628+
double NetCostHandler::get_total_wirelength_estimate() const {
1629+
const auto& clb_nlist = g_vpr_ctx.clustering().clb_nlist;
1630+
const auto& bb_coords = placer_state_.move().bb_coords;
1631+
1632+
double estimated_wirelength = 0.0;
1633+
for (ClusterNetId net_id : clb_nlist.nets()) { /* for each net ... */
1634+
if (!clb_nlist.net_is_ignored(net_id)) { /* Do only if not ignored. */
1635+
estimated_wirelength += get_net_wirelength_estimate(net_id, bb_coords[net_id]);
1636+
}
1637+
}
1638+
1639+
return estimated_wirelength;
1640+
}
1641+
16281642
void NetCostHandler::set_ts_bb_coord_(const ClusterNetId net_id) {
16291643
auto& place_move_ctx = placer_state_.mutable_move();
16301644
if (cube_bb_) {

vpr/src/place/net_cost_handler.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ class NetCostHandler {
121121
const PlacerCriticalities* criticalities,
122122
t_placer_costs& costs);
123123

124+
/**
125+
* @brief Get the total wirelength estimate of all nets.
126+
*/
127+
double get_total_wirelength_estimate() const;
128+
124129
private:
125130
///@brief Specifies whether the bounding box is computed using cube method or per-layer method.
126131
bool cube_bb_;

vpr/src/place/placement_log_printer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,9 @@ void PlacementLogPrinter::print_initial_placement_stats() const {
179179
VTR_LOG("Initial placement cost: %g bb_cost: %g td_cost: %g\n",
180180
costs.cost, costs.bb_cost, costs.timing_cost);
181181

182+
double wirelength = placer_.net_cost_handler_.get_total_wirelength_estimate();
183+
VTR_LOG("Initial placement BB estimate of wirelength: %g\n", wirelength);
184+
182185
if (placer_.noc_opts_.noc) {
183186
VTR_ASSERT(placer_.noc_cost_handler_.has_value());
184187
placer_.noc_cost_handler_->print_noc_costs("Initial NoC Placement Costs", costs, placer_.noc_opts_);

0 commit comments

Comments
 (0)