Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!

Vlad Tomoiagă's FakePGA Turns a Raspberry Pi Pico or Other RP2040 Board Into a Slow, Cheap "FPGA"

Clever simulator lets you take Verilog projects into the world of hardware without splashing out on expensive or out-of-stock FPGA parts.

Gareth Halfacree
2 years agoFPGAs / HW101

Electronics engineering student Vlad Tomoiagă has come up with a neat way to experiment with field-programmable gate array (FPGA) concepts without having to splash out on an actual FPGA — by simulating one on a Raspberry Pi Pico or other RP2040-based microcontroller board.

"This project aims to simulate Verilog HDL [Hardware Description Language] designs on a Raspberry Pi Pico (or any other RP2040-based board)," Tomoiagă explains of FakePGA. "It achieves this by using Verilator to compile the RTL [Register Transfer Level code] into a cycle-accurate C++ model of your design which can then be executed on the microcontroller. This allows you to access the signals of the simulated design through the GPIO [General-Purpose Input/Output] pins of the board, which gives a more hands-on experience than simulating on a computer."

There is, of course, no such thing as a free lunch — and the FakePGA project brings a few caveats, not least of which is performance: with a maximum simulated clock speed of 5kHz, which rapidly drops as the complexity of the Verilog project compiled increases, Tomoiagă admits that FakePGA is "many orders of magnitude slower than a real FPGA." With component shortages still continuing to hit many popular FPGA parts, though, and prices for others increasing accordingly, it's a handy stop-gap or introductory platform for those taking their first steps with FPGAs.

The tool is compatible with any RP2040-based microcontroller board including the low-cost Raspberry Pi Pico, and includes a sample Verilog hardware definition that blinks the on-board LED of the latter and accepts two push-button inputs. The compilation toolchain is built for Linux, with Tomoiagă noting it "could work on Windows" but that it has only been tested on Canonical's Ubuntu Linux.

"In terms of user experience," Tomoiagă concludes, "it feels like using a slower FPGA (at least for simpler designs), hence the name of the project: FakePGA."

FakePGA's source code is available on GitHub under the reciprocal GNU General Public License 3; it requires the Raspberry Pi Pico C/C++ software development kit (SDK) and the Verilator package to be installed on the host system.

Gareth Halfacree
Freelance journalist, technical author, hacker, tinkerer, erstwhile sysadmin. For hire: freelance@halfacree.co.uk.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles