Introduction: Project 1.1: Introduction to Digital Engineering and FPGA Boards
This is the first in a series of projects using Digilent materials that are created for EE214 at Washington State University . However, we decided that we wanted to make them more accessible to the general public, so I am creating them here. For more of Digilent's educational materials, see the Learn Site.
This project sets up your FPGA board for use and shows you the steps in starting project files. It also gives you some basic background knowledge on electrical engineering and digital circuits. This is a starter project with very little hands-on work with your board, but it is a good reference if you ever forget how to start your projects.
What you need:
- A Digilent FPGA board, This series will focus on the Nexys 4 and Basys 3.
- A PC with Internet access
- Time to set up the board and download tools
What you will gain:
- Xilinx Vivado Webpack installed
- A basic understanding of digital engineering
- Knowledge of setting up a Verilog project for your FPGA Board
I will not cover all the basic circuit theory necessary in this tutorial, but If you are interested you can follow these links:
Step 1: Basic Theory
The use of the word circuit in this context comes from the idea that electric power must flow from the positive terminal of a power source through one or more electronic devices and back to the negative terminal of a power source, thereby forming a circuit. If the connections between an electronic device and either the positive or negative terminals of a power supply are interrupted, the circuit will be broken and the device will not function.
A digital circuit consists of a power supply, devices, and conduction nets. Some nets provide circuit inputs from the “outside world”; in a schematic, these input nets are generally shown entering the left side of component and/or the overall circuit. Other nets present circuit outputs to the outside world; these nets are generally shown exiting the schematic on the right side. Circuit components are shown as arbitrary shapes, nets are shown as lines, and inputs and outputs are denoted by connector symbols. In a digital circuit, power supply voltage levels are constrained to two distinct values – “logic high voltage” (called LHV or Vdd) and “logic low voltage” (called LLV or GND). The GND node in any circuit is the universal reference voltage against which all other voltages are measured (in modern digital circuits, GND is typically the lowest voltage in the circuit). In a schematic, it is often difficult to show lines connecting all GND nodes; rather, any nodes labeled GND are assumed to be connected into the same node. The Vdd node in a digital circuit is typically the highest voltage, and all nodes labeled Vdd are tied together into the same node. Vdd may be thought of as the “source” of positive charges in a circuit, and GND may be thought of as the “source” of negative charges in a circuit. In modern digital systems, Vdd and GND are separated by anywhere from 1 to 5 volts. Older or inexpensive circuits typically use 5 volts, while newer circuits use 1-3 volts. In digital circuits, the Vdd and GND voltages are used not only to supply electric power to circuit devices; they are used to represent information as well. The most basic digital devices are called gates. The function of gates, or“gating,” is to allow or halt the flow of digital information. In general, a gate has one or more inputs and produces an output (more on that later). Now that you have a basic understanding of what digital engineering is and how the circuits function, let’s move on to setting up your FPGA board and getting started.
Step 2: Download the Vivado Tools and License
You will need to have a computer connected to the internet and some time for this step.
1. Install Xilinx Vivado WebPACK tools. All projects require a Xilinx Vivado Design Suite WebPACK Edition.
2. Open the Hardware Manager and request a license.
Step 3: Create a Vivado Project
Open Vivado:
Linux (See screenshot for reference):
First source the settings* with the following line;
source /(Filepath of Vivado setting you prefer)
Then open Vivado with the following line;
vivado & or vivado /(.xpr filepath**)
**To open a specific project replace the & with the filepath of the .xpr file.
*Note: There are four settings files available in the Vivado toolset: settings64.sh for use on 64-bit machines with bash; settings32.sh for use on 32-bit machines with bash; settings32.csh for use on 32-bit machines with C Shell; and settings64.csh for use on 64-bit machines with C Shell.
Windows:
Although Vivado is now compatible with Windows 8, I would highly recommend using Vivado on Linux as it runs much faster. For Windows installations, simply click on the icon.
Name the Project:
Name the project something helpful for when you have to find it and open it again. I usually name mine with the project number and a short title of what the project should be. That way you can find it whether you know what it is or what project number it is.
Step 4: Choose Sources
Next, Vivado will prompt you to choose sources for your project. If you already had source files you could add them here. However, you can also add them later.
Step 5: Project Type
Next, you will choose the appropriate project types. We will choose RTL Project. Vivado provides short descriptions beneath each project type.
Step 6: Add IP and Add Constraints
Next it will prompt you for IPs or constraints. Again, you can add these here or later, if you prefer. The constraints file is the .xdc file (.ucf in ISE.)
Step 7: Select Part
Next, Vivado will prompt you to select the part that you will be programming. You can find all the information you need on the chip itself, or if it is too difficult to read, in the reference manual. The image of the chip is from the Basys 3. I've labeled the information you need from it to select the part.
Hit next, then hit finish to finish creating the project.
Step 8: Finish Creating the Project
Hit finish and the empty project manager should open up.
Step 9: Add Sources
Download the appropriate demo files for your board.
Double-click on the constraints file and right-click on the folder inside. Then select add sources. This is where you will put the appropriate .xdc file.
Right click on design sources and add the appropriate .v file.
Step 10: Run Synthesis
Now that you have the correct Verilog and XDC files, you can build the project. Under flow navigator, click run synthesis.
Step 11: Run Implementation
After the synthesis is done, this window should appear. Select Run Implementation and click ok.
Step 12: Generate Bitstream
After the implementation is done, this window should appear. Select Generate Bitstream and click ok.
Step 13: Open Hardware Manager
After the Bitfile is generated, this window will appear. Select open hardware manager and click ok.
Step 14: Open New Hardware Target
Now that the Bitstream has completed, you can program the board. When the hardware manager opens, select Open a New Hardware Target, which is in blue text on the green bar.
Step 15: Select Server
Select the Server that the board is connected to. Generally that will be the local server.
Step 16: Select Target
Select the correct hardware target, hit next, and then finish.
Step 17: Program Device
In the Hardware Manager, select program device that will be in blue text on the green bar. Then select your board from the drop-down menu.
Step 18: Select Bitfile
The correct bitfile should already be selected, but double-check just to be sure. Then click program. You will see the demo operating and showing the green LEDs on except for one LED that is off, and moving across the LEDs. The seven-segment display will change through the different segments. When this is complete you have finished this project!