Skip to content

flow: auto-blackbox macros from ADDITIONAL_LIBS at slang elaboration - #4438

Closed
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:synth-syn-autoblackbox-libs
Closed

oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:synth-syn-autoblackbox-libs

Conversation

@oharboe

@oharboe oharboe commented Aug 16, 2026

Copy link
Copy Markdown
Collaborator

Automatically blackbox macros from ADDITIONAL_LIBS so that any competing Verilog definitions in the source files are ignored in favor of the liberty view. This mirrors the behavior the yosys+slang frontend gained for issue #3849 (synth_preamble.tcl), expressed through OpenSTA since the liberty views are already loaded here.

Automatically blackbox macros from ADDITIONAL_LIBS so that any competing
Verilog definitions in the source files are ignored in favor of the
liberty view. This mirrors the behavior the yosys+slang frontend gained
for issue The-OpenROAD-Project#3849 (synth_preamble.tcl), expressed through OpenSTA since
the liberty views are already loaded here.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>

@gemini-code-assist gemini-code-assist Bot left a comment

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.

Code Review

This pull request updates flow/scripts/synth_syn.tcl to automatically blackbox macros from ADDITIONAL_LIBS so that liberty views are preferred over competing Verilog definitions. The review feedback suggests a performance optimization to retrieve and unique-sort library cells in a single step instead of using nested loops.

Comment on lines +54 to +62
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"
}

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"
  }

@oharboe oharboe closed this Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant