Want To Play With FPGAs? Use Your Pico!

a Pi Pico on a breadboard, running a 7-segment counter gateware, with a 7-segment digit and a pushbutton next to the Pico

Ever want to play with an FPGA, but don’t have the hardware? Now, if you have one of those ever-abundant Pi Picos, you can start playing with Verilog without getting an FPGA board. The FakePGA project by [tvlad1234], based on the Verilator toolkit, provides you with a way to compile Verilog into C++ for the RP2040. FakePGA even integrates RP2040 GPIOs so that they work as digital pins for the simulated GPIOs, making it a significant step up from computer-aided FPGA code simulation

[tvlad1234] provides instructions for setting this up with Linux – Windows, though untested, could theoretically run this through WSL. Maximum clock speed is 5KHz – not much, but way better than not having any hardware to test with. Everything you’d want is in the GitHub repo – setup instructions, Verilog code requirements, and a few configuration caveats to keep in mind.

We cover a lot of projects where FPGAs are used to emulate hardware of various kinds, from ISA cards to an entire Game BoyCPU emulation on FPGAs is basically the norm — it’s just something easy to do with the kind of power that an FPGA provides. Having emulation in the opposite direction is unusual,  though, we’ve seen FPGAs being emulated with FPGAs, so perhaps it was inevitable after all. Of course, if you have neither a Pico nor an FPGA, there’s always browser based emulators.

We thank [Randy Glenn] for sharing this with us!

20 thoughts on “Want To Play With FPGAs? Use Your Pico!

  1. >compile Verilog into C++

    But then it is not verilog anymore and not even C++. It’s machine code. If a high level language boils only down to mere convenience and experience in using it, you are just limited by the ability of the compiler to interpret and optimize your code to machine code. As obvious as that may sound.

    The less steps you take, the better it should be in theory. Unless the compiler is more capable than the user.

    1. That obviously heavily depends on the implementation. You can easily build a Verilog compiler that emits much less efficient machine code than a clever Verilog to C++ transpiler used in conjunction with a heavily optimising C++ compiler.

      The C++ intermediate step also enables much better hardware support. Nobody wants to reimplement Verilog compiler backends for every microcontroller architecture out there.

    2. Verilog on an actual FPGA isn’t verilog anymore either, it’s a bitstream which sets control bits in various lookup tables and routing muxes. And all digital logic is an abstraction on top of physics, so not sure why one level is more legitimate than another.

  2. With 5kHz maximum clock speed i doubt this is useful for anything pratical, but it is a neat hack. If you want real FPGA look at the open toolchain Yosys/nextpnr. There are (repurposed or made on purpose) dev-boards on the usual websites but it’s more expensive then a Pico, but much faster too…

    1. It is very useful to be able to run the verilog, on “real hardware” (interfacing with say a 7 segment display) to learn the language.

      If that’s succesful it will provide a path towards wanting to implement faster stuff on real hardware and spending the $20 – $100 on a “first FPGA dev board”.

      1. Well, i don’t agree totally. Of course you can do some stuff and learn some Verilog, but good luck implementing say a simple UART or dimm an LED using PWM with a 5kHz clock. But still, it certainly has usecases, especially if you want to sneak(?) into FPGA without spending money. A Pico is (was?) cheap and probably already in a lot of drawers of the people reading HaD.

        1. Picos are quite cheap, and widely available. I haven’t yet had problems getting one when I needed it.

          Simple UARTs are quite well within a 5 kHz clock’s capability. Sure, you won’t get 115,200 baud or anything, but most of the classical UARTs can’t do that, either.

          This isn’t so much intended to be a deployable system. It’s designed to give people a way of wrapping their head around FPGA-style technical paradigms. A good fpga simulator can do that too, but some people have a problem wrapping their heads around a purely-simulated learning environment. This is, after all, why breadboards are so popular relative to circuit emulators, even with all the problems a breadboard can cause.

  3. Nice for getting practice with FPGA development without needing expensive FPGA dev boards or ghastly proprietary complier toolchains, at a 5KHz clock speed it isn’t good for much mroe than practice though, a normal microcontroller would perform virtually any task faster. What I’d really like to see would be an open-source toolchain for programming actual FPGAs.

  4. I want to experiment with FPGA, but the software to program them is huge, and engineering getto stuff. You sign up, give them all of your personal details. Then download a GB of stuff, install it, fluffing it up even more–and then when you start it, your are greeted with a Java implementation of a Windows 3.11 application.

    1. Again, look at (and even better, support) Yosys! No sign up, no personal details, no spyware phoning home and not too big i think. And it works!
      (I am not “affiliated” with this project, just a happy user.)

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.