Skip to content

Commit

Permalink
Merge pull request The-OpenROAD-Project#4661 from AcKoucher/mpl2_debu…
Browse files Browse the repository at this point in the history
…gger

mpl2: use different color for different types of clusters in debug
  • Loading branch information
maliberty authored Feb 13, 2024
2 parents 403ca0a + 4147448 commit 99cd628
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
28 changes: 26 additions & 2 deletions src/mpl2/src/graphics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,12 @@ void Graphics::drawObjects(gui::Painter& painter)
drawAllBlockages(painter);
}

painter.setPen(gui::Painter::yellow, true);
painter.setBrush(gui::Painter::gray);
painter.setPen(gui::Painter::white, true);

int i = 0;
for (const auto& macro : soft_macros_) {
setSoftMacroBrush(painter, macro);

const int lx = dbu_ * macro.getX();
const int ly = dbu_ * macro.getY();
const int ux = lx + dbu_ * macro.getWidth();
Expand All @@ -274,6 +275,9 @@ void Graphics::drawObjects(gui::Painter& painter)
std::to_string(i++));
}

painter.setPen(gui::Painter::white, true);
painter.setBrush(gui::Painter::dark_red);

i = 0;
for (const auto& macro : hard_macros_) {
const int lx = dbu_ * macro.getX();
Expand Down Expand Up @@ -337,6 +341,26 @@ void Graphics::drawObjects(gui::Painter& painter)
}
}

// Give some transparency to mixed and hard so we can see overlap with
// macro blockages.
void Graphics::setSoftMacroBrush(gui::Painter& painter,
const SoftMacro& soft_macro)
{
if (soft_macro.getCluster() == nullptr) { // fixed terminals
return;
}

if (soft_macro.getCluster()->getClusterType() == StdCellCluster) {
painter.setBrush(gui::Painter::dark_blue);
} else if (soft_macro.getCluster()->getClusterType() == HardMacroCluster) {
// dark red
painter.setBrush(gui::Painter::Color(0x80, 0x00, 0x00, 150));
} else {
// dark purple
painter.setBrush(gui::Painter::Color(0x80, 0x00, 0x80, 150));
}
}

void Graphics::setMacroBlockages(const std::vector<mpl2::Rect>& macro_blockages)
{
macro_blockages_ = macro_blockages;
Expand Down
1 change: 1 addition & 0 deletions src/mpl2/src/graphics.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class Graphics : public gui::Renderer, public Mpl2Observer
void drawCluster(Cluster* cluster, gui::Painter& painter);
void drawAllBlockages(gui::Painter& painter);
void drawBlockage(const Rect& blockage, gui::Painter& painter);
void setSoftMacroBrush(gui::Painter& painter, const SoftMacro& soft_macro);

template <typename T>
void report(const char* name, const std::optional<T>& value);
Expand Down

0 comments on commit 99cd628

Please sign in to comment.