YosysHQ / oss-cad-suite-build

Multi-platform nightly builds of open source digital design and verification tools
ISC License
774 stars 70 forks source link

ghdl plugin with windows #54

Open Martoni opened 1 year ago

Martoni commented 1 year ago

Is there a plan to integrate ghdl yosys plugin to yosys for windows platforms ?

gfcwfzkm commented 1 year ago

Would also be interested in it. Is there any way to use ghdl with yosys?

Martoni commented 1 year ago

Is there any way to use ghdl with yosys?

Yes, in Windows, the good way to use ghdl with yosys is to use a wsl distribution and follow Linux installation guide.

umarcor commented 1 year ago

@Martoni, I wouldn't say that "use another OS" is the "good way" of doing something on one OS. It can be an "acceptable workaround", but I find it misleading to see it considered "good". In other words, WSL works the same as Docker, VirtualBox or any other virtualisation solution, because it's GNU/Linux, not Windows. More precisely, GHDL had problems on WSL1; it is reported to work on WSL2 because those are essentially containers.

In order to have Windows binaries/executables that can be used on any Windows (Vista, 7, 8, 10, 11...) regardless of the version and OS virtualisation capabilities, the ghdl-yosys-plugin needs to be built into yosys (https://github.com/ghdl/ghdl-yosys-plugin#build-as-part-of-yosys-not-recommended), NOT as a module (https://github.com/ghdl/ghdl-yosys-plugin#build-as-a-module-shared-library). That's because, as far as I am aware, Yosys does not support loading shared libraries on Windows.

Package mingw-w64-yosys on MSYS2 includes ghdl-yosys-plugin already: https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-yosys/PKGBUILD#L46-L48. It's possible, although not straightforward, to create zipfiles from MSYS2 packages. See https://github.com/ghdl/ghdl/issues/1560.

Nevertheless, note that ghdl synth allows converting VHDL to Verilog without using Yosys. Then, Verilog sources can be fed into Yosys. Internally, GHDL does the same synthesis translations; the difference is the syntax of the output (Verilog or Yosys API). Several projects, such as Edalize or Litex, do use this two-step approach, instead of using ghdl as a plugin of yosys. See http://ghdl.github.io/ghdl/using/Synthesis.html#cmdoption-ghdl-out.