@@ -129,9 +129,13 @@ static double wirelength_crossing_count(size_t fanout);
129
129
/* ****************************** End of Function definitions ************************************/
130
130
131
131
132
- NetCostHandler::NetCostHandler (PlacerContext& placer_ctx, size_t num_nets, bool cube_bb, float place_cost_exp)
132
+ NetCostHandler::NetCostHandler (const t_placer_opts& placer_opts,
133
+ PlacerContext& placer_ctx,
134
+ size_t num_nets,
135
+ bool cube_bb)
133
136
: cube_bb_(cube_bb)
134
- , placer_ctx_(placer_ctx) {
137
+ , placer_ctx_(placer_ctx)
138
+ , placer_opts_(placer_opts) {
135
139
const int num_layers = g_vpr_ctx.device ().grid .get_num_layers ();
136
140
137
141
// Either 3D BB or per layer BB data structure are used, not both.
@@ -159,7 +163,7 @@ NetCostHandler::NetCostHandler(PlacerContext& placer_ctx, size_t num_nets, bool
159
163
* been recomputed. */
160
164
bb_update_status_.resize (num_nets, NetUpdateState::NOT_UPDATED_YET);
161
165
162
- alloc_and_load_chan_w_factors_for_place_cost_ (place_cost_exp);
166
+ alloc_and_load_chan_w_factors_for_place_cost_ (placer_opts_. place_cost_exp );
163
167
}
164
168
165
169
void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_ (float place_cost_exp) {
@@ -1500,24 +1504,20 @@ double NetCostHandler::get_net_cost_(ClusterNetId net_id, const t_bb& bb) {
1500
1504
double NetCostHandler::get_net_layer_bb_wire_cost_ (ClusterNetId /* net_id */ ,
1501
1505
const std::vector<t_2D_bb>& bb,
1502
1506
const vtr::NdMatrixProxy<int , 1 > layer_pin_sink_count) {
1503
- /* Finds the cost due to one net by looking at its coordinate bounding *
1504
- * box. */
1507
+ // Finds the cost due to one net by looking at its coordinate bounding box.
1505
1508
1506
1509
double ncost = 0 .;
1507
- double crossing = 0 .;
1508
1510
int num_layers = g_vpr_ctx.device ().grid .get_num_layers ();
1509
1511
1510
1512
for (int layer_num = 0 ; layer_num < num_layers; layer_num++) {
1511
1513
VTR_ASSERT (layer_pin_sink_count[layer_num] != OPEN);
1512
1514
if (layer_pin_sink_count[layer_num] == 0 ) {
1513
1515
continue ;
1514
1516
}
1515
- /*
1516
- adjust the bounding box half perimeter by the wirelength correction
1517
- factor based on terminal count, which is 1 for the source + the number
1518
- of sinks on this layer.
1519
- */
1520
- crossing = wirelength_crossing_count (layer_pin_sink_count[layer_num] + 1 );
1517
+ /* Adjust the bounding box half perimeter by the wirelength correction
1518
+ * factor based on terminal count, which is 1 for the source + the number
1519
+ * of sinks on this layer. */
1520
+ double crossing = wirelength_crossing_count (layer_pin_sink_count[layer_num] + 1 );
1521
1521
1522
1522
/* Could insert a check for xmin == xmax. In that case, assume *
1523
1523
* connection will be made with no bends and hence no x-cost. *
@@ -1533,7 +1533,7 @@ double NetCostHandler::get_net_layer_bb_wire_cost_(ClusterNetId /* net_id */,
1533
1533
* chany_place_cost_fac_[bb[layer_num].xmax ][bb[layer_num].xmin - 1 ];
1534
1534
}
1535
1535
1536
- return ( ncost) ;
1536
+ return ncost;
1537
1537
}
1538
1538
1539
1539
static double get_net_wirelength_estimate (ClusterNetId net_id, const t_bb& bb) {
@@ -1562,15 +1562,14 @@ static double get_net_wirelength_from_layer_bb(ClusterNetId /* net_id */,
1562
1562
* its coordinate bounding box. */
1563
1563
1564
1564
double ncost = 0 .;
1565
- double crossing = 0 .;
1566
- int num_layers = g_vpr_ctx.device ().grid .get_num_layers ();
1565
+ const int num_layers = g_vpr_ctx.device ().grid .get_num_layers ();
1567
1566
1568
1567
for (int layer_num = 0 ; layer_num < num_layers; layer_num++) {
1569
1568
VTR_ASSERT_SAFE (layer_pin_sink_count[layer_num] != OPEN);
1570
1569
if (layer_pin_sink_count[layer_num] == 0 ) {
1571
1570
continue ;
1572
1571
}
1573
- crossing = wirelength_crossing_count (layer_pin_sink_count[layer_num] + 1 );
1572
+ double crossing = wirelength_crossing_count (layer_pin_sink_count[layer_num] + 1 );
1574
1573
1575
1574
/* Could insert a check for xmin == xmax. In that case, assume *
1576
1575
* connection will be made with no bends and hence no x-cost. *
@@ -1580,11 +1579,10 @@ static double get_net_wirelength_from_layer_bb(ClusterNetId /* net_id */,
1580
1579
* channel capacity. Do this for x, then y direction and add. */
1581
1580
1582
1581
ncost += (bb[layer_num].xmax - bb[layer_num].xmin + 1 ) * crossing;
1583
-
1584
1582
ncost += (bb[layer_num].ymax - bb[layer_num].ymin + 1 ) * crossing;
1585
1583
}
1586
1584
1587
- return ( ncost) ;
1585
+ return ncost;
1588
1586
}
1589
1587
1590
1588
double NetCostHandler::recompute_bb_cost_ () {
@@ -1636,10 +1634,9 @@ void NetCostHandler::find_affected_nets_and_update_costs(const t_place_algorithm
1636
1634
ts_nets_to_update_.resize (0 );
1637
1635
1638
1636
/* Go through all the blocks moved. */
1639
- for (const auto & block : blocks_affected.moved_blocks ) {
1640
- const auto & moving_block_inf = block;
1637
+ for (const t_pl_moved_block& moving_block : blocks_affected.moved_blocks ) {
1641
1638
auto & affected_pins = blocks_affected.affected_pins ;
1642
- ClusterBlockId blk = block .block_num ;
1639
+ ClusterBlockId blk = moving_block .block_num ;
1643
1640
1644
1641
/* Go through all the pins in the moved block. */
1645
1642
for (ClusterPinId blk_pin : clb_nlist.block_pins (blk)) {
@@ -1653,7 +1650,7 @@ void NetCostHandler::find_affected_nets_and_update_costs(const t_place_algorithm
1653
1650
criticalities,
1654
1651
blk,
1655
1652
blk_pin,
1656
- moving_block_inf ,
1653
+ moving_block ,
1657
1654
affected_pins,
1658
1655
timing_delta_c,
1659
1656
is_src_moving);
0 commit comments