Skip to content

Commit c80a771

Browse files
authored
Merge pull request #10063 from The-OpenROAD-Project-staging/mpl-coverity-issue
mpl: avoid division by zero in soft blockage penalty calculation
2 parents 1ba5703 + 14d6c41 commit c80a771

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/mpl/src/SACoreSoftMacro.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,9 @@ void SACoreSoftMacro::calSoftBlockagePenalty()
498498
for (const odb::Rect& blockage : soft_blockages_) {
499499
for (const int macro_id : pos_seq_) {
500500
const SoftMacro& soft_macro = macros_[macro_id];
501-
if (soft_macro.getNumMacro() > 0) {
501+
Cluster* cluster = soft_macro.getCluster();
502+
503+
if (soft_macro.getNumMacro() > 0 && cluster->getArea() > 0) {
502504
odb::Rect overlap;
503505
blockage.intersection(soft_macro.getBBox(), overlap);
504506

@@ -507,7 +509,6 @@ void SACoreSoftMacro::calSoftBlockagePenalty()
507509
continue;
508510
}
509511

510-
Cluster* cluster = soft_macro.getCluster();
511512
const float macro_dominance
512513
= cluster->getMacroArea() / static_cast<float>(cluster->getArea());
513514

0 commit comments

Comments
 (0)