@@ -143,10 +143,14 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
143
143
ts_bb_edge_new_.resize (num_nets, t_bb ());
144
144
ts_bb_coord_new_.resize (num_nets, t_bb ());
145
145
comp_bb_cost_functor_ = std::bind (&NetCostHandler::comp_3d_bb_cost_, this , std::placeholders::_1);
146
+ update_bb_functor_ = std::bind (&NetCostHandler::update_bb_, this , std::placeholders::_1, std::placeholders::_2,
147
+ std::placeholders::_3, std::placeholders::_4);
146
148
} else {
147
149
layer_ts_bb_edge_new_.resize (num_nets, std::vector<t_2D_bb>(num_layers, t_2D_bb ()));
148
150
layer_ts_bb_coord_new_.resize (num_nets, std::vector<t_2D_bb>(num_layers, t_2D_bb ()));
149
151
comp_bb_cost_functor_ = std::bind (&NetCostHandler::comp_per_layer_bb_cost_, this , std::placeholders::_1);
152
+ update_bb_functor_ = std::bind (&NetCostHandler::update_layer_bb_, this , std::placeholders::_1, std::placeholders::_2,
153
+ std::placeholders::_3, std::placeholders::_4);
150
154
}
151
155
152
156
/* This initializes the whole matrix to OPEN which is an invalid value*/
@@ -363,14 +367,14 @@ void NetCostHandler::update_net_bb_(const ClusterNetId net,
363
367
bool is_driver = cluster_ctx.clb_nlist .pin_type (blk_pin) == PinType::DRIVER;
364
368
365
369
// Incremental bounding box update
366
- update_bb_ (net,
367
- {pl_moved_block.old_loc .x + pin_width_offset,
368
- pl_moved_block.old_loc .y + pin_height_offset,
369
- pl_moved_block.old_loc .layer },
370
- {pl_moved_block.new_loc .x + pin_width_offset,
371
- pl_moved_block.new_loc .y + pin_height_offset,
372
- pl_moved_block.new_loc .layer },
373
- is_driver);
370
+ update_bb_functor_ (net,
371
+ {pl_moved_block.old_loc .x + pin_width_offset,
372
+ pl_moved_block.old_loc .y + pin_height_offset,
373
+ pl_moved_block.old_loc .layer },
374
+ {pl_moved_block.new_loc .x + pin_width_offset,
375
+ pl_moved_block.new_loc .y + pin_height_offset,
376
+ pl_moved_block.new_loc .layer },
377
+ is_driver);
374
378
}
375
379
}
376
380
@@ -649,12 +653,9 @@ void NetCostHandler::get_non_updatable_layer_bb_(ClusterNetId net_id,
649
653
}
650
654
651
655
void NetCostHandler::update_bb_ (ClusterNetId net_id,
652
- t_bb& bb_edge_new,
653
- t_bb& bb_coord_new,
654
- vtr::NdMatrixProxy<int , 1 > num_sink_pin_layer_new,
655
- t_physical_tile_loc pin_old_loc,
656
- t_physical_tile_loc pin_new_loc,
657
- bool src_pin) {
656
+ t_physical_tile_loc pin_old_loc,
657
+ t_physical_tile_loc pin_new_loc,
658
+ bool src_pin) {
658
659
// TODO: account for multiple physical pin instances per logical pin
659
660
const t_bb *curr_bb_edge, *curr_bb_coord;
660
661
@@ -663,6 +664,10 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
663
664
664
665
const int num_layers = device_ctx.grid .get_num_layers ();
665
666
667
+ t_bb& bb_edge_new = ts_bb_edge_new_[net_id];
668
+ t_bb& bb_coord_new = ts_bb_coord_new_[net_id];
669
+ vtr::NdMatrixProxy<int , 1 > num_sink_pin_layer_new = ts_layer_sink_pin_count_[size_t (net_id)];
670
+
666
671
pin_new_loc.x = max (min<int >(pin_new_loc.x , device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
667
672
pin_new_loc.y = max (min<int >(pin_new_loc.y , device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
668
673
pin_new_loc.layer_num = max (min<int >(pin_new_loc.layer_num , device_ctx.grid .get_num_layers () - 1 ), 0 );
@@ -921,12 +926,9 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
921
926
}
922
927
923
928
void NetCostHandler::update_layer_bb_ (ClusterNetId net_id,
924
- std::vector<t_2D_bb>& bb_edge_new,
925
- std::vector<t_2D_bb>& bb_coord_new,
926
- vtr::NdMatrixProxy<int , 1 > bb_pin_sink_count_new,
927
- t_physical_tile_loc pin_old_loc,
928
- t_physical_tile_loc pin_new_loc,
929
- bool is_output_pin) {
929
+ t_physical_tile_loc pin_old_loc,
930
+ t_physical_tile_loc pin_new_loc,
931
+ bool is_output_pin) {
930
932
auto & device_ctx = g_vpr_ctx.device ();
931
933
auto & place_move_ctx = placer_ctx_.move ();
932
934
@@ -935,6 +937,10 @@ void NetCostHandler::update_layer_bb_(ClusterNetId net_id,
935
937
pin_old_loc.x = max (min<int >(pin_old_loc.x , device_ctx.grid .width () - 2 ), 1 ); // -2 for no perim channels
936
938
pin_old_loc.y = max (min<int >(pin_old_loc.y , device_ctx.grid .height () - 2 ), 1 ); // -2 for no perim channels
937
939
940
+ std::vector<t_2D_bb>& bb_edge_new = layer_ts_bb_edge_new_[net_id];
941
+ std::vector<t_2D_bb>& bb_coord_new = layer_ts_bb_coord_new_[net_id];
942
+ vtr::NdMatrixProxy<int , 1 > bb_pin_sink_count_new = ts_layer_sink_pin_count_[size_t (net_id)];
943
+
938
944
/* Check if the net had been updated before. */
939
945
if (bb_update_status_[net_id] == NetUpdateState::GOT_FROM_SCRATCH) {
940
946
/* The net had been updated from scratch, DO NOT update again! */
@@ -1753,32 +1759,10 @@ void NetCostHandler::get_non_updatable_bb_(const ClusterNetId net) {
1753
1759
}
1754
1760
}
1755
1761
1756
- void NetCostHandler::update_bb_ (ClusterNetId net_id, t_physical_tile_loc pin_old_loc, t_physical_tile_loc pin_new_loc, bool is_driver) {
1757
- if (cube_bb_) {
1758
- update_bb_ (net_id,
1759
- ts_bb_edge_new_[net_id],
1760
- ts_bb_coord_new_[net_id],
1761
- ts_layer_sink_pin_count_[size_t (net_id)],
1762
- pin_old_loc,
1763
- pin_new_loc,
1764
- is_driver);
1765
- }
1766
- else {
1767
- update_layer_bb_ (net_id,
1768
- layer_ts_bb_edge_new_[net_id],
1769
- layer_ts_bb_coord_new_[net_id],
1770
- ts_layer_sink_pin_count_[size_t (net_id)],
1771
- pin_old_loc,
1772
- pin_new_loc,
1773
- is_driver);
1774
- }
1775
- }
1776
-
1777
1762
double NetCostHandler::get_net_cost_ (const ClusterNetId net_id) {
1778
1763
if (cube_bb_) {
1779
1764
return get_net_cost_ (net_id, ts_bb_coord_new_[net_id]);
1780
- }
1781
- else {
1765
+ } else {
1782
1766
return get_net_layer_bb_wire_cost_ (net_id, layer_ts_bb_coord_new_[net_id], ts_layer_sink_pin_count_[size_t (net_id)]);
1783
1767
}
1784
1768
}
0 commit comments