@@ -116,6 +116,8 @@ NetCostHandler::NetCostHandler(const t_placer_opts& placer_opts,
116
116
, placer_opts_(placer_opts) {
117
117
const int num_layers = g_vpr_ctx.device ().grid .get_num_layers ();
118
118
119
+ is_multi_layer_ = num_layers > 1 ;
120
+
119
121
// Either 3D BB or per layer BB data structure are used, not both.
120
122
if (cube_bb_) {
121
123
ts_bb_edge_new_.resize (num_nets, t_bb ());
@@ -229,7 +231,7 @@ void NetCostHandler::alloc_and_load_chan_w_factors_for_place_cost_() {
229
231
}
230
232
}
231
233
232
- if (device_ctx. grid . get_num_layers () > 1 ) {
234
+ if (is_multi_layer_ ) {
233
235
alloc_and_load_for_fast_vertical_cost_update_ ();
234
236
}
235
237
}
@@ -853,7 +855,7 @@ void NetCostHandler::update_bb_(ClusterNetId net_id,
853
855
}
854
856
855
857
/* Now account for the layer motion. */
856
- if (num_layers > 1 ) {
858
+ if (is_multi_layer_ ) {
857
859
/* We need to update it only if multiple layers are available */
858
860
for (int layer_num = 0 ; layer_num < num_layers; layer_num++) {
859
861
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) {
1469
1471
1470
1472
const t_bb& bb = use_ts ? ts_bb_coord_new_[net_id] : placer_state_.move ().bb_coords [net_id];
1471
1473
1472
- const bool is_multi_layer = (g_vpr_ctx.device ().grid .get_num_layers () > 1 );
1473
-
1474
1474
double crossing = wirelength_crossing_count (cluster_ctx.clb_nlist .net_pins (net_id).size ());
1475
1475
1476
1476
/* 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) {
1489
1489
double ncost;
1490
1490
ncost = (bb.xmax - bb.xmin + 1 ) * crossing * chanx_place_cost_fac_[bb.ymax ][bb.ymin - 1 ];
1491
1491
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_ ) {
1493
1493
ncost += (bb.layer_max - bb.layer_min ) * crossing * get_chanz_cost_factor_ (bb);
1494
1494
}
1495
1495
0 commit comments