Skip to content

[slang] Automatically blackbox macros from ADDITIONAL_LIBS - #3967

Closed
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
Pinata-Consulting:claude-fixing
Closed

oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
Pinata-Consulting:claude-fixing

Conversation

@oharboe

@oharboe oharboe commented Mar 8, 2026

Copy link
Copy Markdown
Collaborator

@povik I tested Claude to see if it could fix this problem. Is this helpful?

When using the slang HDL frontend, macros defined in ADDITIONAL_LIBS liberty files were not automatically blackboxed. If the same module had a competing Verilog definition in the source files, slang would elaborate the Verilog version instead of using the liberty view.

Fix by extracting cell names from ADDITIONAL_LIBS and passing them as --blackboxed-module arguments to slang, making the behavior consistent with the builtin Verilog frontend.

Tested:

asap7/uart with a fake ADDITIONAL_LIBS containing uart_tx:
Confirmed slang blackboxes uart_tx from the liberty file
instead of elaborating it from the Verilog source.

asap7/cva6 (which uses slang and ADDITIONAL_LIBS with fakeram
macros that also have .sv definitions in VERILOG_FILES):
make DESIGN_CONFIG=designs/asap7/cva6/config.mk do-yosys-canonicalize
Passes in ~5s with no errors.

asap7/uart without ADDITIONAL_LIBS:
Normal synthesis still passes (no regression).

Fixes #3849

When using the slang HDL frontend, macros defined in ADDITIONAL_LIBS
liberty files were not automatically blackboxed. If the same module
had a competing Verilog definition in the source files, slang would
elaborate the Verilog version instead of using the liberty view.

Fix by extracting cell names from ADDITIONAL_LIBS and passing them
as --blackboxed-module arguments to slang, making the behavior
consistent with the builtin Verilog frontend.

Tested:

  asap7/uart with a fake ADDITIONAL_LIBS containing uart_tx:
    Confirmed slang blackboxes uart_tx from the liberty file
    instead of elaborating it from the Verilog source.

  asap7/cva6 (which uses slang and ADDITIONAL_LIBS with fakeram
    macros that also have .sv definitions in VERILOG_FILES):
    make DESIGN_CONFIG=designs/asap7/cva6/config.mk do-yosys-canonicalize
    Passes in ~5s with no errors.

  asap7/uart without ADDITIONAL_LIBS:
    Normal synthesis still passes (no regression).

Fixes The-OpenROAD-Project#3849

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@povik

povik commented Mar 10, 2026

Copy link
Copy Markdown
Contributor

@oharboe I have checked the CI logs to understand why your branch is failing on nangate45/mempool_group. It's because on master the design is impacted by #3849 and fakerams are not instantiated coming out of synthesis.

placement master
image

placement your branch
image

@povik povik 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.

We can ask yosys for the cell names which is more robust than the regex. I have the change locally but seem unable to push it to your branch due to permissions. Please can you fetch it from https://github.com/povik/OpenROAD-flow-scripts/tree/claude-fixing

@oharboe

oharboe commented Mar 10, 2026

Copy link
Copy Markdown
Collaborator Author

@povik I'm closing this PR and letting you run with it.

@oharboe oharboe closed this Mar 10, 2026
@oharboe
oharboe deleted the claude-fixing branch April 19, 2026 19:29
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.

[slang] Automatically blackbox macros from ADDITIONAL_LIBS

2 participants