Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose more OpenROAD options #594

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions openlane/scripts/openroad/common/io.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
5 changes: 5 additions & 0 deletions openlane/scripts/openroad/gpl.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
20 changes: 14 additions & 6 deletions openlane/scripts/openroad/repair_design.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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_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)
}
# 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
Expand Down
18 changes: 13 additions & 5 deletions openlane/scripts/openroad/repair_design_postgrt.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -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_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)
}
# Repair Design
repair_design {*}$arg_list

# Re-DPL and GRT
source $::env(SCRIPTS_DIR)/openroad/common/dpl.tcl
Expand Down
18 changes: 11 additions & 7 deletions openlane/scripts/openroad/rsz_timing_postcts.tcl
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -34,9 +34,12 @@ 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)
if { $::env(PL_RESIZER_GATE_CLONING) != 1 } {
lappend arg_list -skip_gate_cloning
}
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

set arg_list [list]
Expand All @@ -45,10 +48,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
}
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
Expand Down
20 changes: 12 additions & 8 deletions openlane/scripts/openroad/rsz_timing_postgrt.tcl
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -37,9 +37,12 @@ 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)
if { $::env(GRT_RESIZER_GATE_CLONING) != 1 } {
lappend arg_list -skip_gate_cloning
}
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

set arg_list [list]
Expand All @@ -48,11 +51,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
}
repair_timing {*}$arg_list
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
#
# Re-DPL and GRT
source $::env(SCRIPTS_DIR)/openroad/common/dpl.tcl
unset_dont_touch_objects
Expand Down
95 changes: 93 additions & 2 deletions openlane/steps/openroad.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="%",
),
]
)

Expand Down Expand Up @@ -2170,6 +2176,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):
Expand Down Expand Up @@ -2226,6 +2237,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):
Expand Down Expand Up @@ -2283,10 +2300,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="%",
),
]

Expand Down Expand Up @@ -2350,17 +2404,54 @@ 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",
bool,
"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):
Expand Down
Loading