DEV Community ๐Ÿ‘ฉโ€๐Ÿ’ป๐Ÿ‘จโ€๐Ÿ’ป

Cover image for Getting started with FPGA projects on Intelยฎ Quartus Prime
Lena
Lena

Posted on • Updated on

Getting started with FPGA projects on Intelยฎ Quartus Prime

Hello everyone!
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.

Table Of Contents

Getting Started with a FPGA project

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.
Alt Text

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). Alt Text

Leave all other settings on default and click Finish to end the project creation phase.

Alt Text

Creating a digital circuit

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.
Alt Text
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.
Alt Text

For the inputs and outputs, click this icon and place them onto the desired locations.
Alt Text

After placing the or and not gate, input and output, my block diagram looks like the following.

Alt Text

We will now wire the components together by clicking on this icon.
Alt Text

After wiring the components together, it will look like the following.
Alt Text

Now save the block diagram, make the name the same as the project name to make it a top level module.
Alt Text

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.

Alt Text

Save the Verilog File, make the name the same as the project name to make it a top level module.

Compiling and uploading onto the FPGA

After creating the digital circuit (Block Diagram or Verilog HDL), double click on Analysis & Synthesis.
Alt Text

Once that completes successfully, go to Assignments > Pin Planner. At this point, the inputs and outputs have not yet been assigned their pins, and the pin locations are empty as shown below.
Alt Text

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.

Alt Text

In the Location column of the Pin Planner, I typed in the Pin names, and should look like the following.
Alt Text
Once that's done, close the Pin Planner. Now double click on the Compile Design.

If everything completes successfully, the Task window should look like this.

Alt Text

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.

Alt Text

(If your device is not detected, close the Programmer window, and type this into your command line and relaunch the Programmer.)
Alt Text

Now close the Hardware setup, and click on Auto Detect on the Programmer.

Double click on the FPGA device (5CSEBA6 in my case).
Alt Text

Then go to output_files and select the .sof file. Make sure the Program/Configure check box for the FPGA device is selected.
Alt Text

Press Start, and once the Progress bar reaches 100%, the FPGA should act as desired. In my case, pressing either KEY1 or KEY2 (or both) would light up the LED.
Alt Text

What's next?

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!

Top comments (0)

๐ŸŒš Life is too short to browse without dark mode