@@ -193,11 +193,10 @@ static void update_td_delta_costs(const PlaceDelayModel* delay_model,
193
193
bool is_src_moving);
194
194
195
195
/* *
196
- * @brief if "net" is not already stored as an affected net, mark it in ts_nets_to_update and increment num_affected_nets
196
+ * @brief if "net" is not already stored as an affected net, mark it in ts_nets_to_update and increment the size ofts_nets_to_update.
197
197
* @param net ID of a net affected by a move
198
- * @param num_affected_nets Incremented if this is a new net affected, and returned via reference.
199
198
*/
200
- static void record_affected_net (const ClusterNetId net, int & num_affected_nets );
199
+ static void record_affected_net (const ClusterNetId net);
201
200
202
201
/* *
203
202
* @brief Call suitable function based on the bounding box type to update the bounding box of the net connected to pin_id. Also,
@@ -210,19 +209,17 @@ static void record_affected_net(const ClusterNetId net, int& num_affected_nets);
210
209
* @param moving_blk_inf Data structure that holds information, e.g., old location and new locatoin, about all moving blocks
211
210
* @param affected_pins Netlist pins which are affected, in terms placement cost, by the proposed move.
212
211
* @param timing_delta_c Timing cost change based on the proposed move
213
- * @param num_affected_nets A pointer to the first free element of ts_nets_to_update. If a new net is added, the pointer should be increamented.
214
212
* @param is_src_moving Is the moving pin the source of a net.
215
213
*/
216
- static void update_pl_net_cost_on_pin_move (const t_place_algorithm& place_algorithm,
217
- const PlaceDelayModel* delay_model,
218
- const PlacerCriticalities* criticalities,
219
- const ClusterBlockId& blk_id,
220
- const ClusterPinId& pin_id,
221
- const t_pl_moved_block& moving_blk_inf,
222
- std::vector<ClusterPinId>& affected_pins,
223
- double & timing_delta_c,
224
- int & num_affected_nets,
225
- bool is_src_moving);
214
+ static void update_net_info_on_pin_move (const t_place_algorithm& place_algorithm,
215
+ const PlaceDelayModel* delay_model,
216
+ const PlacerCriticalities* criticalities,
217
+ const ClusterBlockId& blk_id,
218
+ const ClusterPinId& pin_id,
219
+ const t_pl_moved_block& moving_blk_inf,
220
+ std::vector<ClusterPinId>& affected_pins,
221
+ double & timing_delta_c,
222
+ bool is_src_moving);
226
223
227
224
/* *
228
225
* @brief Update the 3D bounding box of "net_id" incrementally based on the old and new locations of a pin on that net
@@ -474,10 +471,9 @@ static double wirelength_crossing_count(size_t fanout);
474
471
/* *
475
472
* @brief Calculates and returns the total bb (wirelength) cost change that would result from moving the blocks
476
473
* indicated in the blocks_affected data structure.
477
- * @param num_affected_nets Number of valid elements in ts_bb_coord_new
478
474
* @param bb_delta_c Cost difference after and before moving the block
479
475
*/
480
- static void set_bb_delta_cost (const int num_affected_nets, double & bb_delta_c);
476
+ static void set_bb_delta_cost (double & bb_delta_c);
481
477
482
478
/* ****************************** End of Function definitions ************************************/
483
479
namespace {
@@ -701,29 +697,29 @@ static void update_td_delta_costs(const PlaceDelayModel* delay_model,
701
697
}
702
698
703
699
// /@brief Record effected nets.
704
- static void record_affected_net (const ClusterNetId net,
705
- int & num_affected_nets) {
700
+ static void record_affected_net (const ClusterNetId net) {
706
701
/* Record effected nets. */
707
702
if (pl_net_cost.proposed_net_cost [net] < 0 .) {
708
703
/* Net not marked yet. */
709
- ts_info.ts_nets_to_update [num_affected_nets] = net;
710
- num_affected_nets++;
704
+ size_t last_size = ts_info.ts_nets_to_update .size ();
705
+ VTR_ASSERT (last_size < ts_info.ts_nets_to_update .capacity ());
706
+ ts_info.ts_nets_to_update .resize (last_size + 1 );
707
+ ts_info.ts_nets_to_update [last_size] = net;
711
708
712
709
/* Flag to say we've marked this net. */
713
710
pl_net_cost.proposed_net_cost [net] = 1 .;
714
711
}
715
712
}
716
713
717
- static void update_pl_net_cost_on_pin_move (const t_place_algorithm& place_algorithm,
718
- const PlaceDelayModel* delay_model,
719
- const PlacerCriticalities* criticalities,
720
- const ClusterBlockId& blk_id,
721
- const ClusterPinId& pin_id,
722
- const t_pl_moved_block& moving_blk_inf,
723
- std::vector<ClusterPinId>& affected_pins,
724
- double & timing_delta_c,
725
- int & num_affected_nets,
726
- bool is_src_moving) {
714
+ static void update_net_info_on_pin_move (const t_place_algorithm& place_algorithm,
715
+ const PlaceDelayModel* delay_model,
716
+ const PlacerCriticalities* criticalities,
717
+ const ClusterBlockId& blk_id,
718
+ const ClusterPinId& pin_id,
719
+ const t_pl_moved_block& moving_blk_inf,
720
+ std::vector<ClusterPinId>& affected_pins,
721
+ double & timing_delta_c,
722
+ bool is_src_moving) {
727
723
const auto & cluster_ctx = g_vpr_ctx.clustering ();
728
724
const ClusterNetId net_id = cluster_ctx.clb_nlist .pin_net (pin_id);
729
725
VTR_ASSERT_SAFE_MSG (net_id,
@@ -736,7 +732,7 @@ static void update_pl_net_cost_on_pin_move(const t_place_algorithm& place_algori
736
732
}
737
733
738
734
/* Record effected nets */
739
- record_affected_net (net_id, num_affected_nets );
735
+ record_affected_net (net_id);
740
736
741
737
/* Update the net bounding boxes. */
742
738
update_net_bb (net_id, blk_id, pin_id, moving_blk_inf);
@@ -1897,8 +1893,8 @@ static double wirelength_crossing_count(size_t fanout) {
1897
1893
}
1898
1894
}
1899
1895
1900
- static void set_bb_delta_cost (const int num_affected_nets, double & bb_delta_c) {
1901
- for (int inet_affected = 0 ; inet_affected < num_affected_nets ;
1896
+ static void set_bb_delta_cost (double & bb_delta_c) {
1897
+ for (size_t inet_affected = 0 ; inet_affected < ts_info. ts_nets_to_update . size () ;
1902
1898
inet_affected++) {
1903
1899
ClusterNetId net_id = ts_info.ts_nets_to_update [inet_affected];
1904
1900
@@ -1908,7 +1904,7 @@ static void set_bb_delta_cost(const int num_affected_nets, double& bb_delta_c) {
1908
1904
}
1909
1905
}
1910
1906
1911
- int find_affected_nets_and_update_costs (
1907
+ void find_affected_nets_and_update_costs (
1912
1908
const t_place_algorithm& place_algorithm,
1913
1909
const PlaceDelayModel* delay_model,
1914
1910
const PlacerCriticalities* criticalities,
@@ -1919,7 +1915,7 @@ int find_affected_nets_and_update_costs(
1919
1915
VTR_ASSERT_SAFE (timing_delta_c == 0 .);
1920
1916
auto & clb_nlist = g_vpr_ctx.clustering ().clb_nlist ;
1921
1917
1922
- int num_affected_nets = 0 ;
1918
+ ts_info. ts_nets_to_update . resize ( 0 ) ;
1923
1919
1924
1920
/* Go through all the blocks moved. */
1925
1921
for (int iblk = 0 ; iblk < blocks_affected.num_moved_blocks ; iblk++) {
@@ -1936,24 +1932,21 @@ int find_affected_nets_and_update_costs(
1936
1932
blocks_affected.num_moved_blocks ,
1937
1933
blocks_affected.moved_blocks );
1938
1934
}
1939
- update_pl_net_cost_on_pin_move (place_algorithm,
1940
- delay_model,
1941
- criticalities,
1942
- blk,
1943
- blk_pin,
1944
- moving_block_inf,
1945
- affected_pins,
1946
- timing_delta_c,
1947
- num_affected_nets,
1948
- is_src_moving);
1935
+ update_net_info_on_pin_move (place_algorithm,
1936
+ delay_model,
1937
+ criticalities,
1938
+ blk,
1939
+ blk_pin,
1940
+ moving_block_inf,
1941
+ affected_pins,
1942
+ timing_delta_c,
1943
+ is_src_moving);
1949
1944
}
1950
1945
}
1951
1946
1952
1947
/* Now update the bounding box costs (since the net bounding *
1953
1948
* boxes are up-to-date). The cost is only updated once per net. */
1954
- set_bb_delta_cost (num_affected_nets, bb_delta_c);
1955
-
1956
- return num_affected_nets;
1949
+ set_bb_delta_cost (bb_delta_c);
1957
1950
}
1958
1951
1959
1952
double comp_bb_cost (e_cost_methods method) {
@@ -2034,12 +2027,12 @@ double comp_layer_bb_cost(e_cost_methods method) {
2034
2027
return cost;
2035
2028
}
2036
2029
2037
- void update_move_nets (int num_nets_affected ) {
2030
+ void update_move_nets () {
2038
2031
/* update net cost functions and reset flags. */
2039
2032
auto & cluster_ctx = g_vpr_ctx.clustering ();
2040
2033
auto & place_move_ctx = g_placer_ctx.mutable_move ();
2041
2034
2042
- for (int inet_affected = 0 ; inet_affected < num_nets_affected ;
2035
+ for (size_t inet_affected = 0 ; inet_affected < ts_info. ts_nets_to_update . size () ;
2043
2036
inet_affected++) {
2044
2037
ClusterNetId net_id = ts_info.ts_nets_to_update [inet_affected];
2045
2038
@@ -2061,9 +2054,9 @@ void update_move_nets(int num_nets_affected) {
2061
2054
}
2062
2055
}
2063
2056
2064
- void reset_move_nets (int num_nets_affected ) {
2057
+ void reset_move_nets () {
2065
2058
/* Reset the net cost function flags first. */
2066
- for (int inet_affected = 0 ; inet_affected < num_nets_affected ;
2059
+ for (size_t inet_affected = 0 ; inet_affected < ts_info. ts_nets_to_update . size () ;
2067
2060
inet_affected++) {
2068
2061
ClusterNetId net_id = ts_info.ts_nets_to_update [inet_affected];
2069
2062
pl_net_cost.proposed_net_cost [net_id] = -1 ;
0 commit comments