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`.
This commit is contained in:
Nikolay Puzanov 2026-01-07 17:26:04 +03:00
parent 7e0a878e6c
commit 4e01d48e7f

View File

@ -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)