Microcontrollers are deservedly a favorite component for many electronics hobbyists. They’re straightforward to use, cheap, powerful, and capable of doing any number of simple tasks well. The popularity of the Arduino ecosystem — not just the boards, but the IDE and the whole Arduino way of doing things — makes microcontroller-based prototyping easy, fast, and fun.
Although popular dev boards like Digilent‘s BASYS series do exist, FPGAs have been largely left out of this revolution. Programming even a low-end Spartan3E FPGA requires downloading, licensing, configuring, and installing ISE Webpack — a huge set of utilities from Xilinx. The download is several gigabytes, and it all unpacks to something like 10GB once installed.
Webpack, like the name would imply, is a suite of programs that work together to produce the final configuration bitstream for the FPGA. The IDE works with a synthesis tool as well as PlanAhead, where you plan out the inputs and outputs in terms of pins on the FPGA itself (not the board.) Once all that is done, you generally need an uploader program like Digilent‘s Adept. This is straightforward and reliable to use, but it’s an additional step.
Wouldn’t it be nice if something more like the Arduino IDE existed, with an option to quickly compile-and-upload to test code? Even better, what if you could use such an IDE with an inexpensive, breadboardable FPGA-on-a-stick?
The TinyFPGA BX board, plus the amazing ICEStudio IDE, makes this a reality. We finally have an open-source FPGA toolchain that makes getting up and prototyping with FPGAs almost as easy as programming an Arduino board.
FPGAs are, of course, fundamentally different from microcontrollers. Instead of having a fixed set of instructions to be executed, FPGAs are best thought of as a “sea of logic gates” which can be made into whatever sort of digital hardware you need for your task. You don’t tell them what to do — you tell them what to be.
If you’re used to thinking procedurally and writing programs in procedural languages such as C (and Python, and Java, and BASIC, and Fortran, and so on), this can take some getting used to. (One popular solution is to actually instantiate a microcontroller in the FPGA logic, and then program that in C, which sounds like cheating but works.)
The advantages to FPGAs, though, are that they’re inherently as parallel as you want them to be. FPGAs don’t have to just do one thing at a time; they can have hundreds or thousands of processes executing independently on different parts of the chip. They’re also fast. The TinyFPGA BX runs at 16MHz, which is pretty slow for an FPGA — but because the logic is so configurable, it can get a lot done in that one clock cycle. Simple Boolean logic and binary arithmetic can be done in real time, even if you need dozens or hundreds of calculations done in parallel.
ICEStudio tries to make this way of developing as intuitive as possible. FPGA-based design is often done with a mix of code and schematic capture, with data in the form of either single bits or buses representing binary numbers being carried from one module to another by lines.
For devices like FPGAs, which can be thought of as dataflow devices more than as procedural devices, it works. This approach is flexible enough to allow you to code what you like and connect the rest. Click on a module, edit the code, then press ctrl-u to compile and upload. Easy.
A breadboardable, open-source FPGA toolchain — and one that can go from updated code to reprogrammed board in ten seconds or so (for simple solutions like the example above)?
Global pandemics not withstanding, I love living in the future.