I don’t know why, but I woke up a few weeks ago with an urge to teach myself FPGA programming. Here’s how I went about it.
At the risk of sounding slightly immodest, I consider myself to have a “working man’s knowledge” of computer architecture, embedded systems, and programming languages. In my occupation, it’s important to be able to have meaningful conversations with engineers, and knowing the basics of hardware and software design is a prerequisite. And, in my youth, I had a couple of jobs as a programmer. At the risk of dating myself, I became pretty proficient at Cobol, Pascal, Basic, PL/I, and other obscure languages that you may never have heard of. And today, although I don’t program for a living anymore, I can sometimes be found reading programs written in ‘C’, Python and others to get some insight into how they work.
But one thing I never got around to learning was a hardware description language (HDL), such as Verilog or VHDL. These are examples of register transfer language (RTL), that is fed into a logic synthesis tool (like Xilinx’s Vivado) which in turn creates the gate-level abstraction of the design. RTLs are pretty close to assembly language, and require a pretty good low-level electronics knowledge. So, bring it on!
After some hours of research, I settle upon the following three things that I needed:
Digilent Basys 3 FPGA Trainer Board
Udemy Learn Vivado from Top to Bottom training course
The Basys 3 is a good educational board, and there seems to be a lot of training material (including YouTube videos) available to learn from. It sports a Xilinx Artix-7 with 33,280 logic cells in 5,200 slices (with each slice containing four 6-input LUTs and 8 flip-flops – you’ll want to go to www.fpga4fun.com or some other introductory site to learn what this means). The board costs $149.
The Udemy training course is a good introduction to getting Vivado up and running and programming your Basys 3 board. It’s not a perfect training course – some of the material is a little dated, and I had to scratch my head at a few places to match what was in the course versus what Vivado was displaying – but it’s been perfect for my needs so far. I’m about halfway through the course now. I paid $9.99 for the course – pretty cheap, and I can watch it at my own pace.
Installing Vivado was a time-consuming process. I probably did it three times, trying to figure out why the application wasn’t visible (even though the installation seemed to succeed). After quite a bit of digging, I came across AR# 47821, Vivado – How do I source or setup the Vivado environment? to finally learn you need to run a settings64.bat script and then run vivado.bat:
I then started to plow my way through the Udemy training, and had a lot of fun along the way. So far, I’ve successfully programmed the Basys 3 with the seg_display.xpr project that comes with the course:
Once you unplug the board, of course, all programming is lost, and you resort to the default program (that presumably boots out of the on-board QSPI flash that is on the board), which just continually cycles the 4-digit 7-segment display from 0000 -> 9999:
That’s it for now. I’ll continue this blog series as I keep plowing through the course and more good examples available on the web.