Skip to content
Closed
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
17 changes: 17 additions & 0 deletions flow/scripts/synth_syn.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@ if { [env_var_exists_and_non_empty SYNTH_BLACKBOXES] } {
}
}

# Automatically blackbox macros from ADDITIONAL_LIBS so that any competing
# Verilog definitions in the source files are ignored in favor of the
# liberty view — the same behavior the yosys+slang frontend gained for
# issue #3849 (synth_preamble.tcl), expressed through OpenSTA since the
# liberty views are already loaded here (read_liberty.tcl above).
if { [env_var_exists_and_non_empty ADDITIONAL_LIBS] } {
set liberty_cells [dict create]
foreach lib [get_libs *] {
foreach cell [get_lib_cells "[get_name $lib]/*"] {
dict set liberty_cells [get_name $cell] 1
}
}
foreach m [dict keys $liberty_cells] {
lappend elaborate_args --blackboxed-module "$m"
}
Comment on lines +54 to +62

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

The nested loops querying get_libs and then querying get_lib_cells for each library individually can be slow, especially for designs with multiple large liberty files.

We can optimize this by querying all library cells at once using get_lib_cells */* and extracting their names with get_name. Using lsort -unique simplifies the code, avoids the need for a temporary dictionary, and is significantly faster.

  foreach m [lsort -unique [get_name [get_lib_cells */*]]] {
    lappend elaborate_args --blackboxed-module "$m"
  }

}

lappend elaborate_args {*}$::env(SYNTH_SLANG_ARGS)

# If the sources are solely .v files, enable Verilog compatibility
Expand Down