Skip to content

Commit

Permalink
mpl2: add method for clearing
Browse files Browse the repository at this point in the history
Signed-off-by: Arthur Koucher <arthurckoucher@gmail.com>
  • Loading branch information
AcKoucher committed Nov 13, 2023
1 parent e45cf10 commit e5521bf
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/mpl2/src/Mpl2Observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class Mpl2Observer
virtual void setMacroBlockagePenalty(float macro_blockage_penalty) {}
virtual void setNotchPenalty(float notch_penalty) {}
virtual void penaltyCalculated(float norm_cost) {}

virtual void clearObserver() {}
};

} // namespace mpl2
23 changes: 18 additions & 5 deletions src/mpl2/src/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,12 +246,12 @@ void Graphics::drawObjects(gui::Painter& painter)
painter.setPen(gui::Painter::red, true);
painter.setBrush(gui::Painter::transparent);
drawCluster(root_, painter);
}

if (!macro_blockages_.empty()) {
painter.setPen(gui::Painter::gray, true);
painter.setBrush(gui::Painter::gray, gui::Painter::DIAGONAL);
drawBlockages(painter);
}
if (!macro_blockages_.empty()) {
painter.setPen(gui::Painter::gray, true);
painter.setBrush(gui::Painter::gray, gui::Painter::DIAGONAL);
drawBlockages(painter);
}

painter.setPen(gui::Painter::yellow, true);
Expand Down Expand Up @@ -356,4 +356,17 @@ void Graphics::setHardMacroClusterLocation(
hard_macro_cluster_pos_ = hard_macro_cluster_pos;
}

void Graphics::clearObserver()
{
root_ = nullptr;

soft_macros_.clear();
hard_macros_.clear();
macro_blockages_.clear();
parent_locations_.clear();

outline_height_.reset();
outline_width_.reset();
}

} // namespace mpl2
2 changes: 2 additions & 0 deletions src/mpl2/src/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class Graphics : public gui::Renderer, public Mpl2Observer
void setHardMacroClusterLocation(
const odb::Point& hard_macro_cluster_pos) override;

void clearObserver() override;

private:
void resetPenalties();
void drawCluster(Cluster* cluster, gui::Painter& painter);
Expand Down
4 changes: 4 additions & 0 deletions src/mpl2/src/hier_rtlmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -679,6 +679,10 @@ void HierRTLMP::hierRTLMacroPlacer()
}
cluster_map_.clear();

if (graphics_) {
graphics_->clearObserver();
}

logger_->report("number of updated macros : {}", num_updated_macros_);
logger_->report("number of macros in HardMacroCluster : {}",
num_hard_macros_cluster_);
Expand Down

0 comments on commit e5521bf

Please sign in to comment.