From 305b6c81d7a39a4ee46f94eaded2162e2dd74eb3 Mon Sep 17 00:00:00 2001 From: Natalia Date: Wed, 14 Jan 2026 14:58:53 -0800 Subject: [PATCH] Refine width check to allow Y_WIDTH >= natural width Change from equality check to >= to allow cells where output is wider than natural width (zero-extended). Only reject cells with Y_WIDTH < natural width (truncated). This fixes test failures while still preventing the truncation issue identified in widlarizer's feedback. --- passes/opt/opt_balance_tree.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/passes/opt/opt_balance_tree.cc b/passes/opt/opt_balance_tree.cc index 9e4fa0620..5c19e3975 100644 --- a/passes/opt/opt_balance_tree.cc +++ b/passes/opt/opt_balance_tree.cc @@ -59,8 +59,9 @@ struct OptBalanceTreeWorker { natural_width = std::max(a_width, b_width); } - // Only allow cells where Y_WIDTH equals the natural width (no truncation) - return y_width == natural_width; + // Only allow cells where Y_WIDTH >= natural width (no truncation) + // This prevents rebalancing chains where truncation semantics matter + return y_width >= natural_width; } // Create a balanced binary tree from a vector of source signals