Skip to content

Commit

Permalink
Merge branch 'dev' into pnr-corners
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Jan 22, 2025
2 parents 5f01484 + f6fbadb commit 07f2c92
Show file tree
Hide file tree
Showing 6 changed files with 67 additions and 13 deletions.
4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@
* Added `DRT_SAVE_SNAPSHOTS` which enables saving snapshots of the layout each
detalied routing iteration.
* Added `DRT_SAVE_DRC_REPORT_ITERS`
* Added `DRT_ANTENNA_REPAIR_ITERS`, which if greater than zero, enables
antenna fixing after detailed routing
* Added `DRT_ANTENNA_MARGIN` which is similar to `GRT_ANTENNA_MARGIN` but for
the aforementioned antenna repair iterations

* `OpenROAD.GlobalPlacement`

Expand Down
2 changes: 1 addition & 1 deletion openlane/scripts/openroad/common/io.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -618,5 +618,5 @@ proc append_if_not_flag {list_arg glob_variable_name flag} {
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
proc log_cmd {cmd args} {
puts "+ $cmd [join $args " "]"
$cmd {*}$args
return [$cmd {*}$args]
}
50 changes: 42 additions & 8 deletions openlane/scripts/openroad/drt.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,22 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
proc drt_run {i args} {
set directory "drt-run-${i}"
file mkdir "$::env(STEP_DIR)/$directory"
set output_drc "-output_drc $::env(STEP_DIR)/$directory/$::env(DESIGN_NAME).drc"
log_cmd detailed_route {*}$args {*}$output_drc
if { $::env(DRT_SAVE_SNAPSHOTS) } {
foreach snapshot [glob -nocomplain drt_iter*.odb] {
file rename -force $snapshot $directory/[file tail $snapshot]
}
}
foreach drc_file [glob -nocomplain $::env(STEP_DIR)/$directory/*.drc] {
file copy -force $drc_file $::env(STEP_DIR)/[file tail $drc_file]
}
write_db $::env(STEP_DIR)/$directory/$::env(DESIGN_NAME).odb
}

source $::env(SCRIPTS_DIR)/openroad/common/io.tcl
read_current_odb

Expand All @@ -36,13 +52,31 @@ if { $::env(DRT_SAVE_SNAPSHOTS) } {
if { [info exists ::env(DRT_SAVE_DRC_REPORT_ITERS)] } {
set drc_report_iter_step_arg "-drc_report_iter_step $::env(DRT_SAVE_DRC_REPORT_ITERS)"
}
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\
{*}$drc_report_iter_step_arg

set i 0

set drt_args [list]
lappend drt_args -bottom_routing_layer $min_layer
lappend drt_args -top_routing_layer $max_layer
lappend drt_args -droute_end_iter $::env(DRT_OPT_ITERS)
lappend drt_args -or_seed 42
lappend drt_args -verbose 1
lappend drt_args {*}$drc_report_iter_step_arg
drt_run $i {*}$drt_args

incr i

set diode_cell [lindex [split $::env(DIODE_CELL) "/"] 0]

while {$i <= $::env(DRT_ANTENNA_REPAIR_ITERS) && [log_cmd check_antennas]} {
puts "\[INFO\] Running antenna repair iteration $i"
set diodes_inserted [log_cmd repair_antennas $diode_cell -ratio_margin $::env(DRT_ANTENNA_MARGIN)]
if {$diodes_inserted} {
drt_run $i {*}$drt_args
} else {
puts "\[INFO\] No diodes inserted. Ending antenna repair iterations."
break
}
incr i
}
write_views
13 changes: 13 additions & 0 deletions openlane/steps/openroad.py
Original file line number Diff line number Diff line change
Expand Up @@ -1708,6 +1708,19 @@ class DetailedRouting(OpenROADStep):
"This is an experimental variable. Saves an odb snapshot of the layout each routing iteration. This generates multiple odb files increasing disk usage.",
default=False,
),
Variable(
"DRT_ANTENNA_REPAIR_ITERS",
int,
"The maximum number of iterations to run antenna repair. Set to a positive integer to attempt to repair antennas and then re-run DRT as appropriate.",
default=0,
),
Variable(
"DRT_ANTENNA_MARGIN",
int,
"The margin to over fix antenna violations.",
default=10,
units="%",
),
Variable(
"DRT_SAVE_DRC_REPORT_ITERS",
Optional[int],
Expand Down
9 changes: 6 additions & 3 deletions openlane/steps/step.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,9 +1315,12 @@ def run_subprocess(
link_start = f"[link=file://{os.path.abspath(log_path)}]"
link_end = "[/link]"

verbose(
f"Logging subprocess to [repr.filename]{link_start}'{os.path.relpath(log_path)}'{link_end}[/repr.filename]…"
)
msg = f"Logging subprocess to [repr.filename]{link_start}'{os.path.relpath(log_path)}'{link_end}[/repr.filename]…"
if logging.options.get_condensed_mode():
info(msg)
else:
verbose(msg)

process = _popen_callable(
cmd_str,
encoding="utf8",
Expand Down
2 changes: 1 addition & 1 deletion test/designs

0 comments on commit 07f2c92

Please sign in to comment.