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

Some OpenROAD Enhancements #608

Open
wants to merge 20 commits into
base: dev
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion openlane/config/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def evaluate(expression: str, symbols: Mapping[str, Any]) -> Decimal:
eval_stack.pop()
eval_stack.pop()

result = Decimal(0.0)
result = Decimal("0")
if token.value == "**":
result = number1**number2
elif token.value == "*":
Expand Down
2 changes: 1 addition & 1 deletion openlane/scripts/openroad/common/dpl.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ source $::env(SCRIPTS_DIR)/openroad/common/dpl_cell_pad.tcl

remove_fillers

detailed_placement\
log_cmd detailed_placement\
-max_displacement [subst { $::env(PL_MAX_DISPLACEMENT_X) $::env(PL_MAX_DISPLACEMENT_Y) }]

if { [info exists ::env(PL_OPTIMIZE_MIRRORING)] && $::env(PL_OPTIMIZE_MIRRORING) } {
Expand Down
6 changes: 3 additions & 3 deletions openlane/scripts/openroad/common/grt.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ lappend arg_list -verbose
if { $::env(GRT_ALLOW_CONGESTION) == 1 } {
lappend arg_list -allow_congestion
}
puts $arg_list
global_route {*}$arg_list

write_guide $::env(STEP_DIR)/after_grt.guide
log_cmd global_route {*}$arg_list

write_guide $::env(STEP_DIR)/after_grt.guide
62 changes: 62 additions & 0 deletions openlane/scripts/openroad/common/io.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -474,3 +474,65 @@ if { [namespace exists utl] } {
puts "%OL_METRIC $metric $value"
}
}

proc exit_unless_gui {{status 0}} {
if { ![info exists ::env(_OPENROAD_GUI)] || !$::env(_OPENROAD_GUI) } {
exit $status
}
}

proc find_unfixed_macros {} {
set macros [list]

foreach inst [$::block getInsts] {
set inst_master [$inst getMaster]

# BLOCK means MACRO cells
if { ![string match [$inst_master getType] "BLOCK"] } {
continue
}

if { [$inst isFixed] } {
continue
}

lappend macros $inst
}
return $macros
}

# Code below adapted from OpenROAD Flow Scripts under the following license:
#
# BSD 3-Clause License
#
# Copyright (c) 2018-2023, The Regents of the University of California
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:

# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
proc log_cmd {cmd args} {
puts "+ $cmd [join $args " "]"
$cmd {*}$args
}
4 changes: 2 additions & 2 deletions openlane/scripts/openroad/common/set_global_connections.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ proc set_global_connections {} {

if { $power_pin == "" || $ground_pin == "" } {
puts "PDN_MACRO_CONNECTIONS missing power and ground pin names"
exit -1
exit_unless_gui 1
}

set matched 0
Expand All @@ -57,7 +57,7 @@ proc set_global_connections {} {
}
if { $matched != 1 } {
puts "\[ERROR\] No match found for regular expression '$instance_name' defined in PDN_MACRO_CONNECTIONS."
exit 1
exit_unless_gui 1
}

add_global_connection \
Expand Down
2 changes: 1 addition & 1 deletion openlane/scripts/openroad/common/set_power_nets.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if { [info exists ::env(VDD_NETS)] || [info exists ::env(GND_NETS)] } {
# current assumption: they cannot have a common ground
if { ! [info exists ::env(VDD_NETS)] || ! [info exists ::env(GND_NETS)] } {
puts stderr "\[ERROR\] VDD_NETS and GND_NETS must *both* either be defined or undefined"
exit -1
exit_unless_gui 1
}
set ::env(VDD_NET) [lindex $::env(VDD_NETS) 0]
set ::env(GND_NET) [lindex $::env(GND_NETS) 0]
Expand Down
4 changes: 2 additions & 2 deletions openlane/scripts/openroad/cts.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if { [info exists ::env(CTS_MAX_CAP)] } {
if { [info exists ::env(CTS_MAX_SLEW)] } {
lappend cts_characterization_args -max_slew [expr {$::env(CTS_MAX_SLEW) * 1e-9}]; # ns -> S
}
configure_cts_characterization {*}$cts_characterization_args
log_cmd configure_cts_characterization {*}$cts_characterization_args

puts "\[INFO\] Performing clock tree synthesis…"
puts "\[INFO\] Looking for the following net(s): $::env(CLOCK_NET)"
Expand All @@ -55,7 +55,7 @@ if { $::env(CTS_DISABLE_POST_PROCESSING) } {
lappend arg_list -post_cts_disable
}

clock_tree_synthesis {*}$arg_list
log_cmd clock_tree_synthesis {*}$arg_list

set_propagated_clock [all_clocks]

Expand Down
25 changes: 21 additions & 4 deletions openlane/scripts/openroad/cut_rows.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,27 @@
source $::env(SCRIPTS_DIR)/openroad/common/io.tcl
read_current_odb

cut_rows\
-endcap_master $::env(ENDCAP_CELL)\
-halo_width_x $::env(FP_MACRO_HORIZONTAL_HALO)\
-halo_width_y $::env(FP_MACRO_VERTICAL_HALO)
set arg_list [list]
lappend arg_list -endcap_master $::env(ENDCAP_CELL)
lappend arg_list -halo_width_x $::env(FP_MACRO_HORIZONTAL_HALO)
lappend arg_list -halo_width_y $::env(FP_MACRO_VERTICAL_HALO)
if { [info exists ::env(FP_PRUNE_THRESHOLD)] } {
lappend arg_list -row_min_width $::env(FP_PRUNE_THRESHOLD)
}
log_cmd cut_rows {*}$arg_list

# # verify -row_min_width worked
donn marked this conversation as resolved.
Show resolved Hide resolved
# if { [info exists ::env(FP_PRUNE_THRESHOLD)] } {
# foreach row [$::block getRows] {
# set bbox [$row getBBox]
# set width [expr ([$bbox xMax] - [$bbox xMin])]
# set width_um [expr $width / $::dbu]
# if { $width < $::env(FP_PRUNE_THRESHOLD) } {
# exit -1
# # odb::dbRow_destroy $row
# }
# }
# }

write_views

Expand Down
4 changes: 2 additions & 2 deletions openlane/scripts/openroad/drt.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ if { [info exists ::env(DRT_MAX_LAYER)] } {
set max_layer $::env(DRT_MAX_LAYER)
}

detailed_route\
log_cmd detailed_route\
-bottom_routing_layer $min_layer\
-top_routing_layer $max_layer\
-output_drc $::env(STEP_DIR)/$::env(DESIGN_NAME).drc\
-droute_end_iter $::env(DRT_OPT_ITERS)\
-or_seed 42\
-verbose 1

write_views
write_views
6 changes: 3 additions & 3 deletions openlane/scripts/openroad/floorplan.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ puts "\[INFO\] Using $::env(FP_SIZING) sizing for the floorplan."
if {$::env(FP_SIZING) == "absolute"} {
if { [llength $::env(DIE_AREA)] != 4 } {
puts stderr "Invalid die area string '$::env(DIE_AREA)'."
exit -1
exit_unless_gui 1
}
if { ! [info exists ::env(CORE_AREA)] } {
set die_ll_x [lindex $::env(DIE_AREA) 0]
Expand All @@ -70,7 +70,7 @@ if {$::env(FP_SIZING) == "absolute"} {
} else {
if { [llength $::env(CORE_AREA)] != 4 } {
puts stderr "Invalid core area string '$::env(CORE_AREA)'."
exit -1
exit_unless_gui 1
}
puts "\[INFO\] Using the set CORE_AREA; ignoring core margin parameters"
}
Expand All @@ -94,7 +94,7 @@ if { [info exists ::env(FP_OBSTRUCTIONS)] } {
}
}

initialize_floorplan {*}$arg_list
log_cmd initialize_floorplan {*}$arg_list

insert_tiecells $::env(SYNTH_TIELO_CELL) -prefix "TIE_ZERO_"
insert_tiecells $::env(SYNTH_TIEHI_CELL) -prefix "TIE_ONE_"
Expand Down
13 changes: 6 additions & 7 deletions openlane/scripts/openroad/gpl.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ foreach inst $::insts {
}

if { !$placement_needed } {
puts stderr "\[WARNING\] All instances are FIXED/FIRM."
puts stderr "\[WARNING\] No need to perform global placement."
puts stderr "\[WARNING\] Skipping…"
puts "\[INFO\] All instances are FIXED/FIRM."
puts "\[INFO\] No need to perform global placement."
puts "\[INFO\] Skipping…"
write_views
exit 0
exit_unless_gui
}

set arg_list [list]
Expand All @@ -53,8 +53,7 @@ if { $::env(PL_SKIP_INITIAL_PLACEMENT) } {
lappend arg_list -skip_initial_place
}


if { [info exists ::env(__PL_SKIP_IO)] } {
if { $::env(STEP_ID) == "OpenROAD.GlobalPlacementSkipIO" } {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i recall avoiding this for some reason.

lappend arg_list -skip_io
}

Expand All @@ -72,7 +71,7 @@ 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)

global_placement {*}$arg_list
log_cmd global_placement {*}$arg_list


source $::env(SCRIPTS_DIR)/openroad/common/set_rc.tcl
Expand Down
4 changes: 2 additions & 2 deletions openlane/scripts/openroad/insert_buffer.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ if { [info exists ::env(INSERT_BUFFER_COMMAND) ]} {
read_current_odb

set arg_list [split $::env(INSERT_BUFFER_COMMAND) " "]
insert_buffer {*}$arg_list
log_cmd insert_buffer {*}$arg_list

write_views
}
}
3 changes: 1 addition & 2 deletions openlane/scripts/openroad/ioplacer.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ if { $::env(FP_PPL_MODE) == "annealing" } {
set HMETAL $::env(FP_IO_HLAYER)
set VMETAL $::env(FP_IO_VLAYER)

puts "\[INFO\] place_pins args: $arg_list"
place_pins {*}$arg_list \
log_cmd place_pins {*}$arg_list \
-random_seed 42 \
-hor_layers $HMETAL \
-ver_layers $VMETAL
Expand Down
6 changes: 3 additions & 3 deletions openlane/scripts/openroad/irdrop.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if { [info exists ::env(VSRC_LOC_FILES)] } {
lappend arg_list -net $net
lappend arg_list -voltage_file $::env(STEP_DIR)/net-$net.csv
lappend arg_list -vsrc $vsrc_file
analyze_power_grid {*}$arg_list
log_cmd analyze_power_grid {*}$arg_list
}
puts "%OL_END_REPORT"
} else {
Expand All @@ -38,14 +38,14 @@ if { [info exists ::env(VSRC_LOC_FILES)] } {
lappend arg_list -net $net
lappend arg_list -voltage_file $::env(STEP_DIR)/net-$net.csv
set_pdnsim_net_voltage -net $net -voltage $::env(LIB_VOLTAGE)
analyze_power_grid {*}$arg_list
log_cmd analyze_power_grid {*}$arg_list
}
foreach net "$::env(GND_NETS)" {
set arg_list [list]
lappend arg_list -net $net
lappend arg_list -voltage_file $::env(STEP_DIR)/net-$net.csv
set_pdnsim_net_voltage -net $net -voltage 0
analyze_power_grid {*}$arg_list
log_cmd analyze_power_grid {*}$arg_list
}
puts "%OL_END_REPORT"
}
39 changes: 20 additions & 19 deletions openlane/scripts/openroad/pdn.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -23,30 +23,31 @@ read_pdn_cfg
set arg_list [list]
if { $::env(FP_PDN_SKIPTRIM) } {
lappend arg_list -skip_trim
puts "adding -skip_trim to pdngen"
}
# run PDNGEN
if {[catch {pdngen {*}$arg_list} errmsg]} {
if {[catch {log_cmd pdngen {*}$arg_list} errmsg]} {
puts stderr $errmsg
exit 1
}

write_views
report_design_area_metrics
exit_unless_gui 1
} else {
write_views
report_design_area_metrics

foreach {net} "$::env(VDD_NETS) $::env(GND_NETS)" {
set report_file $::env(STEP_DIR)/$net-grid-errors.rpt
foreach {net} "$::env(VDD_NETS) $::env(GND_NETS)" {
set report_file $::env(STEP_DIR)/$net-grid-errors.rpt

# For some reason, check_power_grid is… totally okay if no nodes are found
# at all. i.e. PDN generation has completely failed.
# This is a fallback file.
set f [open $report_file "w"]
puts $f "violation type: no nodes"
puts $f " srcs: "
puts $f " - N/A"
close $f
# For some reason, check_power_grid is… totally okay if no nodes are found
# at all. i.e. PDN generation has completely failed.
# This is a fallback file.
set f [open $report_file "w"]
puts $f "violation type: no nodes"
puts $f " srcs: "
puts $f " - N/A"
close $f

if { [catch {check_power_grid -net $net -error_file $report_file} err] } {
puts stderr "\[WARNING\] Grid check for $net failed: $err"
if { [catch {check_power_grid -net $net -error_file $report_file} err] } {
puts stderr "\[WARNING\] Grid check for $net failed: $err"
}
}

}

2 changes: 1 addition & 1 deletion openlane/scripts/openroad/rcx.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ if { !$::env(RCX_MERGE_VIA_WIRE_RES) } {
# RCX
puts "Using RCX ruleset '$::env(RCX_RULESET)'…"
define_process_corner -ext_model_index 0 CURRENT_CORNER
extract_parasitics $rcx_flags\
log_cmd extract_parasitics $rcx_flags\
-ext_model_file $::env(RCX_RULESET)\
-lef_res
write_views
2 changes: 1 addition & 1 deletion openlane/scripts/openroad/repair_design.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ if { $::env(DESIGN_REPAIR_BUFFER_OUTPUT_PORTS) } {
}

# Repair Design
repair_design -verbose \
log_cmd 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)
Expand Down
2 changes: 1 addition & 1 deletion openlane/scripts/openroad/repair_design_postgrt.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ source $::env(SCRIPTS_DIR)/openroad/common/grt.tcl
estimate_parasitics -global_routing

# Repair design
repair_design -verbose \
log_cmd 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)
Expand Down
4 changes: 2 additions & 2 deletions openlane/scripts/openroad/rsz_timing_postcts.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ 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
}
repair_timing {*}$arg_list
log_cmd repair_timing {*}$arg_list

set arg_list [list]
lappend arg_list -verbose
Expand All @@ -48,7 +48,7 @@ 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
}
repair_timing {*}$arg_list
log_cmd repair_timing {*}$arg_list

# Legalize
source $::env(SCRIPTS_DIR)/openroad/common/dpl.tcl
Expand Down
Loading
Loading