From bad0acc76d96285e9a4b83c6eb16fd3a15d05bf9 Mon Sep 17 00:00:00 2001 From: LucasYuki Date: Tue, 20 Oct 2026 03:18:43 +0000 Subject: [PATCH 1/4] place: repair setup timing during resize by default Signed-off-by: LucasYuki --- docs/user/FlowVariables.md | 2 +- flow/scripts/resize.tcl | 7 ++++--- flow/scripts/variables.yaml | 8 ++++---- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index b031f9bca2..1b4c1f05c8 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -147,7 +147,7 @@ configuration file. | DPO_MAX_DISPLACEMENT| Specifies how far an instance can be moved when optimizing.| 5 1| | EARLY_SIZING_CAP_RATIO| Ratio between the input pin capacitance and the output pin load during initial gate sizing.| | | ENABLE_DPO| Enable detail placement with improve_placement feature.| 1| -| ENABLE_PLACE_REPAIR_TIMING| Run repair_timing during the placement resize stage using placement parasitics. Disabled by default; pre-CTS setup/hold repair is skipped unless this is set to 1.| 0| +| ENABLE_PLACE_REPAIR_TIMING| Run setup repair_timing (without the last-gasp phase) during the placement resize stage using placement parasitics. Set to 0 to skip pre-CTS setup repair.| 1| | ENABLE_RESISTANCE_AWARE| Passed as -resistance_aware to global_route.| | | FASTROUTE_TCL| Specifies a Tcl script with commands to run before FastRoute.| | | FILL_CELLS| Fill cells are used to fill empty sites. If not set or empty, fill cell insertion is skipped.| | diff --git a/flow/scripts/resize.tcl b/flow/scripts/resize.tcl index 1cfd01b08b..cc3ecc5ce5 100644 --- a/flow/scripts/resize.tcl +++ b/flow/scripts/resize.tcl @@ -26,11 +26,12 @@ if { [env_var_equals SWAP_ARITH_OPERATORS 1] } { repair_design_helper if { $::env(ENABLE_PLACE_REPAIR_TIMING) } { - # Repair timing using placement parasitics. - puts "Repair setup and hold violations..." + # Repair setup using placement parasitics. Hold is left to CTS, where + # the clock tree exists. + puts "Repair setup violations..." log_cmd estimate_parasitics - repair_timing_helper + repair_timing_helper -setup -skip_last_gasp } # post report diff --git a/flow/scripts/variables.yaml b/flow/scripts/variables.yaml index 21b48f712c..0089c96320 100644 --- a/flow/scripts/variables.yaml +++ b/flow/scripts/variables.yaml @@ -990,12 +990,12 @@ SKIP_FLOORPLAN_REPAIR_TIMING: default: 0 ENABLE_PLACE_REPAIR_TIMING: description: > - Run repair_timing during the placement resize stage using placement - parasitics. Disabled by default; pre-CTS setup/hold repair is skipped - unless this is set to 1. + Run setup repair_timing (without the last-gasp phase) during the + placement resize stage using placement parasitics. Set to 0 to skip + pre-CTS setup repair. stages: - place - default: 0 + default: 1 SKIP_REPAIR_TIE_FANOUT: description: > Skip repair_tie_fanout at floorplan step. From 9ffa43d1ed40bcb1ab4092d56e600c44475d66fe Mon Sep 17 00:00:00 2001 From: LucasYuki Date: Tue, 3 Nov 2026 08:06:00 +0000 Subject: [PATCH 2/4] place: size the incremental overflow target to the swapped modules Signed-off-by: LucasYuki --- flow/scripts/resize.tcl | 24 ++++++++++++++++++++++-- flow/scripts/util.tcl | 19 +++++++++++++++++++ 2 files changed, 41 insertions(+), 2 deletions(-) diff --git a/flow/scripts/resize.tcl b/flow/scripts/resize.tcl index cc3ecc5ce5..86c25ebe5a 100644 --- a/flow/scripts/resize.tcl +++ b/flow/scripts/resize.tcl @@ -18,9 +18,29 @@ if { [env_var_exists_and_non_empty EARLY_SIZING_CAP_RATIO] } { if { [env_var_equals SWAP_ARITH_OPERATORS 1] } { # Enable sanity checker until replace_arith_modules becomes stable set_debug_level ODB replace_design_check_sanity 1 - set density [estimate_target_density -overflow 0.1] + set overflow 0.1 + set density [estimate_target_density -overflow $overflow] + set area_before [instance_area_um2] log_cmd replace_arith_modules - log_cmd global_placement -incremental -density $density + + # The swapped modules' cells are the unplaced ones. The cells they replaced + # account for the rest of the area change, so their area as placed (sizing + # and buffers included) is the room the new cells have. Whatever does not + # fit is let overflow there in phase 1, rather than spreading the new + # modules out to resolve it. + set new_area [instance_area_um2 -unplaced] + set old_area [expr { $new_area + $area_before - [instance_area_um2] }] + if { $new_area > 0 } { + set excess [expr { max(0.0, ($new_area - $old_area) / $new_area) }] + set overflow [expr { min(1.0, $overflow + $excess) }] + puts [format "Swapped modules: %.3f um^2 replaced by %.3f um^2,\ + incremental placement overflow target %.3f" \ + $old_area $new_area $overflow] + } + # Phase 1 stops at the looser target above; phase 2 then unlocks every + # instance and brings the whole design back to 0.1. + log_cmd global_placement -incremental -density $density -overflow $overflow \ + -incremental_phase2 -incremental_phase2_overflow 0.1 } repair_design_helper diff --git a/flow/scripts/util.tcl b/flow/scripts/util.tcl index 49862dfa60..d03010c6ec 100644 --- a/flow/scripts/util.tcl +++ b/flow/scripts/util.tcl @@ -300,6 +300,25 @@ proc hier_options { } { } } +# Total area of the block's instances in um^2; with -unplaced, only of the +# instances that are not placed yet. +proc instance_area_um2 { args } { + sta::parse_key_args "instance_area_um2" args keys {} flags {-unplaced} + set unplaced_only [info exists flags(-unplaced)] + set area 0.0 + foreach inst [[ord::get_db_block] getInsts] { + if { $unplaced_only && [$inst isPlaced] } { + continue + } + set master [$inst getMaster] + set area [expr { + $area + [ord::dbu_to_microns [$master getWidth]] + * [ord::dbu_to_microns [$master getHeight]] + }] + } + return $area +} + proc is_physical_only_master { master } { set physical_only_type_patterns [list \ "COVER" \ From 68d38a1896b6e2153bd1ac5e9a51e02b89cf4d5b Mon Sep 17 00:00:00 2001 From: LucasYuki Date: Tue, 17 Nov 2026 01:48:26 +0000 Subject: [PATCH 3/4] update OR and gpl incremental call Signed-off-by: LucasYuki --- flow/scripts/resize.tcl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flow/scripts/resize.tcl b/flow/scripts/resize.tcl index 86c25ebe5a..0c67d71467 100644 --- a/flow/scripts/resize.tcl +++ b/flow/scripts/resize.tcl @@ -40,7 +40,7 @@ if { [env_var_equals SWAP_ARITH_OPERATORS 1] } { # Phase 1 stops at the looser target above; phase 2 then unlocks every # instance and brings the whole design back to 0.1. log_cmd global_placement -incremental -density $density -overflow $overflow \ - -incremental_phase2 -incremental_phase2_overflow 0.1 + -incremental_phase2_overflow 0.1 } repair_design_helper From 20d8cd29af1e35f48b6111dc22cb593786f16634 Mon Sep 17 00:00:00 2001 From: LucasYuki Date: Tue, 17 Nov 2026 13:29:13 +0000 Subject: [PATCH 4/4] 3_4 resize: only enable REPAIR_TIMING by default if a module was swapped Signed-off-by: LucasYuki --- docs/user/FlowVariables.md | 2 +- flow/scripts/resize.tcl | 9 +++++---- flow/scripts/variables.yaml | 6 +++--- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index 1b4c1f05c8..1066f80f54 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -147,7 +147,7 @@ configuration file. | DPO_MAX_DISPLACEMENT| Specifies how far an instance can be moved when optimizing.| 5 1| | EARLY_SIZING_CAP_RATIO| Ratio between the input pin capacitance and the output pin load during initial gate sizing.| | | ENABLE_DPO| Enable detail placement with improve_placement feature.| 1| -| ENABLE_PLACE_REPAIR_TIMING| Run setup repair_timing (without the last-gasp phase) during the placement resize stage using placement parasitics. Set to 0 to skip pre-CTS setup repair.| 1| +| ENABLE_PLACE_REPAIR_TIMING| Run setup repair_timing (without the last-gasp phase) during the placement resize stage using placement parasitics. Disabled by default; the repair also runs when SWAP_ARITH_OPERATORS swaps a module.| 0| | ENABLE_RESISTANCE_AWARE| Passed as -resistance_aware to global_route.| | | FASTROUTE_TCL| Specifies a Tcl script with commands to run before FastRoute.| | | FILL_CELLS| Fill cells are used to fill empty sites. If not set or empty, fill cell insertion is skipped.| | diff --git a/flow/scripts/resize.tcl b/flow/scripts/resize.tcl index 0c67d71467..0cb0e3b9c1 100644 --- a/flow/scripts/resize.tcl +++ b/flow/scripts/resize.tcl @@ -15,13 +15,14 @@ if { [env_var_exists_and_non_empty EARLY_SIZING_CAP_RATIO] } { log_cmd set_opt_config -set_early_sizing_cap_ratio $env(EARLY_SIZING_CAP_RATIO) } +set swapped 0 if { [env_var_equals SWAP_ARITH_OPERATORS 1] } { # Enable sanity checker until replace_arith_modules becomes stable set_debug_level ODB replace_design_check_sanity 1 set overflow 0.1 set density [estimate_target_density -overflow $overflow] set area_before [instance_area_um2] - log_cmd replace_arith_modules + set swapped [log_cmd replace_arith_modules] # The swapped modules' cells are the unplaced ones. The cells they replaced # account for the rest of the area change, so their area as placed (sizing @@ -45,9 +46,9 @@ if { [env_var_equals SWAP_ARITH_OPERATORS 1] } { repair_design_helper -if { $::env(ENABLE_PLACE_REPAIR_TIMING) } { - # Repair setup using placement parasitics. Hold is left to CTS, where - # the clock tree exists. +if { $::env(ENABLE_PLACE_REPAIR_TIMING) || $swapped } { + # Repair setup using placement parasitics, always after a swap. Hold is + # left to CTS, where the clock tree exists. puts "Repair setup violations..." log_cmd estimate_parasitics diff --git a/flow/scripts/variables.yaml b/flow/scripts/variables.yaml index 0089c96320..d478e22818 100644 --- a/flow/scripts/variables.yaml +++ b/flow/scripts/variables.yaml @@ -991,11 +991,11 @@ SKIP_FLOORPLAN_REPAIR_TIMING: ENABLE_PLACE_REPAIR_TIMING: description: > Run setup repair_timing (without the last-gasp phase) during the - placement resize stage using placement parasitics. Set to 0 to skip - pre-CTS setup repair. + placement resize stage using placement parasitics. Disabled by default; + the repair also runs when SWAP_ARITH_OPERATORS swaps a module. stages: - place - default: 1 + default: 0 SKIP_REPAIR_TIE_FANOUT: description: > Skip repair_tie_fanout at floorplan step.