From f43ba63e612319ee35a9cb05fca5fb5286755e46 Mon Sep 17 00:00:00 2001 From: Arthur Koucher Date: Mon, 12 Feb 2024 16:09:33 -0300 Subject: [PATCH 1/5] mpl2: make different cluster types have different colors in debug Signed-off-by: Arthur Koucher --- src/mpl2/src/graphics.cpp | 27 ++++++++++++++++++++++++--- src/mpl2/src/graphics.h | 1 + 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/src/mpl2/src/graphics.cpp b/src/mpl2/src/graphics.cpp index 4a2ec91c190..95cfaeb18aa 100644 --- a/src/mpl2/src/graphics.cpp +++ b/src/mpl2/src/graphics.cpp @@ -244,7 +244,7 @@ void Graphics::drawBlockage(const Rect& blockage, gui::Painter& painter) void Graphics::drawObjects(gui::Painter& painter) { if (root_) { - painter.setPen(gui::Painter::red, true); + painter.setPen(gui::Painter::yellow, true); painter.setBrush(gui::Painter::transparent); drawCluster(root_, painter); } @@ -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(); @@ -274,6 +275,10 @@ void Graphics::drawObjects(gui::Painter& painter) std::to_string(i++)); } + painter.setPen(gui::Painter::white, true); + // dark red + painter.setBrush(gui::Painter::Color(0x80, 0x00, 0x00, 150)); + i = 0; for (const auto& macro : hard_macros_) { const int lx = dbu_ * macro.getX(); @@ -337,6 +342,22 @@ 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()->getClusterType() == StdCellCluster) { + // dark blue + painter.setBrush(gui::Painter::Color(0x00, 0x00, 0x80, 255)); + } 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& macro_blockages) { macro_blockages_ = macro_blockages; diff --git a/src/mpl2/src/graphics.h b/src/mpl2/src/graphics.h index c9549bb5a0c..52adf500a86 100644 --- a/src/mpl2/src/graphics.h +++ b/src/mpl2/src/graphics.h @@ -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 void report(const char* name, const std::optional& value); From cb443db5bdd2ab5654421de4bec3b432003c4fb9 Mon Sep 17 00:00:00 2001 From: Arthur Koucher Date: Mon, 12 Feb 2024 17:40:52 -0300 Subject: [PATCH 2/5] mpl2: switch cluster color back to red / format Signed-off-by: Arthur Koucher --- src/mpl2/src/graphics.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mpl2/src/graphics.cpp b/src/mpl2/src/graphics.cpp index 95cfaeb18aa..4cd64bb7c94 100644 --- a/src/mpl2/src/graphics.cpp +++ b/src/mpl2/src/graphics.cpp @@ -244,7 +244,7 @@ void Graphics::drawBlockage(const Rect& blockage, gui::Painter& painter) void Graphics::drawObjects(gui::Painter& painter) { if (root_) { - painter.setPen(gui::Painter::yellow, true); + painter.setPen(gui::Painter::red, true); painter.setBrush(gui::Painter::transparent); drawCluster(root_, painter); } @@ -276,7 +276,7 @@ void Graphics::drawObjects(gui::Painter& painter) } painter.setPen(gui::Painter::white, true); - // dark red + // dark red painter.setBrush(gui::Painter::Color(0x80, 0x00, 0x00, 150)); i = 0; @@ -344,7 +344,8 @@ 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) +void Graphics::setSoftMacroBrush(gui::Painter& painter, + const SoftMacro& soft_macro) { if (soft_macro.getCluster()->getClusterType() == StdCellCluster) { // dark blue From a21192796f4ca0f581870641848b7cfae38d8f0b Mon Sep 17 00:00:00 2001 From: Arthur Koucher Date: Tue, 13 Feb 2024 12:19:28 -0300 Subject: [PATCH 3/5] mpl2: fixed terminals Signed-off-by: Arthur Koucher --- src/mpl2/src/graphics.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/mpl2/src/graphics.cpp b/src/mpl2/src/graphics.cpp index 4cd64bb7c94..a55368fee34 100644 --- a/src/mpl2/src/graphics.cpp +++ b/src/mpl2/src/graphics.cpp @@ -347,6 +347,10 @@ void Graphics::drawObjects(gui::Painter& painter) void Graphics::setSoftMacroBrush(gui::Painter& painter, const SoftMacro& soft_macro) { + if (soft_macro.getCluster() == nullptr) { // fixed terminals + return; + } + if (soft_macro.getCluster()->getClusterType() == StdCellCluster) { // dark blue painter.setBrush(gui::Painter::Color(0x00, 0x00, 0x80, 255)); From db31cf0cbe1d0d5b6ef49cd4ed15482299f4222b Mon Sep 17 00:00:00 2001 From: Arthur Koucher Date: Tue, 13 Feb 2024 12:25:34 -0300 Subject: [PATCH 4/5] mpl2: don't use transparency in macro placement debug Signed-off-by: Arthur Koucher --- src/mpl2/src/graphics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mpl2/src/graphics.cpp b/src/mpl2/src/graphics.cpp index a55368fee34..5dc34345190 100644 --- a/src/mpl2/src/graphics.cpp +++ b/src/mpl2/src/graphics.cpp @@ -277,7 +277,7 @@ void Graphics::drawObjects(gui::Painter& painter) painter.setPen(gui::Painter::white, true); // dark red - painter.setBrush(gui::Painter::Color(0x80, 0x00, 0x00, 150)); + painter.setBrush(gui::Painter::Color(0x80, 0x00, 0x00, 255)); i = 0; for (const auto& macro : hard_macros_) { From 4147448722c6c211e143c819271d03bd503ad4bb Mon Sep 17 00:00:00 2001 From: Arthur Koucher Date: Tue, 13 Feb 2024 13:02:16 -0300 Subject: [PATCH 5/5] mpl2: use predefined Painter colors when possible Signed-off-by: Arthur Koucher --- src/mpl2/src/graphics.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mpl2/src/graphics.cpp b/src/mpl2/src/graphics.cpp index 5dc34345190..712f5ad17ba 100644 --- a/src/mpl2/src/graphics.cpp +++ b/src/mpl2/src/graphics.cpp @@ -276,8 +276,7 @@ void Graphics::drawObjects(gui::Painter& painter) } painter.setPen(gui::Painter::white, true); - // dark red - painter.setBrush(gui::Painter::Color(0x80, 0x00, 0x00, 255)); + painter.setBrush(gui::Painter::dark_red); i = 0; for (const auto& macro : hard_macros_) { @@ -352,8 +351,7 @@ void Graphics::setSoftMacroBrush(gui::Painter& painter, } if (soft_macro.getCluster()->getClusterType() == StdCellCluster) { - // dark blue - painter.setBrush(gui::Painter::Color(0x00, 0x00, 0x80, 255)); + painter.setBrush(gui::Painter::dark_blue); } else if (soft_macro.getCluster()->getClusterType() == HardMacroCluster) { // dark red painter.setBrush(gui::Painter::Color(0x80, 0x00, 0x00, 150));