From 1ae71d0dba7280104c3f7416768d4679a1cf20e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Sun, 16 Aug 2026 14:13:56 +0200 Subject: [PATCH] flow: auto-blackbox macros from ADDITIONAL_LIBS at slang elaboration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Signed-off-by: Øyvind Harboe --- flow/scripts/synth_syn.tcl | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/flow/scripts/synth_syn.tcl b/flow/scripts/synth_syn.tcl index bd6eaf0820..4e40ec68f6 100644 --- a/flow/scripts/synth_syn.tcl +++ b/flow/scripts/synth_syn.tcl @@ -45,6 +45,23 @@ if { [env_var_exists_and_non_empty SYNTH_BLACKBOXES] } { } } +# Automatically blackbox macros from ADDITIONAL_LIBS so that any competing +# Verilog definitions in the source files are ignored in favor of the +# liberty view — the same behavior the yosys+slang frontend gained for +# issue #3849 (synth_preamble.tcl), expressed through OpenSTA since the +# liberty views are already loaded here (read_liberty.tcl above). +if { [env_var_exists_and_non_empty ADDITIONAL_LIBS] } { + 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" + } +} + lappend elaborate_args {*}$::env(SYNTH_SLANG_ARGS) # If the sources are solely .v files, enable Verilog compatibility