What is YoWASP?
Why use WebAssembly?
A batch compiler, such as an FPGA toolchain, transforms input files to output files without using any OS services beyond basic bookkeeping. Is it really necessary to build something so fundamentally simple for a large matrix of every OS × every CPU? With WebAssembly and WASI, it is now possible to build a single universal binary that runs on many OSes and CPUs.
Do I need a browser?
Despite the name, WebAssembly is not tied to browsers; it is a kind of machine code that can be easily translated into x86, ARM, or other machine code that your CPU runs directly. The YoWASP project currently does not provide tools that can run in a browser.
Why use language package managers?
Many new hardware definition languages are embedded in another host language, which comes with its own package manager and repository. For example, nMigen is embedded in Python, which uses pip and PyPI. There are several benefits in distributing FPGA tools via language package managers:
- Designers working in such HDLs are already familiar with the package manager of the host language, making it is a convenient distribution mechanism;
- Synthesis and PnR tools can be added as ordinary dependencies to the project, and their versions can be frozen for reproducibility;
- “Turnkey” toolchain installation enables new applications that generate FPGA bitstreams just-in-time, or use synthesis tools to transform netlists.
Which tools are provided?
This project provides packages for:
- nextpnr upstream repository;
- Project IceStorm upstream repository;
- Project Trellis upstream repository;
- package repository;
- iCE40 PyPI packages: yowasp-nextpnr-ice40, yowasp-nextpnr-ice40-all, yowasp-nextpnr-ice40-384, yowasp-nextpnr-ice40-1k, yowasp-nextpnr-ice40-u4k, yowasp-nextpnr-ice40-5k, yowasp-nextpnr-ice40-8k.
- ECP5 PyPI packages: yowasp-nextpnr-ecp5, yowasp-nextpnr-ecp5-all, yowasp-nextpnr-ecp5-25k, yowasp-nextpnr-ecp5-45k, yowasp-nextpnr-ecp5-85k.
Which platforms are supported?
YoWASP relies on a WebAssembly engine to run the WASM code, and inherits both its advantages and its limitations.
YoWASP is an early technology preview. At the moment, it uses the Wasmtime engine, which supports the following platforms:
- Linux (x86_64 and AArch64),
- macOS (x86_64),
- Windows (x86_64).
This list is unfortunately short. The maintainer of YoWASP is working together with the maintainers of several WebAssembly engines to expand it.
Are there other packages?
YoWASP isn’t the only project that packages the open-source FPGA toolchain, and it has some limitations. One of the following projects may suit your workflow better:
- Open Tool Forge toolchain is a native build (x86_64 only) that includes GHDL and programming tools (
How do I use the tools…
… with Python?
To use Yosys, install the
yowasp-yosys package using pip or add it as a dependency.
To use nextpnr-ice40, install the
yowasp-nextpnr-ice40-all package using pip or add it as a dependency. It is also possible to install individual
yowasp-nextpnr-ice40-<chip> packages (where
384 for iCE40LP384,
1k for iCE40LP1K and iCE40HX1K,
5k for iCE40UP5K,
8k for iCE40LP8K and iCE40HX8K, and
u4k for iCE5LP4K) if only a subset of all supported devices is wanted.
To use nextpnr-ecp5, install the
yowasp-nextpnr-ecp5-all package using pip or add it as a dependency. It is also possible to install individual
yowasp-nextpnr-ecp5-<chip> packages (where
25k for LFE5U-12F and LFE5U/UM/UM5G-25F,
45k for LFE5U/UM/UM5G-45F, and
85k for LFE5U/UM/UM5G-85F) if only a subset of all supported devices is wanted.
The installed binaries are prefixed with
yowasp-. Try running e.g.
yowasp-yosys --version to see if everything works! When the tools are run for the first time, it will take a few seconds for them to be compiled to machine code.
If the packages are installed in a virtualenv, they will only be available in that virtual environment. Otherwise, they will be available system-wide or user-wide, similar to any other Python scripts installed via pip.
… with other languages?
At the moment, only PyPI packages are provided. Open an issue if you’d like YoWASP packages to be built for another ecosystem.
Are the tools slower?
Yosys built for WebAssembly is about twice as slow as a native build. Nextpnr built for WebAssembly runs about as fast as a native build.
How are the packages released?
Every day, latest upstream changes are automatically pulled in, packaged, and uploaded to Test PyPI. Every week, after manual review, latest upstream changes are packaged, uploaded to PyPI, and become available to downstream users.