@@ -116,6 +116,8 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
116116 , placer_opts_(placer_opts) {
117117 const int num_layers = g_vpr_ctx.device ().grid .get_num_layers ();
118118
119+ is_multi_layer_ = num_layers > 1 ;
120+
119121 // Either 3D BB or per layer BB data structure are used, not both.
120122 if (cube_bb_) {
121123 ts_bb_edge_new_.resize (num_nets, t_bb ());
@@ -229,7 +231,7 @@ void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_() {
229231 }
230232 }
231233
232- if (device_ctx. grid . get_num_layers () > 1 ) {
234+ if (is_multi_layer_ ) {
233235 alloc_and_load_for_fast_vertical_cost_update_ ();
234236 }
235237}
@@ -853,7 +855,7 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
853855 }
854856
855857 /* Now account for the layer motion. */
856- if (num_layers > 1 ) {
858+ if (is_multi_layer_ ) {
857859 /* We need to update it only if multiple layers are available */
858860 for (int layer_num = 0 ; layer_num < num_layers; layer_num++) {
859861 num_sink_pin_layer_new[layer_num] = curr_num_sink_pin_layer[layer_num];
@@ -1469,8 +1471,6 @@ double NetCostHandler::get_net_cube_bb_cost_(ClusterNetId net_id, bool use_ts) {
14691471
14701472 const t_bb& bb = use_ts ? ts_bb_coord_new_[net_id] : placer_state_.move ().bb_coords [net_id];
14711473
1472- const bool is_multi_layer = (g_vpr_ctx.device ().grid .get_num_layers () > 1 );
1473-
14741474 double crossing = wirelength_crossing_count (cluster_ctx.clb_nlist .net_pins (net_id).size ());
14751475
14761476 /* Could insert a check for xmin == xmax. In that case, assume *
@@ -1489,7 +1489,7 @@ double NetCostHandler::get_net_cube_bb_cost_(ClusterNetId net_id, bool use_ts) {
14891489 double ncost;
14901490 ncost = (bb.xmax - bb.xmin + 1 ) * crossing * chanx_place_cost_fac_[bb.ymax ][bb.ymin - 1 ];
14911491 ncost += (bb.ymax - bb.ymin + 1 ) * crossing * chany_place_cost_fac_[bb.xmax ][bb.xmin - 1 ];
1492- if (is_multi_layer ) {
1492+ if (is_multi_layer_ ) {
14931493 ncost += (bb.layer_max - bb.layer_min ) * crossing * get_chanz_cost_factor_ (bb);
14941494 }
14951495
0 commit comments