Skip to content

synth: extend SYNTH_KEEP_MODULES selection pattern for slang elaboration - #4381

Open
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:fix-synth-slang-module-selection
Open

synth: extend SYNTH_KEEP_MODULES selection pattern for slang elaboration#4381
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:fix-synth-slang-module-selection

Conversation

@oharboe

@oharboe oharboe commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

Extend module selection pattern in flow/scripts/synth.tcl to include $module* alongside $module\$* so kept module preservation (SYNTH_KEEP_MODULES) functions reliably for slang-elaborated modules.

@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 the synthesis script flow/scripts/synth.tcl to include a new wildcard pattern "$module*" to match slang-elaborated parameterized instances. Feedback on this change highlights that the wildcard pattern is too broad and acts as a prefix match, which could inadvertently match and keep unrelated modules (e.g., matching "cpu_alu" when "cpu" is specified) and prevent optimization. It is recommended to use a more restrictive pattern to avoid over-matching.

Comment thread flow/scripts/synth.tcl
# `-module <name>` would error if the module doesn't exist, which
# is why we use bare patterns instead.
select "$module" "$module\\\$*"
select "$module" "$module\\\$*" "$module*"

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

Using the wildcard pattern "$module*" acts as a prefix match and will match any module whose name starts with the module name. For example, if SYNTH_KEEP_MODULES contains "cpu", this pattern will also match and keep unrelated modules like "cpu_alu" or "cpu_ctrl". This prevents those unrelated modules from being flattened and optimized, which can negatively impact area and timing. If slang-elaborated parameterized modules are named with a specific separator (like an underscore or dollar sign), it is highly recommended to use a more restrictive pattern (such as "${module}_*" or the existing dollar-suffixed pattern) to avoid over-matching.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@povik I'm skeptical of Gemini when it comes to this .tcl Yosys select code.

The symptom here is that the netlist fails in verilator .saif emulation because pins are lost with -hier.

@oharboe oharboe closed this Jul 26, 2026
@oharboe
oharboe requested a review from povik July 26, 2026 19:17
@oharboe oharboe reopened this Jul 26, 2026
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
@oharboe
oharboe force-pushed the fix-synth-slang-module-selection branch from c068f48 to 4ba7421 Compare July 26, 2026 19:23
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