From 2e90d426363e3ccebf275c33633da885cac02190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Sat, 25 Apr 2026 22:17:22 +0200 Subject: [PATCH 1/2] flow: move eliminate_dead_logic into synth_odb.tcl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit eliminate_dead_logic is a pure netlist transform: it does not need a die area, bterm placement or routing layers. Running it in synth_odb.tcl means 1_synth.odb already reflects the live design instead of dropping its instance count between synth and floorplan. This matters for parallel synthesis flows (e.g., MegaBoom) where yosys only sees a slice of the design at a time and cannot prune logic that is dead only when looking at the whole design. In those flows this step has historically eliminated ~50% of the design. Add a docstring above the remaining synthesis-looking transforms in floorplan.tcl (repair_tie_fanout, replace_arith_modules, remove_buffers, repair_timing_helper) explaining why they cannot follow: initialize_floorplan and set_routing_layers above set up the bterm boundary placement and the routing layer stack that timing-aware optimization relies on for parasitic estimation. Moving these calls into synth_odb.tcl was tried in PR #4187 and regressed setup TNS by 1.7-46x on I/O-heavy designs (asap7/aes-block 2.5x, asap7/jpeg_lvt 37x, asap7/swerv_wrapper 46x finish-hold-TNS, nangate45/ariane133 1.7x); internal-logic-dominated designs like asap7/ibex were unaffected once the tie-fanout ordering was preserved, but the I/O-heavy regressions made the broader move untenable. Signed-off-by: Øyvind Harboe --- flow/scripts/floorplan.tcl | 20 ++++++++++++++++---- flow/scripts/synth_odb.tcl | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/flow/scripts/floorplan.tcl b/flow/scripts/floorplan.tcl index 3cb381904c..74eb397fad 100644 --- a/flow/scripts/floorplan.tcl +++ b/flow/scripts/floorplan.tcl @@ -32,10 +32,6 @@ proc report_unused_masters { } { report_unused_masters -# Eliminate dead logic -eliminate_dead_logic - - #Run check_setup puts "\n==========================================================================" puts "Floorplan check_setup" @@ -116,6 +112,22 @@ if { [env_var_exists_and_non_empty FASTROUTE_TCL] } { source_env_var_if_exists FOOTPRINT_TCL +# The transforms below (repair_tie_fanout, replace_arith_modules, +# remove_buffers, repair_timing_helper) look like synthesis-stage +# operations: they all act on the netlist and don't touch placement. +# But they DO depend on having a floorplan in place — initialize_floorplan +# above placed the bterms on the die boundary and set_routing_layers +# configured the layer stack used for parasitic estimation. Without that +# context, top-level ports look like they're at (0,0) and timing analysis +# misjudges paths into/out of I/O. +# +# PR #4187 tried moving this block to synth_odb.tcl. It regressed setup +# TNS by 1.7-46x on I/O-heavy designs (asap7/aes-block 2.5x, asap7/jpeg_lvt +# 37x, asap7/swerv_wrapper 46x finish-hold-TNS, nangate45/ariane133 1.7x) +# while leaving internal-logic-dominated designs like asap7/ibex +# unchanged. The move was reverted; only eliminate_dead_logic stayed in +# synth_odb.tcl because it is a pure netlist transform that doesn't +# depend on placement or routing-layer context. if { !$::env(SKIP_REPAIR_TIE_FANOUT) } { # This needs to come before any call to remove_buffers. You could have one # tie driving multiple buffers that drive multiple outputs. diff --git a/flow/scripts/synth_odb.tcl b/flow/scripts/synth_odb.tcl index 1ec969cafb..d4bebf645f 100644 --- a/flow/scripts/synth_odb.tcl +++ b/flow/scripts/synth_odb.tcl @@ -4,6 +4,26 @@ erase_non_stage_variables synth load_design 1_2_yosys.v 1_2_yosys.sdc source_step_tcl PRE SYNTH +# Eliminate dead logic before writing the synthesis odb so that +# 1_synth.odb already reflects the live design. +# +# This matters for parallel synthesis flows (e.g., MegaBoom) where yosys +# only sees a slice of the design at a time and cannot prune logic that +# is dead only when looking at the whole design. In those flows this +# step can eliminate vast quantities of debug logic — for MegaBoom it +# has historically removed ~50% of the design. +# +# eliminate_dead_logic is a pure netlist transform: it does not need a +# die area, bterm placement or routing layers, so it is safe to run +# here. Other synthesis-looking transforms in floorplan.tcl +# (repair_tie_fanout, replace_arith_modules, remove_buffers, +# repair_timing_helper) DO depend on floorplan-stage context (bterm +# locations from initialize_floorplan, routing-layer setup) and must +# stay in floorplan.tcl — moving them here was tried in PR #4187 and +# regressed setup TNS by 1.7-46x on I/O-heavy designs (asap7/aes-block, +# asap7/jpeg_lvt, asap7/swerv_wrapper, nangate45/ariane133). +eliminate_dead_logic + source_step_tcl POST SYNTH orfs_write_db $::env(RESULTS_DIR)/1_synth.odb # Canonicalize 1_synth.sdc. The original SDC_FILE provided by From 3098af728b1796dcba11e68d0925e391250fdb13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Sun, 26 Apr 2026 04:54:42 +0200 Subject: [PATCH 2/2] flow: wrap eliminate_dead_logic in log_cmd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit eliminate_dead_logic can prune up to ~50% of a parallel-synth design (e.g., MegaBoom). log_cmd echoes the command line and reports duration when it exceeds 5 s, matching how other potentially expensive flow commands (link_design, read_db, repair_timing, write_db, etc.) are logged. Reported by gemini-code-assist on PR #4190. Signed-off-by: Øyvind Harboe --- flow/scripts/synth_odb.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/scripts/synth_odb.tcl b/flow/scripts/synth_odb.tcl index d4bebf645f..d6f53cda3e 100644 --- a/flow/scripts/synth_odb.tcl +++ b/flow/scripts/synth_odb.tcl @@ -22,7 +22,7 @@ source_step_tcl PRE SYNTH # stay in floorplan.tcl — moving them here was tried in PR #4187 and # regressed setup TNS by 1.7-46x on I/O-heavy designs (asap7/aes-block, # asap7/jpeg_lvt, asap7/swerv_wrapper, nangate45/ariane133). -eliminate_dead_logic +log_cmd eliminate_dead_logic source_step_tcl POST SYNTH orfs_write_db $::env(RESULTS_DIR)/1_synth.odb