Skip to content

Commit f0ebc7e

Browse files
committed
mpl: fix coverage errors
Signed-off-by: João Mai <[email protected]>
1 parent 5e8f15c commit f0ebc7e

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

src/mpl/src/SACoreSoftMacro.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,8 @@ void SACoreSoftMacro::calMacroBlockagePenalty()
499499
for (const auto& macro_id : pos_seq_) {
500500
const SoftMacro& soft_macro = macros_[macro_id];
501501
if (soft_macro.getNumMacro() > 0) {
502-
odb::Rect overlap = blockage.intersect(soft_macro.getBBox());
502+
odb::Rect overlap;
503+
blockage.intersection(soft_macro.getBBox(), overlap);
503504

504505
// If any of the dimensions is negative, then there's no overlap.
505506
if (overlap.dx() < 0 || overlap.dy() < 0) {
@@ -542,7 +543,8 @@ void SACoreSoftMacro::calFixedMacrosPenalty()
542543
continue;
543544
}
544545

545-
odb::Rect overlap = fixed_macro.intersect(macro.getBBox());
546+
odb::Rect overlap;
547+
fixed_macro.intersection(macro.getBBox(), overlap);
546548

547549
// If any of the dimensions is negative, then there's no overlap.
548550
if (overlap.dx() < 0 || overlap.dy() < 0) {

src/mpl/src/SimulatedAnnealingCore.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,8 @@ void SimulatedAnnealingCore<T>::calGuidancePenalty()
418418
}
419419

420420
for (const auto& [id, guide] : guides_) {
421-
const odb::Rect overlap = macros_[id].getBBox().intersect(guide);
421+
odb::Rect overlap;
422+
macros_[id].getBBox().intersection(guide, overlap);
422423

423424
// maximum overlap area
424425
int64_t penalty

src/mpl/src/hier_rtlmp.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,8 +1424,8 @@ void HierRTLMP::placeChildren(Cluster* parent, bool ignore_std_cell_area)
14241424
}
14251425
}
14261426

1427-
fence = fence.intersect(outline);
1428-
guide = guide.intersect(outline);
1427+
fence.intersection(outline, fence);
1428+
guide.intersection(outline, guide);
14291429

14301430
if (!fence.isInverted()) {
14311431
// current macro id is macros.size() - 1
@@ -2293,12 +2293,12 @@ void HierRTLMP::computeFencesAndGuides(
22932293
{
22942294
for (int i = 0; i < hard_macros.size(); ++i) {
22952295
if (fences_.find(hard_macros[i]->getName()) != fences_.end()) {
2296-
fences[i] = fences_[hard_macros[i]->getName()].intersect(outline);
2296+
fences_[hard_macros[i]->getName()].intersection(outline, fences[i]);
22972297
fences[i].moveDelta(-outline.xMin(), -outline.yMin());
22982298
}
22992299
auto itr = guides_.find(hard_macros[i]->getInst());
23002300
if (itr != guides_.end()) {
2301-
guides[i] = itr->second.intersect(outline);
2301+
itr->second.intersection(outline, guides[i]);
23022302
guides[i].moveDelta(-outline.xMin(), -outline.yMin());
23032303
}
23042304
}

src/mpl/src/object.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ SoftMacro::SoftMacro(utl::Logger* logger,
906906
odb::Rect hard_macro_bbox = hard_macro->getBBox();
907907

908908
if (outline) {
909-
shape = hard_macro_bbox.intersect(*outline);
909+
hard_macro_bbox.intersection(*outline, shape);
910910
shape.moveDelta(-outline->xMin(), -outline->yMin());
911911
} else {
912912
shape = hard_macro_bbox;

0 commit comments

Comments
 (0)