Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| programmable-logic:guides:getting-started-with-vivado [2022/10/03 15:28] – [Prerequisites] unrelevant | programmable-logic:guides:getting-started-with-vivado [2022/10/04 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ~~TechArticle~~ | ||
| + | ====== Getting Started with Vivado for Hardware-Only Designs ====== | ||
| + | ===== Introduction ===== | ||
| + | {{ learn/ | ||
| + | |||
| + | The goal of this guide is to familiarize the reader with the Vivado tools through the "Hello World!" | ||
| + | |||
| + | **Note:** //While this guide was originally created using Vivado 2016.4, the workflow described has not substantially changed, and the guide works as described through to Vivado 2020.1, the latest version as of time of writing.// | ||
| + | |||
| + | ---- | ||
| + | ===== Prerequisites ===== | ||
| + | Prior to starting this guide make sure to install Vivado: | ||
| + | * For versions 2019.2 and later, see [[vivado: | ||
| + | * For versions prior to 2019.2, see [[vivado: | ||
| + | |||
| + | ---- | ||
| + | ===== Guide ===== | ||
| + | |||
| + | {{page> | ||
| + | |||
| + | {{page> | ||
| + | |||
| + | ==== The Flow Navigator ==== | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The //Flow Navigator// is the most important pane of the main Vivado window to know. It is how a user navigates between different tools within Vivado. | ||
| + | |||
| + | The Navigator is broken into seven sections: | ||
| + | * //Project Manager// | ||
| + | * Access project settings, add new source files, view snippets of useful RTL code, and add components of a hardware design (IP) included within the tool to your own design. | ||
| + | * //IP Integrator// | ||
| + | * Create a hardware design through the use of a Block Design by connecting IP blocks together. | ||
| + | * // | ||
| + | * Debug and verify a hardware design fully within software, without deploying it to hardware. | ||
| + | * //RTL Analysis// | ||
| + | * See how the tools are interpreting a design by viewing the circuit that the design describes. | ||
| + | * // | ||
| + | * Modify Synthesis settings and view post-synthesis reports - determine whether the design meets timing, and how much of the chip resources it will use. | ||
| + | * // | ||
| + | * Modify Implementation settings and view post-implementation reports - determine whether the design meets timing, and how much of the chip resources it will use. | ||
| + | * //Program and Debug// | ||
| + | * Access to settings for bitstream generation and the Hardware Manager. Used to build a design and deploy it to a board. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ vivado: | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | ==== The Project Manager ==== | ||
| + | |||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | This tool is where most development will occur and is the initial tool open after creating a new project. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The //Project Manager// consists of four panes, // | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The //Sources// pane contains the project hierarchy and is used for opening up files. The folder structure is organized such that the HDL files are kept under the //Design Sources// folder, constraints are kept under the // | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The // | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The unnamed pane at the bottom of the Project Manager window consists of several different useful tools for debugging a project. The most important one to know is the // | ||
| + | |||
| + | These tools can be accessed by selecting the different tabs at the bottom of this pane. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The //Tcl Console// is a tool that allows for running commands directly without the use of the main user interface. Some messages may link to the Tcl Console to provide more information regarding an error. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The //Reports// tool is useful for quickly jumping to any one of the many reports that Vivado generates on a design. These reports include power, timing, and utilization just to name a few. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The //Log// displays the output from the latest Synthesis, Implementation, | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The last tool is the //Design Runs//. Using this tool run settings can be edited and new runs can be created. This tool is useful when targeting multiple devices with the same design. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | The most important pane in the Project Manager is the // | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | ==== Adding a Constraint File ==== | ||
| + | |||
| + | Constraint files describe the requirements put upon a design by the components surrounding an FPGA - including all peripherals, | ||
| + | |||
| + | In order to connect the ports found in an RTL top module (described later) with the physical pins of the FPGA, a constraint file needs to be added or created. Digilent provides Xilinx Design Constraint (XDC) files for each board. Download [[https:// | ||
| + | |||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | In the //Project Manager// section of the //Flow Navigator//, | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | At this stage, Vivado provides a list of all of the constraint files that will be added or created when we click Finish. Currently this list is empty, this will change when files have been added or created. A constraint file will not be created from scratch in this guide, so click //Add Files//. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | Find the directory you extracted the // | ||
| + | |||
| + | Click //OK// to continue. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | Make sure that the selected XDC file has been added into the list of sources, and that the //Copy constraint files into project// is checked, then click //Finish//. | ||
| + | |||
| + | **Note:** //Leaving the Copy... box unchecked means that any editing done to the constraint file will be reflected in the original copy. Checking the box is highly recommended// | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | In the //Sources// pane of the //Project Manager//, expand the // | ||
| + | |||
| + | Find and uncomment the lines that call // | ||
| + | |||
| + | **Note:** //A board using clk_p/clk_n pins means that the input clock that uses differential logic. If you want to know more, read this article on [[wp> | ||
| + | |||
| + | Change the name inside of the get_ports call to ' | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | ==== Creating a Verilog Source File ==== | ||
| + | |||
| + | Verilog is one of several hardware description languages (HDLs) that can be used within Vivado to describe a circuit to be implemented within an FPGA. This section describes how to create a Verilog file within Vivado, and create a simple circuit that will work on any Digilent FPGA development board. | ||
| + | |||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | In the //Project Manager// section of the //Flow Navigator//, | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | As before, at this stage, we will be provided a list of all of the source files that will be added or created when we click Finish. Instead of clicking Add Files, click //Create File//. | ||
| + | |||
| + | **Note:** //It is also possible to add existing source files in the same way the constraint file was added, above.// | ||
| + | |||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | You will be prompted to select a //File type//, //File name//, and //File location//. Make sure to pick //Verilog// and //<Local to project>// | ||
| + | |||
| + | **Important: | ||
| + | |||
| + | Click //OK// to continue. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | <WRAP group> | ||
| + | <WRAP column half> | ||
| + | Make sure that the new Verilog source file has been added into the list of sources, then click //Finish//. | ||
| + | </ | ||
| + | <WRAP column half> | ||
| + | {{ : | ||
| + | </ | ||
| + | </ | ||
| + | ---- | ||
| + | |||
| + | Unlike when the constraint file was added, at this point a //Define Module// dialog will pop up. You can rename your Verilog module using the //Module name// field, but this is unnecessary. The Verilog module' | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | There are five fields to define for each of the module' | ||
| + | * **Port Name:** This field defines the name of the port and needs to match one of the names you used in your XDC file. | ||
| + | * **Direction: | ||
| + | * **Bus:** This can be checked or not, when checked, this port consists of multiple single bit signals, grouped into a single bus. | ||
| + | * **MSB:** The index of the most significant bit of the port, if it is a bus. This option is grayed out for single-bit ports. | ||
| + | * **LSB:** The index of the least significant bit of the port, if it is a bus. This option is grayed out for single-bit ports. | ||
| + | |||
| + | **Note:** //If you are defining a module which will be instantiated in another module, which we will not go into in this guide, be aware that the port names of non-" | ||
| + | |||
| + | If your board uses differential clocking, add two single-bit input ports with the same names as the positive and negative clock ports that were uncommented in your XDC file. Otherwise, add a single single-bit input port with the same name as the clock port that was uncommented in your XDC file. | ||
| + | |||
| + | Add a single-bit output port with the same name as the LED port that was uncommented in your XDC file. | ||
| + | |||
| + | Once these two or three ports have been added, click //OK// to continue. | ||
| + | ---- | ||
| + | At this point, the new source file will be added to the //Design Sources// folder in the //Sources// pane of the //Project Manager//. Expand this folder and double click on the file to open it. | ||
| + | |||
| + | Next, some Verilog code needs to be written to define how the design will actually behave. | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | Between the ' | ||
| + | |||
| + | This snippet of code implements a 25 bit counter, which will increment by 1 every clock cycle, and roll back over to 0 after ~33 million cycles (about a third of a second, given a 100MHz input clock). The LED is directly driven by the top bit of the counter, which, of the bits, changes the least frequently. Given a 100MHz clock, the LED will blink (go through a full cycle of low-to-high-to-low transitions) approximately three times per second. | ||
| + | |||
| + | <code verilog> | ||
| + | reg [24:0] count = 0; | ||
| + | |||
| + | assign led = count[24]; | ||
| + | |||
| + | always @ (posedge(clk)) count <= count + 1; | ||
| + | </ | ||
| + | |||
| + | If your board is differentially clocked, add the following lines of code after ' | ||
| + | |||
| + | This instantiates a differential input buffer, which will allow you to get a non-differential clock which can be used to clock the FPGA fabric. | ||
| + | |||
| + | <code verilog> | ||
| + | wire clk; | ||
| + | |||
| + | IBUFGDS clk_inst ( | ||
| + | .O(clk), | ||
| + | .I(clk_p), | ||
| + | .IB(clk_n) | ||
| + | ); | ||
| + | </ | ||
| + | |||
| + | It should be noted that the rate at which the clock will blink will differ depending on the board used. System clocks on different Digilent boards run at a number of different rates, depending on the needs of the board. The system clock period in nanoseconds can be found on the // | ||
| + | |||
| + | After completing this guide, it is suggested to try changing the provided Verilog code so that the clock blinks at 1 Hertz. (Note that the XDC file only // | ||
| + | |||
| + | ---- | ||
| + | ==== Generate a Bitstream ==== | ||
| + | |||
| + | In order to create a file that can be used to program the target board, each stage of the " | ||
| + | |||
| + | This starts with // | ||
| + | |||
| + | // | ||
| + | |||
| + | The //Bitstream Generator// generates the final output file needed for programming the FPGA. To run Bitstream Generation click either {{: | ||
| + | |||
| + | Depending on the complexity of the design, the board used, and the strength of your computer, the process of building the project can take between 5 and 60 minutes. When complete, a pop up dialog will appear, prompting you to select one of several options. None are relevant for the purposes of this guide, so click **Cancel**. The " | ||
| + | |||
| + | ---- | ||
| + | ===== ===== | ||
| + | {{page> | ||
| + | |||
| + | ==== In Conclusion ==== | ||
| + | |||
| + | You should now see one of the LEDs on your board blinking! | ||
| + | |||
| + | Be sure to visit your board' | ||
| + | |||
| + | / | ||

