From 6e3c3f161c4b99e36792592db396603dbd021910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Fri, 10 Apr 2026 12:24:58 +0200 Subject: [PATCH 1/2] Support SLANG_PLUGIN_PATH env var for custom slang plugin location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When SYNTH_HDL_FRONTEND=slang, the plugin load is hardcoded as `plugin -i slang`. This adds a check for SLANG_PLUGIN_PATH, falling back to the current behavior when unset. This enables Bazel-built slang plugins to be loaded from a custom path, which is needed for downstream consumers that build yosys-slang from source. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Øyvind Harboe --- flow/scripts/synth_preamble.tcl | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flow/scripts/synth_preamble.tcl b/flow/scripts/synth_preamble.tcl index 3edee2d454..afd7d7ebf9 100644 --- a/flow/scripts/synth_preamble.tcl +++ b/flow/scripts/synth_preamble.tcl @@ -44,7 +44,11 @@ proc read_design_sources { } { } if { [env_var_equals SYNTH_HDL_FRONTEND slang] } { - plugin -i slang + if { [info exists ::env(SLANG_PLUGIN_PATH)] } { + plugin -i $::env(SLANG_PLUGIN_PATH) + } else { + plugin -i slang + } set slang_args [list \ -D SYNTHESIS --keep-hierarchy --compat=vcs --ignore-assertions --top $::env(DESIGN_NAME) \ From 7125f81d34624bf89ca53dc45cf6797956e46b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Sat, 11 Apr 2026 07:25:25 +0200 Subject: [PATCH 2/2] Move SLANG_PLUGIN_PATH to variables.yaml with default "slang" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of a custom env var check, define SLANG_PLUGIN_PATH as a regular flow variable with a default of "slang". This follows the standard ORFS variable pattern and makes the option visible in the flow documentation. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Øyvind Harboe --- docs/user/FlowVariables.md | 2 ++ flow/scripts/synth_preamble.tcl | 6 +----- flow/scripts/variables.yaml | 7 +++++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/user/FlowVariables.md b/docs/user/FlowVariables.md index 7a7c3e222b..efa579d686 100644 --- a/docs/user/FlowVariables.md +++ b/docs/user/FlowVariables.md @@ -273,6 +273,7 @@ configuration file. | SKIP_REPAIR_TIE_FANOUT| Skip repair_tie_fanout at floorplan step.| 0| | SKIP_REPORT_METRICS| If set to 1, then metrics, report_metrics does nothing. Useful to speed up builds.| 0| | SKIP_VT_SWAP| Do not perform VT swap to improve QoR (default: do VT swap).| | +| SLANG_PLUGIN_PATH| Path to the slang plugin for Yosys. This can be a full path to a custom-built plugin (e.g. for Bazel builds) or just the plugin name.| slang| | SLEW_MARGIN| Specifies a slew margin when fixing max slew violations. This option allows you to overfix.| | | SWAP_ARITH_OPERATORS| Improve timing QoR by swapping ALU and MULT arithmetic operators.| | | SYNTH_ARGS| Optional synthesis variables for yosys.| | @@ -326,6 +327,7 @@ configuration file. - [PRE_SYNTH_TCL](#PRE_SYNTH_TCL) - [SDC_FILE](#SDC_FILE) - [SDC_GUT](#SDC_GUT) +- [SLANG_PLUGIN_PATH](#SLANG_PLUGIN_PATH) - [SYNTH_ARGS](#SYNTH_ARGS) - [SYNTH_BLACKBOXES](#SYNTH_BLACKBOXES) - [SYNTH_CANONICALIZE_TCL](#SYNTH_CANONICALIZE_TCL) diff --git a/flow/scripts/synth_preamble.tcl b/flow/scripts/synth_preamble.tcl index afd7d7ebf9..af43512c0f 100644 --- a/flow/scripts/synth_preamble.tcl +++ b/flow/scripts/synth_preamble.tcl @@ -44,11 +44,7 @@ proc read_design_sources { } { } if { [env_var_equals SYNTH_HDL_FRONTEND slang] } { - if { [info exists ::env(SLANG_PLUGIN_PATH)] } { - plugin -i $::env(SLANG_PLUGIN_PATH) - } else { - plugin -i slang - } + plugin -i $::env(SLANG_PLUGIN_PATH) set slang_args [list \ -D SYNTHESIS --keep-hierarchy --compat=vcs --ignore-assertions --top $::env(DESIGN_NAME) \ diff --git a/flow/scripts/variables.yaml b/flow/scripts/variables.yaml index fdf068ba83..cf99a5fac5 100644 --- a/flow/scripts/variables.yaml +++ b/flow/scripts/variables.yaml @@ -238,6 +238,13 @@ SYNTH_HDL_FRONTEND: command. stages: - synth +SLANG_PLUGIN_PATH: + description: > + Path to the slang plugin for Yosys. This can be a full path to a + custom-built plugin (e.g. for Bazel builds) or just the plugin name. + default: slang + stages: + - synth SYNTH_SLANG_ARGS: description: > Additional arguments passed to the slang frontend during synthesis.