Vivado Tutorial
Vivado Tutorial
Vivado Tutorial
Vivado Tutorial
Vivado Tutorial
Introduction
This tutorial guides you through the design flow using Xilinx Vivado software to create a simple digital
circuit using Verilog HDL. A typical design flow consists of creating model(s), creating user constraint
file(s), creating a Vivado project, importing the created models, assigning created constraint file(s),
optionally running behavioral simulation, synthesizing the design, implementing the design, generating
the bitstream, and finally verifying the functionality in the hardware by downloading the generated
bitstream file. You will go through the typical design flow targeting the Artix-100 based Nexys4 board.
The typical design flow is shown below. The circled number indicates the corresponding step in this
tutorial.
Objectives
After completing this tutorial, you will be able to:
Create a Vivado project sourcing HDL model(s) and targeting a specific FPGA device located on the
Nexys4 board
Use the provided partially completed Xilinx Design Constraint (XDC) file to constrain some of the pin
locations
Add additional constraints using the Tcl scripting feature of Vivado
Simulate the design using the XSim simulator
Synthesize and implement the design
Generate the bitstream
Configure the FPGA using the generated bitstream and verify the functionality
Go through the design flow in batch mode using the Tcl script
Procedure
This tutorial is broken into steps that consist of general overview statements providing information on the
detailed instructions that follow. Follow these detailed instructions to progress through the tutorial.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
Design Description
The design consists of some inputs directly connected to the corresponding output LEDs. Other inputs
are logically operated on before the results are output on the remaining LEDs as shown in Figure 1.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
Step 1
1-1-1. Open Vivado by selecting Start > All Programs > Xilinx Design Tools > Vivado 2013.3 >
Vivado 2013.3
1-1-2. Click Create New Project to start the wizard. You will see Create A New Vivado Project dialog
box. Click Next.
1-1-3. Click the Browse button of the Project location field of the New Project form, browse to
c:\xup\digital, and click Select.
1-1-4. Enter tutorial in the Project name field. Make sure that the Create Project Subdirectory box is
checked. Click Next.
Vivado Tutorial
Lab Workbook
This Xilinx Design Constraints file assigns the physical IO locations on FPGA to the switches and
LEDs located on the board. This information can be obtained either through a boards schematic
or boards user guide.
1-1-10. In the Default Part form, using the Parts option and various drop-down fields of the Filter section,
select the XC7A100TCSG324-1 part. Click Next.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
Use the Windows Explorer and look at the c:\xup\digital\tutorial directory. You will find that the
tutorial.data and tutorial.srcs directories and the tutorial.xpr (Vivado) project file have been
created. The tutorial.data directory is a place holder for the Vivado program database. Two more
directories, constrs_1 and sources_1, are created under the tutorial.srcs directory; deep down
under them, the copied tutorial.xdc (constraint) and tutorial.v (source) files respectively are
placed.
1-2.
1-2-1. In the Sources pane, double-click the tutorial.v entry to open the file in text mode.
1-3.
1-3-1. In the Sources pane, expand the Constraints folder and double-click the tutorial.xdc entry to
open the file in text mode.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
1-4.
1-4-1. Expand the Open Elaborated Design entry under the RTL Analysis tasks of the Flow Navigator
pane and click on Schematic.
The model (design) will be elaborated and a logic view of the design is displayed.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
1-5.
Vivado Tutorial
Add I/O constraints for the missing LED and switch pins.
1-5-1. Once RTL analysis is performed, another standard layout called the I/O Planning is available.
Click on the drop-down button and select the I/O Planning layout.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
1-5-2. Expand the led and swt ports by clicking on the + box and observe that led [6:0] and swt[6:0] use
the LVCMOS33 I/O standard whereas led[7] and swt[7] use defaults to LVCMOS18; hence you
can see multiple I/O standard in the collapsed view.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
You can also assign the pin by selecting its entry (swt[7]) in the I/O ports tab, and dragging it to
the Package view, and placing it at the V5 location. You can assign the LVCMOS33 standard by
selecting its entry (swt[7]), selecting Configure tab of the I/O Port Properties window, followed by
clicking the drop-down button of the I/O standard field, and selecting LVCMOS33.
Figure 13. Assigning I/O standard through the I/O Port Properties form
1-5-6. Select File > Save Constraints and click OK to save the constraints in the tutorial.xdc file.
1-5-7. Click Update followed by OK to update the existing constraint file.
Note that the constraints are updated in the tutorial.xdc file under the tutorial project directory and
not under the sources directory.
Step 2
2-1-1. Click Add Sources under the Project Manager tasks of the Flow Navigator pane.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
2-2.
2-2-1. Select Simulation Settings under the Project Manager tasks of the Flow Navigator pane.
A Project Settings form will appear showing the Simulation properties form.
2-2-2. Select the Simulation tab, and set the Simulation Run Time value to 200 ns and click OK.
2-2-3. Click on Run Simulation > Run Behavioral Simulation under the Project Manager tasks of the
Flow Navigator pane.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
The testbench and source files will be compiled and the XSim simulator will be run (assuming no
errors). You will see a simulator output similar to the one shown below.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
2-3.
2-3-1. Select i[31:0] in the waveform window, right-click, select Radix, and then select Unsigned
Decimal to view the for-loop index in integer form. Similarly, change the radix of switches[7:0] to
Hexadecimal. Leave the leds[7:0] and e_led[7:0] radix to binary as we want to see each output
bit.
2-4.
Add more signals to monitor lower-level signals and continue to run the
simulation for 500 ns.
2-4-1. Expand the tutorial_tb instance, if necessary, in the Scopes window and select the tut1 instance.
The swt[7:0] and led[7:0] signals will be displayed in the Objects window.
Vivado Tutorial
Lab Workbook
Step 3
Synthesize the design with the Vivado synthesis tool and analyze the
Project Summary output.
3-1-1. Click on Run Synthesis under the Synthesis tasks of the Flow Navigator pane.
The synthesis process will be run on the tutorial.v file (and all its hierarchical files if they exist).
When the process is completed a Synthesis Completed dialog box with three options will be
displayed.
3-1-2. Select the Open Synthesized Design option and click OK as we want to look at the synthesis
output before progressing to the implementation stage.
Click Yes to close the elaborated design if the dialog box is displayed.
3-1-3. Select the Project Summary tab (Select default layout if the tab Is not visible) and understand
the various windows.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
Step 4
4-1-1. Click on Run Implementation under the Implementation tasks of the Flow Navigator pane.
The implementation process will be run on the synthesis output files. When the process is
completed an Implementation Completed dialog box with three options will be displayed.
4-1-2. Select Open implemented design and click OK as we want to look at the implemented design in
a Device view tab.
4-1-3. Click Yes to close the synthesized design.
The implemented design will be opened.
4-1-4. In the Netlist pane, select one of the nets (e.g. n_0_led_OBUF[1]_inst_i_1) and notice that the net
displayed in the X1Y1 clock region in the Device view tab (you may have to zoom in to see it).
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
Step 5
5-1-1. Select Run Simulation > Run Post-Implementation Timing Simulation process under the
Simulation tasks of the Flow Navigator pane.
The XSim simulator will be launched using the implemented design and tutorial_tb as the toplevel module..
Using the Windows Explorer, verify that timing directory is created under the tutorial.sim >
sim_1 > impl directory. The timing directory contains generated files to run the timing simulation.
Nexys4 Vivado Tutorial-18
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
5-1-2. Click on the Zoom Fit button to see the waveform window from 0 to 200 ns.
5-1-3. Right-click at 50 ns (where the switch input is set to 0000000b) and select Markers > Add
Marker.
5-1-4. Similarly, right-click and add a marker at around 55.000 ns where the leds changes.
5-1-5. You can also add a marker by clicking on the Add Marker button (
button and left-click at around 60 ns where e_led changes.
Step 6
Connect the board and power it ON. Generate the bitstream, open a
hardware session, and program the FPGA.
6-1-1. Click on the Generate Bitstream entry under the Program and Debug tasks of the Flow
Navigator pane.
The bitstream generation process will be run on the implemented design. When the process is
completed a Bitstream Generation Completed dialog box with three options will be displayed.
This process will have tutorial.bit file generated under impl_1 directory which was generated
under the tutorial.runs directory.
6-1-2. Make sure that the power supply source is jumper to USB and the provided Micro-USB cable is
connected between the board and the PC. Note that you do not need to connect the power jack
and the board can be powered and configured via USB alone
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
6-1-12. Verify the functionality by flipping switches and observing the output on the LEDs.
6-1-13. Close the hardware session by selecting File > Close Hardware Manager.
6-1-14. Click OK to close the session.
6-1-15. Power OFF the board.
6-1-16. Close the Vivado program by selecting File > Exit and click OK.
Step 7
7-1-1. Select Start > All Programs > Xilinx Design Tools > Vivado 2013.3 > Vivado 2013.3 Tcl Shell
to open the Tcl shell.
7-1-2. In the Tcl prompt window, change the working directory to c:\xup\digital\sources\tutorial by
executing the following command.
cd c:/xup/digital/sources/tutorial
7-1-3. Run the provided Tcl script in the batch mode by executing the following command
source tutorial_tcl_with_sim.tcl
The tools will be run and various directories will be created.
The Tcl script file is shown below.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Vivado Tutorial
Lab Workbook
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx
Lab Workbook
Vivado Tutorial
Conclusion
The Vivado software tool can be used to perform a complete design flow. The project was created using
the supplied source files (HDL model and user constraint file). A behavioral simulation was done to verify
the model functionality. The model was then synthesized, implemented, and a bitstream was generated.
The timing simulation was run on the implemented design using the same testbench. The functionality
was verified in hardware using the generated bitstream. The design flow was also carried out in the batch
mode using the provided Tcl script.
www.xilinx.com/university
xup@xilinx.com
copyright 2013 Xilinx