@@ -416,12 +416,17 @@ void SACoreSoftMacro::calBoundaryPenalty()
416416 return ;
417417 }
418418
419- int tot_num_macros = 0 ;
419+ int number_of_movable_macros = 0 ;
420420 for (const auto & macro_id : pos_seq_) {
421- tot_num_macros += macros_[macro_id].getNumMacro ();
421+ const SoftMacro& soft_macro = macros_[macro_id];
422+ if (soft_macro.isFixed ()) {
423+ continue ;
424+ }
425+
426+ number_of_movable_macros += soft_macro.getNumMacro ();
422427 }
423428
424- if (tot_num_macros < = 0 ) {
429+ if (number_of_movable_macros = = 0 ) {
425430 return ;
426431 }
427432
@@ -430,23 +435,28 @@ void SACoreSoftMacro::calBoundaryPenalty()
430435 float x_dist_from_root = 0 .0f , y_dist_from_root = 0 .0f ;
431436
432437 for (const auto & macro_id : pos_seq_) {
433- if (macros_[macro_id].getNumMacro () > 0 ) {
434- global_lx = macros_[macro_id].getX () + outline_.xMin () - root_->getX ();
435- global_ly = macros_[macro_id].getY () + outline_.yMin () - root_->getY ();
436- global_ux = global_lx + macros_[macro_id].getWidth ();
437- global_uy = global_ly + macros_[macro_id].getHeight ();
438+ const SoftMacro& soft_macro = macros_[macro_id];
439+ if (soft_macro.isFixed ()) {
440+ continue ;
441+ }
442+
443+ if (soft_macro.getNumMacro () > 0 ) {
444+ global_lx = soft_macro.getX () + outline_.xMin () - root_->getX ();
445+ global_ly = soft_macro.getY () + outline_.yMin () - root_->getY ();
446+ global_ux = global_lx + soft_macro.getWidth ();
447+ global_uy = global_ly + soft_macro.getHeight ();
438448
439449 x_dist_from_root
440450 = std::min (global_lx, std::abs (root_->getWidth () - global_ux));
441451 y_dist_from_root
442452 = std::min (global_ly, std::abs (root_->getHeight () - global_uy));
443453
444454 boundary_penalty_ += std::min (x_dist_from_root, y_dist_from_root)
445- * macros_[macro_id] .getNumMacro ();
455+ * soft_macro .getNumMacro ();
446456 }
447457 }
448458 // normalization
449- boundary_penalty_ = boundary_penalty_ / tot_num_macros ;
459+ boundary_penalty_ = boundary_penalty_ / number_of_movable_macros ;
450460 if (graphics_) {
451461 graphics_->setBoundaryPenalty ({" Boundary" ,
452462 boundary_weight_,
0 commit comments