I started doing FPGA projects back in my second year of undergraduate, and it was really fun because it allowed me to create almost any digital circuits that I had in mind without having to fabricate a PCB.
In this tutorial, I will be walking through the steps necessary to start a FPGA project, create a digital circuit, and upload the digital circuit onto the FPGA.
- Getting Started with a FPGA project
- Creating a digital circuit
- Compiling and uploading onto the FPGA
I started by making an account on the Intel website to get myself a Intel Quartus Prime Lite 16.1.
You can start a project by going to File > New project wizard. Leave all the settings on default. Select Empty Project for the Project Type. For the Family, Device & Board Settings, select the chip used in your FPGA. In my case, I was using the DE10 Nano which uses a Cyclone® V, thus I selected 5CSEBA6U23I7S.
Try looking into your FPGA's manual or the FPGA product page for the chip's model number. If you have good eyes or a decent magnifying glass, another option is to check the small letters printed onto the FPGA's chip (you can ignore the last few characters printed onto the chip, like how mine says 5CSEBA6U23I7NDK but the NDK part can be ignored).
Leave all other settings on default and click Finish to end the project creation phase.
There are various ways to express a digital circuit, and these include the Verilog HDL and Block Diagrams. I will first talk about using the latter as this is more suited towards beginners who haven't learned Verilog HDL yet.
As an example, I will create a digital circuit that lights up an LED on the FPGA by pressing KEY1 or KEY2, or both.
Using Block Diagrams
Go to File > New > Block Diagram/Schematic File, it will bring you to a block diagram creation window.
To use a logic gate, click this icon.
Then go libraries menu, select /intelFPGA/16.1/quartus/libraries/ > primitives > logic to find your required logic gate (or simply type the logic name into the search bar). Here, I will be using or2, then you can click to place the logic gates onto your desired location.
After placing the or and not gate, input and output, my block diagram looks like the following.
The DE10 Nano's input KEYS are low while pressed, and high while released. Thus for the signal to be high when pressed, the not gate was added.
Using Verilog HDL
I highly recommend learning Verilog HDL, as this allows for more complex digital circuits to be created. When I tried making adders in Block Diagrams, it was extremely tedious (while it only required a few lines in Verilog HDL!). One place to get started with Verilog HDL would be Altera's Verilog HDL basics.
Go to File > New > Verilog HDL File. The digital circuit which was created previously can be written in Verilog HDL as shown in the following.
Save the Verilog File, make the name the same as the project name to make it a top level module.
For the pin locations, I looked up the DE10 Nano User Manual. The KEY inputs and LED output locations of the DE10 Nano were shown to be the following.
If everything completes successfully, the Task window should look like this.
Power on your FPGA and connect it to your computer.
Go to Tools > Programmer and click on Hardware Setup. It should automatically detect the FPGA, and it would be the DE-SoC in my case as shown below.
Now close the Hardware setup, and click on Auto Detect on the Programmer.
Before moving on, I highly recommend checking out the IoT System Design class on edX, as this is where I learned how to use the FPGA and it covers this topic in-depth.
Once you have familiarized yourself with Verilog HDL and Quartus Prime, you can move onto my next tutorial, which focuses on creating more complicated FPGA projects with external inputs and outputs.
Thank you for reading, and good luck with your FPGA projects!