From 52b25f1d7dbfe87ed4e999d7ee0e3ca62ce8feac Mon Sep 17 00:00:00 2001 From: Kareem Farid Date: Tue, 5 Nov 2024 17:07:47 +0200 Subject: [PATCH 1/3] save Signed-off-by: Kareem Farid --- openlane/scripts/openroad/common/io.tcl | 20 +++++ openlane/scripts/openroad/repair_design.tcl | 20 +++-- .../openroad/repair_design_postgrt.tcl | 18 +++-- .../scripts/openroad/rsz_timing_postcts.tcl | 28 ++++--- .../scripts/openroad/rsz_timing_postgrt.tcl | 30 ++++--- openlane/steps/openroad.py | 78 ++++++++++++++++++- 6 files changed, 160 insertions(+), 34 deletions(-) diff --git a/openlane/scripts/openroad/common/io.tcl b/openlane/scripts/openroad/common/io.tcl index a77a119a5..fe42fe9b7 100644 --- a/openlane/scripts/openroad/common/io.tcl +++ b/openlane/scripts/openroad/common/io.tcl @@ -474,3 +474,23 @@ if { [namespace exists utl] } { puts "%OL_METRIC $metric $value" } } + +proc append_if_exists_argument {list_arg glob_variable_name option} { + upvar $list_arg local_array + if [info exists ::env($glob_variable_name) ] { + lappend local_array $option $::env($glob_variable_name) + } +} + +proc append_if_flag {list_arg glob_variable_name flag} { + upvar $list_arg local_array + if { [info exists ::env($glob_variable_name)] && $::env($glob_variable_name) } { + lappend local_array $flag + } +} +proc append_if_not_flag {list_arg glob_variable_name flag} { + upvar $list_arg local_array + if { [info exists ::env($glob_variable_name)] && !$::env($glob_variable_name) } { + lappend local_array $flag + } +} diff --git a/openlane/scripts/openroad/repair_design.tcl b/openlane/scripts/openroad/repair_design.tcl index ef457ae10..9e4fc5f59 100644 --- a/openlane/scripts/openroad/repair_design.tcl +++ b/openlane/scripts/openroad/repair_design.tcl @@ -42,17 +42,25 @@ if { $::env(DESIGN_REPAIR_BUFFER_OUTPUT_PORTS) } { buffer_ports -outputs } +set arg_list [list] +lappend arg_list -verbose +lappend arg_list -max_wire_length $::env(DESIGN_REPAIR_MAX_WIRE_LENGTH) +lappend arg_list -slew_margin $::env(DESIGN_REPAIR_MAX_SLEW_PCT) +lappend arg_list -cap_margin $::env(DESIGN_REPAIR_MAX_CAP_PCT) +if { [info exists ::env(DESIGN_REPAIR_MAX_UTILIZATION)] } { + lappend arg_list -max_utilization $::env(DESIGN_REPAIR_MAX_UTILIZATION) +} +if { [info exists ::env(DESIGN_REPAIR_BUFFER_GAIN)] } { + lappend arg_list -buffer_gain $::env(DESIGN_REPAIR_BUFFER_GAIN) +} # Repair Design -repair_design -verbose \ - -max_wire_length $::env(DESIGN_REPAIR_MAX_WIRE_LENGTH) \ - -slew_margin $::env(DESIGN_REPAIR_MAX_SLEW_PCT) \ - -cap_margin $::env(DESIGN_REPAIR_MAX_CAP_PCT) +repair_design {*}$arg_list if { $::env(DESIGN_REPAIR_TIE_FANOUT) } { # repair tie lo fanout - repair_tie_fanout -separation $::env(DESIGN_REPAIR_TIE_SEPARATION) $::env(SYNTH_TIELO_CELL) + repair_tie_fanout -verbose -separation $::env(DESIGN_REPAIR_TIE_SEPARATION) $::env(SYNTH_TIELO_CELL) # repair tie hi fanout - repair_tie_fanout -separation $::env(DESIGN_REPAIR_TIE_SEPARATION) $::env(SYNTH_TIEHI_CELL) + repair_tie_fanout -verbose -separation $::env(DESIGN_REPAIR_TIE_SEPARATION) $::env(SYNTH_TIEHI_CELL) } report_floating_nets -verbose diff --git a/openlane/scripts/openroad/repair_design_postgrt.tcl b/openlane/scripts/openroad/repair_design_postgrt.tcl index 54e9ec5fa..d347ee93d 100644 --- a/openlane/scripts/openroad/repair_design_postgrt.tcl +++ b/openlane/scripts/openroad/repair_design_postgrt.tcl @@ -31,11 +31,19 @@ source $::env(SCRIPTS_DIR)/openroad/common/grt.tcl #} estimate_parasitics -global_routing -# Repair design -repair_design -verbose \ - -max_wire_length $::env(GRT_DESIGN_REPAIR_MAX_WIRE_LENGTH) \ - -slew_margin $::env(GRT_DESIGN_REPAIR_MAX_SLEW_PCT) \ - -cap_margin $::env(GRT_DESIGN_REPAIR_MAX_CAP_PCT) +set arg_list [list] +lappend arg_list -verbose +lappend arg_list -max_wire_length $::env(GRT_DESIGN_REPAIR_MAX_WIRE_LENGTH) +lappend arg_list -slew_margin $::env(GRT_DESIGN_REPAIR_MAX_SLEW_PCT) +lappend arg_list -cap_margin $::env(GRT_DESIGN_REPAIR_MAX_CAP_PCT) +if { [info exists ::env(GRT_DESIGN_REPAIR_MAX_UTILIZATION)] } { + lappend arg_list -max_utilization $::env(GRT_DESIGN_REPAIR_MAX_UTILIZATION) +} +if { [info exists ::env(GRT_DESIGN_REPAIR_BUFFER_GAIN)] } { + lappend arg_list -buffer_gain $::env(GRT_DESIGN_REPAIR_BUFFER_GAIN) +} +# Repair Design +repair_design {*}$arg_list # Re-DPL and GRT source $::env(SCRIPTS_DIR)/openroad/common/dpl.tcl diff --git a/openlane/scripts/openroad/rsz_timing_postcts.tcl b/openlane/scripts/openroad/rsz_timing_postcts.tcl index 9113bfccc..29665916f 100644 --- a/openlane/scripts/openroad/rsz_timing_postcts.tcl +++ b/openlane/scripts/openroad/rsz_timing_postcts.tcl @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Efabless Corporation +# Copyright 2020-2024 Efabless Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,9 +29,19 @@ source $::env(SCRIPTS_DIR)/openroad/common/set_rc.tcl estimate_parasitics -placement # Resize -repair_timing -verbose -setup \ - -setup_margin $::env(PL_RESIZER_SETUP_SLACK_MARGIN) \ - -max_buffer_percent $::env(PL_RESIZER_SETUP_MAX_BUFFER_PCT) +set arg_list [list] +lappend arg_list -verbose +lappend arg_list -setup +lappend arg_list -setup_margin $::env(PL_RESIZER_SETUP_SLACK_MARGIN) +lappend arg_list -max_buffer_percent $::env(PL_RESIZER_SETUP_MAX_BUFFER_PCT) +append_if_not_flag arg_list PL_RESIZER_SETUP_BUFFERING -skip_buffering +append_if_not_flag arg_list PL_RESIZER_SETUP_BUFFER_REMOVAL -skip_buffer_removal +append_if_not_flag arg_list PL_RESIZER_SETUP_GATE_CLONING -skip_gate_cloning +append_if_exists_argument arg_list PL_RESIZER_SETUP_REPAIR_TNS_PCT -repair_tns +append_if_exists_argument arg_list PL_RESIZER_SETUP_MAX_UTIL_PCT -max_utilization + +repair_timing {*}$arg_list +puts "{*}$arg_list" set arg_list [list] lappend arg_list -verbose @@ -39,13 +49,11 @@ lappend arg_list -hold lappend arg_list -setup_margin $::env(PL_RESIZER_SETUP_SLACK_MARGIN) lappend arg_list -hold_margin $::env(PL_RESIZER_HOLD_SLACK_MARGIN) lappend arg_list -max_buffer_percent $::env(PL_RESIZER_HOLD_MAX_BUFFER_PCT) -if { $::env(PL_RESIZER_ALLOW_SETUP_VIOS) == 1 } { - lappend arg_list -allow_setup_violations -} -if { $::env(PL_RESIZER_GATE_CLONING) != 1 } { - lappend arg_list -skip_gate_cloning -} +append_if_flag arg_list PL_RESIZER_ALLOW_SETUP_VIOS -allow_setup_violations +append_if_exists_argument arg_list PL_RESIZER_HOLD_REPAIR_TNS_PCT -repair_tns +append_if_exists_argument arg_list PL_RESIZER_HOLD_MAX_UTIL_PCT -max_utilization repair_timing {*}$arg_list +puts "{*}$arg_list" # Legalize source $::env(SCRIPTS_DIR)/openroad/common/dpl.tcl diff --git a/openlane/scripts/openroad/rsz_timing_postgrt.tcl b/openlane/scripts/openroad/rsz_timing_postgrt.tcl index f8e423e0d..fb29a1f5b 100644 --- a/openlane/scripts/openroad/rsz_timing_postgrt.tcl +++ b/openlane/scripts/openroad/rsz_timing_postgrt.tcl @@ -1,4 +1,4 @@ -# Copyright 2020-2023 Efabless Corporation +# Copyright 2020-2024 Efabless Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -32,9 +32,19 @@ source $::env(SCRIPTS_DIR)/openroad/common/grt.tcl estimate_parasitics -global_routing # Resize -repair_timing -verbose -setup \ - -setup_margin $::env(GRT_RESIZER_SETUP_SLACK_MARGIN) \ - -max_buffer_percent $::env(GRT_RESIZER_SETUP_MAX_BUFFER_PCT) +set arg_list [list] +lappend arg_list -verbose +lappend arg_list -setup +lappend arg_list -setup_margin $::env(GRT_RESIZER_SETUP_SLACK_MARGIN) +lappend arg_list -max_buffer_percent $::env(GRT_RESIZER_SETUP_MAX_BUFFER_PCT) +append_if_not_flag arg_list GRT_RESIZER_SETUP_BUFFERING -skip_buffering +append_if_not_flag arg_list GRT_RESIZER_SETUP_BUFFER_REMOVAL -skip_buffer_removal +append_if_not_flag arg_list GRT_RESIZER_SETUP_GATE_CLONING -skip_gate_cloning +append_if_exists_argument arg_list GRT_RESIZER_SETUP_REPAIR_TNS_PCT -repair_tns +append_if_exists_argument arg_list GRT_RESIZER_SETUP_MAX_UTIL_PCT -max_utilization + +repair_timing {*}$arg_list +puts "{*}$arg_list" set arg_list [list] lappend arg_list -verbose @@ -42,14 +52,12 @@ lappend arg_list -hold lappend arg_list -setup_margin $::env(GRT_RESIZER_SETUP_SLACK_MARGIN) lappend arg_list -hold_margin $::env(GRT_RESIZER_HOLD_SLACK_MARGIN) lappend arg_list -max_buffer_percent $::env(GRT_RESIZER_HOLD_MAX_BUFFER_PCT) -if { $::env(GRT_RESIZER_ALLOW_SETUP_VIOS) == 1 } { - lappend arg_list -allow_setup_violations -} -if { $::env(GRT_RESIZER_GATE_CLONING) != 1 } { - lappend arg_list -skip_gate_cloning -} +append_if_flag arg_list GRT_RESIZER_ALLOW_SETUP_VIOS -allow_setup_violations +append_if_exists_argument arg_list GRT_RESIZER_HOLD_REPAIR_TNS_PCT -repair_tns +append_if_exists_argument arg_list GRT_RESIZER_HOLD_MAX_UTIL_PCT -max_utilization repair_timing {*}$arg_list - +puts "{*}$arg_list" +# # Re-DPL and GRT source $::env(SCRIPTS_DIR)/openroad/common/dpl.tcl unset_dont_touch_objects diff --git a/openlane/steps/openroad.py b/openlane/steps/openroad.py index a358145e0..50114015e 100644 --- a/openlane/steps/openroad.py +++ b/openlane/steps/openroad.py @@ -2282,10 +2282,47 @@ class ResizerTimingPostCTS(ResizerStep): default=False, ), Variable( - "PL_RESIZER_GATE_CLONING", + "PL_RESIZER_SETUP_GATE_CLONING", bool, "Enables gate cloning when attempting to fix setup violations", default=True, + deprecated_names=["PL_RESIZER_GATE_CLONING"], + ), + Variable( + "PL_RESIZER_SETUP_BUFFERING", + bool, + "Rebuffering and load splitting during setup fixing.", + default=True, + ), + Variable( + "PL_RESIZER_SETUP_BUFFER_REMOVAL", + bool, + "Buffer removal transform during setup fixing.", + default=True, + ), + Variable( + "PL_RESIZER_SETUP_REPAIR_TNS_PCT", + Optional[Decimal], + "Percentage of violating endpoints to repair during setup fixing.", + units="%", + ), + Variable( + "PL_RESIZER_SETUP_MAX_UTIL_PCT", + Optional[Decimal], + "Defines the percentage of core area used during setup fixing.", + units="%", + ), + Variable( + "PL_RESIZER_HOLD_REPAIR_TNS_PCT", + Optional[Decimal], + "Percentage of violating endpoints to repair during hold fixing.", + units="%", + ), + Variable( + "PL_RESIZER_HOLD_MAX_UTIL_PCT", + Optional[Decimal], + "Defines the percentage of core area used during hold fixing.", + units="%", ), ] @@ -2349,10 +2386,11 @@ class ResizerTimingPostGRT(ResizerStep): deprecated_names=["GLB_RESIZER_ALLOW_SETUP_VIOS"], ), Variable( - "GRT_RESIZER_GATE_CLONING", + "GRT_RESIZER_SETUP_GATE_CLONING", bool, "Enables gate cloning when attempting to fix setup violations", default=True, + deprecated_names=["GRT_RESIZER_GATE_CLONING"], ), Variable( "GRT_RESIZER_RUN_GRT", @@ -2360,6 +2398,42 @@ class ResizerTimingPostGRT(ResizerStep): "Gates running global routing after resizer steps. May be useful to disable for designs where global routing takes non-trivial time.", default=True, ), + Variable( + "GRT_RESIZER_SETUP_BUFFERING", + bool, + "Rebuffering and load splitting during setup fixing.", + default=True, + ), + Variable( + "GRT_RESIZER_SETUP_BUFFER_REMOVAL", + bool, + "Buffer removal transform during setup fixing.", + default=True, + ), + Variable( + "GRT_RESIZER_SETUP_REPAIR_TNS_PCT", + Optional[Decimal], + "Percentage of violating endpoints to repair during setup fixing.", + units="%", + ), + Variable( + "GRT_RESIZER_SETUP_MAX_UTIL_PCT", + Optional[Decimal], + "Defines the percentage of core area used during setup fixing.", + units="%", + ), + Variable( + "GRT_RESIZER_HOLD_REPAIR_TNS_PCT", + Optional[Decimal], + "Percentage of violating endpoints to repair during hold fixing.", + units="%", + ), + Variable( + "GRT_RESIZER_HOLD_MAX_UTIL_PCT", + Optional[Decimal], + "Defines the percentage of core area used during hold fixing.", + units="%", + ), ] def get_script_path(self): From 9eb29c6c0a453769ce9935ad17fe090f674fff37 Mon Sep 17 00:00:00 2001 From: Kareem Farid Date: Tue, 5 Nov 2024 17:15:31 +0200 Subject: [PATCH 2/3] more variables Signed-off-by: Kareem Farid --- openlane/scripts/openroad/repair_design.tcl | 4 ++-- openlane/scripts/openroad/repair_design_postgrt.tcl | 4 ++-- openlane/steps/openroad.py | 11 +++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/openlane/scripts/openroad/repair_design.tcl b/openlane/scripts/openroad/repair_design.tcl index 9e4fc5f59..99c9acd12 100644 --- a/openlane/scripts/openroad/repair_design.tcl +++ b/openlane/scripts/openroad/repair_design.tcl @@ -47,8 +47,8 @@ lappend arg_list -verbose lappend arg_list -max_wire_length $::env(DESIGN_REPAIR_MAX_WIRE_LENGTH) lappend arg_list -slew_margin $::env(DESIGN_REPAIR_MAX_SLEW_PCT) lappend arg_list -cap_margin $::env(DESIGN_REPAIR_MAX_CAP_PCT) -if { [info exists ::env(DESIGN_REPAIR_MAX_UTILIZATION)] } { - lappend arg_list -max_utilization $::env(DESIGN_REPAIR_MAX_UTILIZATION) +if { [info exists ::env(DESIGN_REPAIR_MAX_UTIL_PCT)] } { + lappend arg_list -max_utilization $::env(DESIGN_REPAIR_MAX_UTIL_PCT) } if { [info exists ::env(DESIGN_REPAIR_BUFFER_GAIN)] } { lappend arg_list -buffer_gain $::env(DESIGN_REPAIR_BUFFER_GAIN) diff --git a/openlane/scripts/openroad/repair_design_postgrt.tcl b/openlane/scripts/openroad/repair_design_postgrt.tcl index d347ee93d..96c7aa23b 100644 --- a/openlane/scripts/openroad/repair_design_postgrt.tcl +++ b/openlane/scripts/openroad/repair_design_postgrt.tcl @@ -36,8 +36,8 @@ lappend arg_list -verbose lappend arg_list -max_wire_length $::env(GRT_DESIGN_REPAIR_MAX_WIRE_LENGTH) lappend arg_list -slew_margin $::env(GRT_DESIGN_REPAIR_MAX_SLEW_PCT) lappend arg_list -cap_margin $::env(GRT_DESIGN_REPAIR_MAX_CAP_PCT) -if { [info exists ::env(GRT_DESIGN_REPAIR_MAX_UTILIZATION)] } { - lappend arg_list -max_utilization $::env(GRT_DESIGN_REPAIR_MAX_UTILIZATION) +if { [info exists ::env(GRT_DESIGN_REPAIR_MAX_UTIL_PCT)] } { + lappend arg_list -max_utilization $::env(GRT_DESIGN_REPAIR_MAX_UTIL_PCT) } if { [info exists ::env(GRT_DESIGN_REPAIR_BUFFER_GAIN)] } { lappend arg_list -buffer_gain $::env(GRT_DESIGN_REPAIR_BUFFER_GAIN) diff --git a/openlane/steps/openroad.py b/openlane/steps/openroad.py index 50114015e..e68ee26a9 100644 --- a/openlane/steps/openroad.py +++ b/openlane/steps/openroad.py @@ -2169,6 +2169,11 @@ class RepairDesignPostGPL(ResizerStep): "Invokes OpenROAD's remove_buffers command to remove buffers from synthesis, which gives OpenROAD more flexibility when buffering nets.", default=False, ), + Variable( + "DESIGN_REPAIR_MAX_UTIL_PCT", + Optional[Decimal], + "Defines the percentage of core area used during design repair.", + ), ] def get_script_path(self): @@ -2225,6 +2230,12 @@ class RepairDesignPostGRT(ResizerStep): units="%", deprecated_names=["GLB_RESIZER_MAX_CAP_MARGIN"], ), + Variable( + "GRT_DESIGN_REPAIR_MAX_UTIL_PCT", + Optional[Decimal], + "Defines the percentage of core area used during design post-grt repair.", + units="%", + ), ] def get_script_path(self): From 469db4e28d817f4db5ec34afd3d573c58876ca22 Mon Sep 17 00:00:00 2001 From: Kareem Farid Date: Sun, 10 Nov 2024 12:58:10 +0200 Subject: [PATCH 3/3] Add PL_ROUTABILITY_MAX_DENSITY_PCT Signed-off-by: Kareem Farid --- openlane/scripts/openroad/gpl.tcl | 5 +++++ openlane/steps/openroad.py | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/openlane/scripts/openroad/gpl.tcl b/openlane/scripts/openroad/gpl.tcl index 1652456d3..35964dd19 100755 --- a/openlane/scripts/openroad/gpl.tcl +++ b/openlane/scripts/openroad/gpl.tcl @@ -66,12 +66,17 @@ if { [info exists ::env(PL_MAX_PHI_COEFFICIENT)] } { lappend arg_list -max_phi_coef $::env(PL_MAX_PHI_COEFFICIENT) } +if { [info exists ::env(PL_ROUTABILITY_MAX_DENSITY_PCT)] } { + lappend arg_list -routability_max_density $::env(PL_ROUTABILITY_MAX_DENSITY_PCT) +} + set cell_pad_side [expr $::env(GPL_CELL_PADDING) / 2] lappend arg_list -pad_right $cell_pad_side lappend arg_list -pad_left $cell_pad_side lappend arg_list -init_wirelength_coef $::env(PL_WIRE_LENGTH_COEF) +puts "\[INFO\] args: $arg_list" global_placement {*}$arg_list diff --git a/openlane/steps/openroad.py b/openlane/steps/openroad.py index e68ee26a9..d8a014329 100644 --- a/openlane/steps/openroad.py +++ b/openlane/steps/openroad.py @@ -1240,6 +1240,12 @@ class _GlobalPlacement(OpenROADStep): units="sites", pdk=True, ), + Variable( + "PL_ROUTABILITY_MAX_DENSITY_PCT", + Optional[Decimal], + "Upper bound for placement density in routability mode.", + units="%", + ), ] )