From 4e01d48e7f9f0dfbdde7d65c442c2cc8680c0f89 Mon Sep 17 00:00:00 2001 From: Nikolay Puzanov Date: Wed, 7 Jan 2026 17:26:04 +0300 Subject: [PATCH] Fix compatibility with OSS-CAD-SUITE Rework the way the Yosys slang plugin is loaded in `build.mill`. The environment variable `YOSYS_SLANG_SO` is now accessed with `sys.env.get` to avoid a hard failure when it is not set. If the variable is present, `-m $YOSYS_SLANG_SO` is passed to Yosys; otherwise the plugin is loaded via `plugin -i slang`. --- build.mill | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/build.mill b/build.mill index 15a8154..5b8f545 100644 --- a/build.mill +++ b/build.mill @@ -107,11 +107,16 @@ trait GowinFlow extends Flow { case _ => "" } - val yosysSlangPlugin = sys.env("YOSYS_SLANG_SO") + val yosysSlangPluginSo = sys.env.get("YOSYS_SLANG_SO") + + val (pluginArg, pluginCmd) = yosysSlangPluginSo match { + case Some(soName) => (Seq("-m", soName), "") + case _ => (Seq(), "plugin -i slang;") + } os.call(( - "yosys", "-m", yosysSlangPlugin, "-l", s"$out/yosys.log", "-p", - s"read_slang $genSrc $stSrc; synth_gowin $topCmd -nowidelut -json $synthJson" + "yosys", pluginArg, "-l", s"$out/yosys.log", "-p", + s"$pluginCmd read_slang $genSrc $stSrc; synth_gowin $topCmd -nowidelut -json $synthJson" )) PathRef(synthJson)