From 272b1097d0dbaa3b4c867e355ee88b8aa59b6369 Mon Sep 17 00:00:00 2001 From: gatecat Date: Tue, 5 May 2026 15:29:38 +0200 Subject: [PATCH] static: Fix handling of heterogeneous macros Signed-off-by: gatecat --- common/place/placer_static.cc | 4 ++++ common/place/static_util.h | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/common/place/placer_static.cc b/common/place/placer_static.cc index 5ed6ca13..1497377a 100644 --- a/common/place/placer_static.cc +++ b/common/place/placer_static.cc @@ -653,6 +653,8 @@ class StaticPlacer g.conc_density.reset(width, height, 0); for (int idx = 0; idx < int(ccells.size()); idx++) { auto &mc = mcells.at(idx); + if (mc.is_fixed) + continue; auto &g = groups.at(mc.group); auto loc = mc.pos; auto size = mc.rect; @@ -1110,6 +1112,8 @@ class StaticPlacer for (int c : macro.conc_cells) { auto &cc = ccells.at(c); auto &mc = mcells.at(c); + if (mc.is_fixed) + continue; auto last_pos = mc.pos; mc.pos = mc.pos * (1 - alpha) + (pos + RealPair(cc.chunk_dx, cc.chunk_dy)) * alpha; mc.ref_pos = mc.ref_pos * (1 - alpha) + (ref_pos + RealPair(cc.chunk_dx, cc.chunk_dy)) * alpha; diff --git a/common/place/static_util.h b/common/place/static_util.h index 64dc6e03..5c5b935d 100644 --- a/common/place/static_util.h +++ b/common/place/static_util.h @@ -35,8 +35,7 @@ enum class Axis Y }; -template -struct RealPairTempl +template struct RealPairTempl { RealPairTempl() : x(0), y(0) {}; RealPairTempl(T x, T y) : x(x), y(y) {}; @@ -62,8 +61,14 @@ struct RealPairTempl inline T &at(Axis axis) { return (axis == Axis::Y) ? y : x; } inline const T &at(Axis axis) const { return (axis == Axis::Y) ? y : x; } }; -template inline RealPairTempl operator+(RealPairTempl a, RealPairTempl b) { return RealPairTempl(a.x + b.x, a.y + b.y); } -template inline RealPairTempl operator-(RealPairTempl a, RealPairTempl b) { return RealPairTempl(a.x - b.x, a.y - b.y); } +template inline RealPairTempl operator+(RealPairTempl a, RealPairTempl b) +{ + return RealPairTempl(a.x + b.x, a.y + b.y); +} +template inline RealPairTempl operator-(RealPairTempl a, RealPairTempl b) +{ + return RealPairTempl(a.x - b.x, a.y - b.y); +} using RealPair = RealPairTempl; using DoublePair = RealPairTempl;