Skip to content

synth: load the slang plugin when read_slang is not built in - #4476

Closed
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:slang-plugin-fallback
Closed

synth: load the slang plugin when read_slang is not built in#4476
oharboe wants to merge 1 commit into
The-OpenROAD-Project:masterfrom
oharboe:slang-plugin-fallback

Conversation

@oharboe

@oharboe oharboe commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

b18e110c1 ("drop bundled yosys-slang, use Yosys 0.67 built-in read_slang") removed the explicit plugin load from synth_preamble.tcl, on the strength of Yosys 0.67 vendoring the slang frontend under frontends/slang. That is correct for 0.67+ — I confirmed frontends/slang is absent in v0.65/v0.66 and present in v0.67/v0.68.

It leaves Yosys 0.66 and older with no way to use SYNTH_HDL_FRONTEND=slang:

ERROR: No such command: read_slang (type 'help' for a command overview)

even when the same code is available as the out-of-tree plugin (povik/sv-elab, formerly yosys-slang) and is already on YOSYS_PLUGIN_PATH — because nothing loads it any more.

This is not hypothetical: the Bazel Central Registry yosys module is still on 0.64. Yosys ships no Bazel files upstream, so that module is a hand-written overlay and nobody has carried it past 0.64. Every ORFS consumer building through BCR yosys is on 0.64 and cannot use the slang frontend today.

The change

if { [info commands read_slang] eq "" } {
  plugin -i slang
}

plugin -i slang resolves through YOSYS_PLUGIN_PATH. The guard makes it a strict no-op on a Yosys that has the frontend built in, so ORFS works against either without the caller having to declare which it has — and 0.67+ behaviour is unchanged.

Testing

Exercised through bazel-orfs, whose //slang:test and //slang:blackbox_synth targets are regression coverage for exactly this path (slang frontend, and SYNTH_BLACKBOXES + --empty-blackboxes through it). Both had been failing since b18e110c1; both build green with this patch against BCR yosys 0.64.

Yosys 0.67 vendors the slang frontend under frontends/slang, so
read_slang is a built-in command there and the explicit plugin load
was dropped. Yosys 0.66 and older do not have it, and the same code is
available to them as an out-of-tree plugin (povik/sv-elab, formerly
yosys-slang) -- which is what the Bazel build in bazel-orfs supplies,
since the BCR yosys module is still on 0.64.

On such a Yosys, SYNTH_HDL_FRONTEND=slang now fails with

  ERROR: No such command: read_slang (type 'help' for a command overview)

even though the plugin is on YOSYS_PLUGIN_PATH, because nothing loads
it any more.

Load it when, and only when, the command is absent. `plugin -i slang`
resolves through YOSYS_PLUGIN_PATH, and the guard makes this a no-op
on a Yosys that has the frontend built in, so ORFS works against
either without the caller having to say which it has.

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 the synthesis preamble script (flow/scripts/synth_preamble.tcl) to conditionally load the slang plugin if the read_slang command is not already available. This ensures compatibility with older Yosys versions that do not have the frontend built-in, while remaining a no-op for newer versions. There are no review comments, so I have no feedback to provide.

@oharboe

oharboe commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator Author

let lie for now

@oharboe oharboe closed this Aug 26, 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