@@ -193,11 +193,10 @@ static void update_td_delta_costs(const PlaceDelayModel* delay_model,
193193 bool is_src_moving);
194194
195195/* *
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.
197197 * @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.
199198 */
200- static void record_affected_net (const ClusterNetId net, int & num_affected_nets );
199+ static void record_affected_net (const ClusterNetId net);
201200
202201/* *
203202 * @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);
210209 * @param moving_blk_inf Data structure that holds information, e.g., old location and new locatoin, about all moving blocks
211210 * @param affected_pins Netlist pins which are affected, in terms placement cost, by the proposed move.
212211 * @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.
214212 * @param is_src_moving Is the moving pin the source of a net.
215213 */
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);
226223
227224/* *
228225 * @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);
474471/* *
475472 * @brief Calculates and returns the total bb (wirelength) cost change that would result from moving the blocks
476473 * indicated in the blocks_affected data structure.
477- * @param num_affected_nets Number of valid elements in ts_bb_coord_new
478474 * @param bb_delta_c Cost difference after and before moving the block
479475 */
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);
481477
482478/* ****************************** End of Function definitions ************************************/
483479namespace {
@@ -701,29 +697,29 @@ static void update_td_delta_costs(const PlaceDelayModel* delay_model,
701697}
702698
703699// /@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) {
706701 /* Record effected nets. */
707702 if (pl_net_cost.proposed_net_cost [net] < 0 .) {
708703 /* 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;
711708
712709 /* Flag to say we've marked this net. */
713710 pl_net_cost.proposed_net_cost [net] = 1 .;
714711 }
715712}
716713
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) {
727723 const auto & cluster_ctx = g_vpr_ctx.clustering ();
728724 const ClusterNetId net_id = cluster_ctx.clb_nlist .pin_net (pin_id);
729725 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
736732 }
737733
738734 /* Record effected nets */
739- record_affected_net (net_id, num_affected_nets );
735+ record_affected_net (net_id);
740736
741737 /* Update the net bounding boxes. */
742738 update_net_bb (net_id, blk_id, pin_id, moving_blk_inf);
@@ -1897,8 +1893,8 @@ static double wirelength_crossing_count(size_t fanout) {
18971893 }
18981894}
18991895
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 () ;
19021898 inet_affected++) {
19031899 ClusterNetId net_id = ts_info.ts_nets_to_update [inet_affected];
19041900
@@ -1908,7 +1904,7 @@ static void set_bb_delta_cost(const int num_affected_nets, double& bb_delta_c) {
19081904 }
19091905}
19101906
1911- int find_affected_nets_and_update_costs (
1907+ void find_affected_nets_and_update_costs (
19121908 const t_place_algorithm& place_algorithm,
19131909 const PlaceDelayModel* delay_model,
19141910 const PlacerCriticalities* criticalities,
@@ -1919,7 +1915,7 @@ int find_affected_nets_and_update_costs(
19191915 VTR_ASSERT_SAFE (timing_delta_c == 0 .);
19201916 auto & clb_nlist = g_vpr_ctx.clustering ().clb_nlist ;
19211917
1922- int num_affected_nets = 0 ;
1918+ ts_info. ts_nets_to_update . resize ( 0 ) ;
19231919
19241920 /* Go through all the blocks moved. */
19251921 for (int iblk = 0 ; iblk < blocks_affected.num_moved_blocks ; iblk++) {
@@ -1936,24 +1932,21 @@ int find_affected_nets_and_update_costs(
19361932 blocks_affected.num_moved_blocks ,
19371933 blocks_affected.moved_blocks );
19381934 }
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);
19491944 }
19501945 }
19511946
19521947 /* Now update the bounding box costs (since the net bounding *
19531948 * 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);
19571950}
19581951
19591952double comp_bb_cost (e_cost_methods method) {
@@ -2034,12 +2027,12 @@ double comp_layer_bb_cost(e_cost_methods method) {
20342027 return cost;
20352028}
20362029
2037- void update_move_nets (int num_nets_affected ) {
2030+ void update_move_nets () {
20382031 /* update net cost functions and reset flags. */
20392032 auto & cluster_ctx = g_vpr_ctx.clustering ();
20402033 auto & place_move_ctx = g_placer_ctx.mutable_move ();
20412034
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 () ;
20432036 inet_affected++) {
20442037 ClusterNetId net_id = ts_info.ts_nets_to_update [inet_affected];
20452038
@@ -2061,9 +2054,9 @@ void update_move_nets(int num_nets_affected) {
20612054 }
20622055}
20632056
2064- void reset_move_nets (int num_nets_affected ) {
2057+ void reset_move_nets () {
20652058 /* 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 () ;
20672060 inet_affected++) {
20682061 ClusterNetId net_id = ts_info.ts_nets_to_update [inet_affected];
20692062 pl_net_cost.proposed_net_cost [net_id] = -1 ;
0 commit comments