Did You Know YoSys Knows VHDL Too?

We’ve been fans of the Yosys / Nextpnr open-source FPGA toolchain for a long while now, and like [Michael] we had no idea that their oss-cad-suite installer sets up everything so that you can write in Verilog or VHDL, your choice. Very cool!

Verilog and VHDL are kind of like the C and ADA of the FPGA world. Verilog will seem familiar to you if you’re used to writing code for computers. For instance, it will turn integer variables into wires that carry the binary values for you. VHDL code looks odd from a software programmer’s perspective because it’s closer to the hardware and strongly typed: an 8-bit integer isn’t the same as eight wires in VHDL. VHDL is a bigger jump if you have software in your brain, but it’s also a lot closer to describing how the hardware actually works.

We learned Verilog, because it’s what Yosys supported. But thanks to GHDL, a VHDL analyzer and synthesizer, and the yosys-ghdl-plugin, you can write your logic in VHDL too. Does this put an end to the FPGA-language holy wars? Thanks, Yosys.

[Michael] points out that this isn’t really news, because the oss-cad-suite install has been doing this for a while now, but like him, it was news to us, and we thought we’d share it with you all.

Want to get started with FPGAs and the open-source toolchain? Our own [Al Williams] wrote up a nice FPGA Boot Camp series that’ll take you from bits to blinking in no time.

8 thoughts on “Did You Know YoSys Knows VHDL Too?

  1. Digikey’s introduction to FPGA is what I used to get started, though I’m sure Al’s boot camp is great, and the video nature of Digikey’s stuff did make referencing it difficult at times (and IIRC he used logic as an impromptu clock signal at one point, a big no-no which he acknowledged in a later vid).

    I wrote just enough Verilog to be able to really understand it (PWM, UART, an ultrasonic transceiver module, PID, an SoC based around picorv32). Importing and wiring up modules gets to be a real drag, especially if you have multiple instantiations, and especially if you want to instantiate instances of a module in multiple locations of a design. I’m not a purist that objects to its c-like syntax on principle, but I find it clunky in general, and there’s been a lot of tooling development that’s happened since that could catch a ton of bugs pre-synthesis (the one most easily at-hand is state machine enum completeness checking, and defining enums alongside their binary value is redundant and error-prone in and of itself).

    I haven’t touched VHDL, and a lot of people like it better, but there isn’t much going on with it in the open-source design world. Yes, yosys understands it, but if one is going to learn one of the industry standard HDLs, it seems to me that Verilog is the way to go. I also read enough complaints about it that it seems like it would merely be taking time to switch to the lesser of two evils.

    I’ve been moving into SpinalHDL, and it’s a breath of fresh air. It’s just my hobby stuff, so integration into larger Verilog/VHDL codebases isn’t a consideration for me, just my own time and sanity. It can output Verilog or VHDL, so you can just plug its output into your typical sim/pnr workflow.

  2. An important caveat on using VHDL with oss-cad-suite is that it doesn’t get bundled with the Windows builds (understandable, but disappointing). On Linux and Mac it works perfectly, but it makes VHDL just a little bit harder to use in workshop contexts.

  3. VHDL is pretty common outside the US.

    Also, there is VTR/Odin/VPR as another open source HDL toolchain based around the university Toronto.
    It’s actually the foundation of the design flow of Efinix FPGAs (they use Verific as the VHDL frontend).

    German company CologneChip uses Yosys I think. Can’t tell about CologneChip but Efinix is definitely production ready (we actually use it in a plethora of industrial designs, many GigE cameras are based around Efinix, too).

    1. CologneChip uses Yosys, too and it works like a charm. But so far I only used with CologneChip. They still use their own proprietary place and route but they plan to also switch to nextpnr in the near future. They also rely on openFPGALoader to program the flash. Installing the CologneChip toolchain was super easy (in Linux). Just download the tarball, extract it, go to the example dir, run “make” and that’s it.

  4. I’m US based and use VHDL daily for work using proprietary tools (of course). The one thing I take for granted at work is the ability to simulate mixed language designs.

    It’s pretty straight forward for the current tools to simulate one language or the other but not both at the same time.

    It took a few weeks but I finally have a nice little bash script to simulate mixed-langue designs via the CXXRTL backend and pipe the results right to GTKWave. Up to date documentation is scarce and writing a testbench in C is a little weird, but it’s a small price to pay (free!!)

    Next up, open source co-simulation!

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.