Vivado Design Suite User
Guide
Logic Simulaon
UG900 (v2022.1) April 21, 2022
See all versions
of this document
Xilinx is creating an environment where employees, customers, and
partners feel welcome and included. To that end, we’re removing non-
inclusive language from our products and related collateral. We’ve
launched an internal initiative to remove language that could exclude
people or reinforce historical biases, including terms embedded in our
software and IPs. You may still find examples of non-inclusive
language in our older products as we work to make these changes and
align with evolving industry standards. Follow this link for more
information.
Table of Contents
Chapter 1: Overview......................................................................................................7
Navigating Content by Design Process.................................................................................... 7
Logic Simulation Overview.........................................................................................................7
Supported Simulators.................................................................................................................8
Simulation Flow .......................................................................................................................... 8
Language and Encryption Support ........................................................................................ 11
Chapter 2: Preparing for Simulation..................................................................12
Using Test Benches and Stimulus Files.................................................................................. 12
Pointing to the Simulator Install Location............................................................................. 13
Compiling Simulation Libraries............................................................................................... 14
Using Xilinx Simulation Libraries.............................................................................................19
Using Simulation Settings........................................................................................................ 28
Adding or Creating Simulation Source Files.......................................................................... 32
Generating a Netlist..................................................................................................................34
Chapter 3: Simulating with Third-Party Simulators................................. 37
Running Simulation Using Third Party Simulators with Vivado IDE................................... 38
Dumping SAIF for Power Analysis...........................................................................................41
Dumping VCD............................................................................................................................ 43
Simulating IP..............................................................................................................................44
Using a Custom DO File During an Integrated Simulation Run.......................................... 44
Running Third-Party Simulators in Batch Mode....................................................................46
Chapter 4: Simulating with Vivado Simulator..............................................47
Running the Vivado Simulator.................................................................................................47
Running Functional and Timing Simulation...........................................................................65
Saving Simulation Results........................................................................................................ 68
Distinguishing Between Multiple Simulation Runs...............................................................68
Closing a Simulation................................................................................................................. 69
Adding a Simulation Start-up Script File.................................................................................69
Viewing Simulation Messages................................................................................................. 70
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 2
Using the launch_simulation Command................................................................................ 72
Re-running the Simulation After Design Changes (relaunch).............................................73
Using the Saved Simulator User Interface Settings..............................................................74
Chapter 5: Analyzing Simulation Waveforms with Vivado
Simulator...................................................................................................................... 76
Using Wave Configurations and Windows.............................................................................76
Opening a Previously Saved Simulation Run.........................................................................77
Understanding HDL Objects in Waveform Configurations .................................................78
Customizing the Waveform..................................................................................................... 81
Controlling the Waveform Display .........................................................................................87
Organizing Waveforms.............................................................................................................91
Analyzing Waveforms............................................................................................................... 93
Analyzing AXI Interface Transactions..................................................................................... 98
Chapter 6: Debugging a Design with Vivado Simulator....................... 113
Debugging at the Source Level............................................................................................. 113
Forcing Objects to Specific Values.........................................................................................117
Power Analysis Using Vivado Simulator............................................................................... 125
Using the report_drivers Tcl Command................................................................................127
Using the Value Change Dump Feature...............................................................................127
Using the log_wave Tcl Command........................................................................................ 128
Cross Probing Signals in the Object, Wave, and Text Editor Windows.............................130
Chapter 7: Simulating in Batch or Scripted Mode in Vivado
Simulator.....................................................................................................................136
Exporting Simulation Files and Scripts................................................................................. 136
Running the Vivado Simulator in Batch Mode.....................................................................142
Elaborating and Generating a Design Snapshot, xelab......................................................144
Simulating the Design Snapshot, xsim.................................................................................155
Example of Running Vivado Simulator in Standalone Mode.............................................159
Project File (.prj) Syntax..........................................................................................................160
Predefined Macros..................................................................................................................161
Library Mapping File (xsim.ini).............................................................................................. 161
Running Simulation Modes....................................................................................................162
Using Tcl Commands and Scripts .........................................................................................165
export_simulation ...................................................................................................................166
export_ip_user_files.................................................................................................................169
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 3
Appendix A: Compilation, Elaboration, Simulation, Netlist, and
Advanced Options..................................................................................................172
Compilation Options...............................................................................................................172
Elaboration Options................................................................................................................174
Simulation Options................................................................................................................. 176
Netlist Options.........................................................................................................................178
Advanced Simulation Options............................................................................................... 179
Appendix B: SystemVerilog Support in Vivado Simulator................... 180
Targeting SystemVerilog for a Specific File..........................................................................180
Testbench Feature...................................................................................................................187
Appendix C: Universal Verification Methodology Support................. 196
Appendix D: VHDL 2008 Support in Vivado Simulator............................197
Introduction ............................................................................................................................ 197
Compiling and Simulating......................................................................................................197
Supported Features................................................................................................................ 199
Appendix E: Direct Programming Interface (DPI) in Vivado
Simulator.....................................................................................................................201
Introduction............................................................................................................................. 201
Compiling C Code....................................................................................................................201
xsc Compiler............................................................................................................................ 202
Binding Compiled C Code to SystemVerilog Using xelab.................................................. 204
Data Types Allowed on the Boundary of C and SystemVerilog......................................... 204
Mapping for User-Defined Types..........................................................................................205
Support for svdpi.h Functions............................................................................................... 207
DPI Examples Shipped with the Vivado Design Suite.........................................................215
Appendix F: SystemC Support in Vivado IDE............................................... 216
Selecting Simulation Model Type.......................................................................................... 216
Protected Models.................................................................................................................... 220
Unprotected Models............................................................................................................... 221
SystemC Simulation Using Vivado........................................................................................ 222
Running SystemC Simulation Using Vivado Simulator.......................................................224
Appendix G: Automated Testbench Generation for Sub-Design..... 225
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 4
generate_vcd_ports.................................................................................................................225
create_testbench..................................................................................................................... 226
Using Automated Testbench Generation on Example Design.......................................... 227
Appendix H: Handling Special Cases................................................................231
Using Global Reset and 3-State............................................................................................. 231
Delta Cycles and Race Conditions......................................................................................... 233
Using the ASYNC_REG Constraint..........................................................................................234
Simulating Configuration Interfaces.................................................................................... 236
Disabling Block RAM Collision Checks for Simulation........................................................ 239
Dumping the Switching Activity Interchange Format File for Power Analysis................ 240
Skipping Compilation or Simulation..................................................................................... 240
Appendix I: Value Rules in Vivado Simulator Tcl Commands............ 242
String Value Interpretation.................................................................................................... 242
Vivado Design Suite Simulation Logic.................................................................................. 242
Appendix J: Vivado Simulator Mixed Language Support and
Language Exceptions........................................................................................... 244
Using Mixed Language Simulation....................................................................................... 244
VHDL Language Support Exceptions....................................................................................250
Verilog Language Support Exceptions ................................................................................ 251
Appendix K: Vivado Simulator Quick Reference Guide......................... 254
Appendix L: Using Xilinx Simulator Interface............................................ 257
Preparing the XSI Functions for Dynamic Linking.............................................................. 257
Writing the Test Bench Code................................................................................................. 259
Compiling Your C/C++ Program............................................................................................ 260
Preparing the Design Shared Library................................................................................... 260
XSI Function Reference...........................................................................................................261
Vivado Simulator VHDL Data Format....................................................................................266
Vivado Simulator Verilog Data Format................................................................................. 269
Appendix M: Additional Resources and Legal Notices.......................... 272
Xilinx Resources.......................................................................................................................272
Documentation Navigator and Design Hubs...................................................................... 272
References................................................................................................................................272
Links to Additional Information on Third-Party Simulators...............................................273
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 5
Training Resources..................................................................................................................274
Revision History.......................................................................................................................274
Please Read: Important Legal Notices................................................................................. 275
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 6
Chapter 1
Overview
Navigating Content by Design Process
Xilinx
®
documentaon is organized around a set of standard design processes to help you nd
relevant content for your current development task. All Versal
®
ACAP design process Design
Hubs and the Design Flow Assistant materials can be found on the Xilinx.com website. This
document covers the following design processes:
Hardware, IP, and Plaorm Development: Creang the PL IP blocks for the hardware
plaorm, creang PL kernels, funconal simulaon, and evaluang the Vivado
®
ming,
resource use, and power closure. Also involves developing the hardware plaorm for system
integraon. Topics in this document that apply to this design process include:
Chapter 3: Simulang with Third-Party Simulators
Chapter 4: Simulang with Vivado Simulator
Appendix F: SystemC Support in Vivado IDE
Logic Simulation Overview
Simulaon is a process of emulang real design behavior in a soware environment. Simulaon
helps verify the funconality of a design by injecng smulus and observing the design outputs.
This chapter provides an overview of the simulaon process, and the simulaon opons in the
Vivado
®
Design Suite.
The process of simulaon includes:
Creang test benches, seng up libraries and specifying the simulaon sengs for Simulaon
Generang a Netlist (if performing post-synthesis or post-implementaon simulaon)
Running a Simulaon using Vivado simulator or third party simulators. See Supported
Simulators for more informaon on supported simulators.
Chapter 1: Overview
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 7
Supported Simulators
Following are the supported simulators in the Vivado Design Suite:
Table 1: Supported Simulators
Simulator Version
Integrated with Vivado
Integrated Design Environment
Vivado
®
Simulator 2022.1 Integrated with the Vivado integrated
design environment, where each
simulation launch appears as a
framework of windows within the
Vivado IDE.
Siemens EDA Questa Advanced
Simulator
2021.3 Yes
Siemens EDA ModelSim Simulator 2021.3 Yes
Synopsys Verilog Compiler Simulator
(VCS)
S-2021.09 Yes
Aldec Rivera-PRO Simulator 2021.04 Yes
Aldec Active-HDL 12.0 Yes
Cadence Xcelium Parallel Simulator 21.09.002 Yes
See the Vivado Design Suite User Guide: Release Notes, Installaon, and Licensing (UG973) for the
supported versions of third-party simulators.
For more informaon about the Vivado IDE and the Vivado Design Suite ow, see:
Vivado Design Suite User Guide: Using the Vivado IDE (UG893)
Vivado Design Suite User Guide: Design Flows Overview (UG892)
Simulation Flow
Simulaon can be applied at several points in the design ow. It is one of the rst steps aer
design entry and one of the last steps aer implementaon as part of verifying the end
funconality and performance of the design.
Simulaon is an iterave process and is typically repeated unl both the design funconality and
ming requirements are sased.
The following gure illustrates the simulaon ow for a typical design:
Chapter 1: Overview
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 8
Figure 1: Simulation Flow
Behavioral Simulation
(Verify Design Behaves as
Intended)
Synthesize
RTL Design
Post Synthesis Simulation
Implement (Place and
Route)
Post Implementation
Simulation
(Close to Emulating HW)
Debug the Design
X23703-021320
Behavioral Simulation at the Register Transfer Level
Register Transfer Level (RTL) behavioral simulaon can include:
RTL Code
Instanated UNISIM library components
Instanated UNIMACRO components
UNISIM gate-level model (for the Vivado logic analyzer)
SECUREIP Library
RTL-level simulaon lets you simulate and verify your design prior to any translaon made by
synthesis or implementaon tools. You can verify your designs as a module or an enty, a block,
a device, or a system.
Chapter 1: Overview
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 9
RTL simulaon is typically performed to verify code syntax, and to conrm that the code is
funconing as intended. In this step, the design is primarily described in RTL and consequently,
no ming informaon is required.
RTL simulaon is not architecture-specic unless the design contains an instanated device
library component. To support instanaon, Xilinx
®
provides the UNISIM library.
When you verify your design at the behavioral RTL you can x design issues earlier and save
design cycles.
Keeping the inial design creaon limited to behavioral code allows for:
More readable code
Faster and simpler simulaon
Code portability (the ability to migrate to dierent device families)
Code reuse (the ability to use the same code in future designs)
Post-Synthesis Simulation
You can simulate a synthesized netlist to verify that the synthesized design meets the funconal
requirements and behaves as expected. Although it is not typical, you can perform ming
simulaon with esmated ming numbers at this simulaon point.
The funconal simulaon netlist is a hierarchical, folded netlist expanded to the primive module
and enty level; the lowest level of hierarchy consists of primives and macro primives.
These primives are contained in the UNISIMS_VER library for Verilog, and the UNISIM library
for VHDL.
Related Information
UNISIM Library
Post-Implementation Simulation
You can perform funconal or ming simulaon aer implementaon. Timing simulaon is the
closest emulaon to actually downloading a design to a device. It allows you to ensure that the
implemented design meets funconal and ming requirements and has the expected behavior in
the device.
IMPORTANT!
Performing a thorough ming simulaon ensures that the completed design is free of
defects that could otherwise be missed, such as:
Chapter 1: Overview
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 10
Post-synthesis and post-implementaon funconality changes that are caused by:
Synthesis properes or constraints that create mismatches (such as full_case and
parallel_case)
UNISIM properes applied in the Xilinx Design Constraints (XDC) le
The interpretaon of language during simulaon by dierent simulators
Dual port RAM collisions
Missing, or improperly applied ming constraints
Operaon of asynchronous paths
Funconal issues due to opmizaon techniques
Language and Encryption Support
The Vivado simulator supports:
VHDL, see IEEE Standard VHDL Language Reference Manual (IEEE-STD-1076-1993) and part
of VHDL-2008.
Verilog, see IEEE Standard Verilog Hardware Descripon Language (IEEE-STD-1364-2001).
SystemVerilog, see IEEE Standard for SystemVerilog--Unied Hardware Design, Specicaon,
and Vericaon Language (IEEE-STD-1800-2009).
IEEE P1735 encrypon, see Recommended Pracce for Encrypon and Management of
Electronic Design Intellectual Property (IP) (IEEE-STD-P1735).
Chapter 1: Overview
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 11
Chapter 2
Preparing for Simulation
This chapter describes the components that you need when you simulate a Xilinx
®
device in the
Vivado
®
Integrated Design Environment (IDE).
Set up the following before performing the simulaon:
Create a test bench that reects the simulaon acons you want to run.
Set up an install locaon in Vivado IDE (if not using the Vivado simulator).
Compile your libraries (if not using the Vivado simulator).
Select and declare the libraries you need to use.
Specify the simulaon sengs such as target simulator, the simulaon top module name, top
module (design under test), display the simulaon set, and dene the compilaon, elaboraon,
simulaon, netlist, and advanced opons.
Generate a Netlist (if performing post-synthesis or post-implementaon simulaon).
Using Test Benches and Stimulus Files
A test bench is Hardware Descripon Language (HDL) code wrien for the simulator that:
Instanates and inializes the design.
Generates and applies smulus to the design.
Monitors the design output result and checks for funconal correctness (oponal).
You can also set up the test bench to display the simulaon output to a le, a waveform, or to a
display screen. A test bench can be simple in structure and can sequenally apply smulus to
specic inputs.
A test bench can also be complex, and can include:
Subroune calls
Smulus that is read in from external les
Condional smulus
Other more complex structures
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 12
The advantages of a test bench over interacve simulaon are that it:
Allows repeatable simulaon throughout the design process
Provides documentaon of the test condions
The following bullets are recommendaons for creang an eecve test bench.
Always specify the `timescale in Verilog test bench les. For example:
`timescale 1ns/1ps
Inialize all inputs to the design within the test bench at simulaon me zero to properly
begin simulaon with known values.
Apply smulus data aer 100 ns to account for the default Global Set/Reset (GSR) pulse used
in funconal and ming-based simulaon.
Begin the clock source before the Global Set/Reset (GSR) is released.
For more informaon about test benches, see Wring Ecient Test Benches (XAPP199).
TIP: When you create a test bench, remember that the GSR pulse occurs automacally in the post-
synthesis and post-implementaon ming simulaon. This holds all registers in reset for the rst 100 ns of
the simulaon.
Related Information
Using Global Reset and 3-State
Pointing to the Simulator Install Location
To dene the installaon path:
1. Select Tools → Sengs → Tool Sengs → 3rd Party Simulators.
2. In Third-Party simulators tab of the Sengs dialog box, select the simulator under the Install
Paths as shown in the following gure, and browse to the installaon path.
3. Select the appropriate simulator under Default Compiled Library Paths and browse to the
relevant compiled library paths. You can set the library paths at a later point of me. See
Compiling Simulaon Libraries for more informaon on how to compile libraries for your
simulator.
Note: Installing Vivado simulator is part of Vivado IDE Installaon. Hence, you do not need to setup an
install locaon for Vivado simulator.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 13
Compiling Simulation Libraries
IMPORTANT!
With Vivado simulator, there is no need to compile the simulaon libraries. However, you
must compile the libraries when using a third-party simulator.
The Vivado Design Suite provides simulaon models as a set of les and libraries. Your simulaon
tool must compile these les prior to design simulaon. The simulaon libraries contain the
device and IP behavioral and ming models. The compiled libraries can be used by mulple
design projects.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 14
During the compilaon process, Vivado creates a default inializaon le that the simulator uses
to reference the compiled libraries. The compile_simlib command creates the le in the
library output directory specied during library compilaon. The default inializaon le contains
control variables that specify reference library paths, opmizaon, compiler, and simulator
sengs. If the correct inializaon le is not found in the path, you cannot run simulaon on
designs that include Xilinx primives.
The name of the inializaon le varies depending on the simulator you are using, as follows:
Questa Advanced Simulator/ModelSim: modelsim.ini
Xcelium: cds.lib
VCS: synopsys_sim.setup
Riviera/Acve-HDL: library.cfg
For more informaon on the simulator-specic compiled library le, see the third-party
simulaon tool documentaon.
IMPORTANT! Compilaon of the libraries is typically a one-me operaon, as long as you are using the
same version of tools. However, any change to the Vivado tools or the simulator versions requires that
libraries be recompiled.
You can compile libraries using the Vivado IDE or using Tcl commands, as described in the
following secons.
Compiling Simulation Libraries Using Vivado IDE
Select Tools → Compile Simulaon Libraries to open the dialog box shown in the following gure.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 15
Figure 2: Compile Simulation Libraries Dialog Box
Set the following opons:
Simulator: From the simulator drop-down menu, select a simulator.
Language: Compiles libraries for the specied language. If this opon is not specied, then the
language is set to correspond with the selected simulator (above). For mul-language
simulators, both Verilog and VHDL libraries are compiled.
Library: Species the simulaon library to compile. By default, the compile_simlib
command compiles all simulaon libraries.
Family: Compiles selected libraries to the specied device family. All device families are
generated by default.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 16
Compiled library locaon: Species the directory path for saving the compiled library results.
By default, the libraries are saved in the current working directory in Non-Project mode, and
the libraries are saved in the <project>/<project>.cache/compile_simlib directory
in Project mode. See the Vivado Design Suite User Guide: Design Flows Overview (UG892) for
more informaon on Project and Non-Project modes.
TIP: Because the Vivado simulator has pre-compiled libraries, it is not necessary to idenfy the library
locaon.
Simulator executable path: Species the directory to locate the simulator executable. This
opon is required if the target simulator is not specied in the $PATH or %PATH% environment
variable, or to override the path from the $PATH or %PATH% environment variable.
GCC executable path: Species the directory to locate GCC installaon. This opon is
required if GCC path sengs are not done as menoned in GCC Path Sengs. Ignore if you
are not using SystemC IP.
Miscellaneous Opons: Specify addional opons for the compile_simlib Tcl command.
Compile Xilinx IP: Enable or disable compiling simulaon libraries for Xilinx IP.
Overwrite current pre-compiled libraries: Overwrites the current pre-compiled libraries.
Compile 32-bit libraries: Performs simulator compilaon in 32-bit mode instead of the default
64-bit compilaon.
Verbose: Temporarily overrides any message limits and return all messages from this
command.
Command: Shows the Tcl command equivalent for the opons you enter in the dialog box.
TIP: You can use the value of the Command eld to generate a simulaon library in Tcl/non-project
mode.
Compiling Simulation Libraries Using Tcl Commands
Alternavely, you can compile simulaon libraries using the compile_simlib Tcl command.
For details, see compile_simlib in the Vivado Design Suite Tcl Command Reference Guide
(UG835), or type compile_simlib -help.
Following are example commands for each third-party simulator:
Questa Advanced Simulator: Generang a simulaon library for Questa for all languages and
for all libraries and all families in the current directory.
compile_simlib -language all -simulator questa -library all -family all
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 17
ModelSim: Generang simulaon library for ModelSim at /a/b/c, where the ModelSim
executable path is <simulator_installation_path>.
compile_simlib -language all -dir {/a/b/c} -simulator modelsim -
simulator_exec_path
{<simulator_installation_path>} -library all -family all
VCS: Generang a simulaon library for VCS for the Verilog language, for the UNISIM library
at /a/b/c.
compile_simlib -language verilog -dir {/a/b/c} -simulator vcs_mx -library
unisim
-family all
Xcelium: Generang a simulaon library for Xcelium for the Verilog language, for the UNISIM
library at /a/b/c.
compile_simlib -language verilog -dir {/a/b/c} -simulator xcelium -
library unisim
-family all
Changing compile_simlib Defaults
The config_compile_simlib Tcl command lets you congure third-party simulator opons
for use by the compile_simlib command.
Tcl Command
config_compile_simlib [-cfgopt <arg>] [-simulator <arg>] [-reset] [-quiet]
[-verbose]
Where:
-cfgopt <arg>: Conguraon opon in form of
<simulator>:<language>:<library>:<options>.
-simulator: The name of the simulator whose conguraon you want
-reset: Lets you reset all previous conguraons for the specied simulator
-quiet: Executes the command without any display to the Tcl Console.
-verbose: Executes the command with all command output to the Tcl Console.
For example, to change the opon used to compile the UNISIM VHDL library, type:
config_compile_simlib {cxl.modelsim.vhdl.unisim:-source -93 -novopt}
IMPORTANT!
The
compile_simlib
command compiles Xilinx primives and Simulaon models of
Xilinx Vivado IP. Xilinx Vivado IP cores are delivered as an output product when the IP is generated;
consequently they are included in the pre-compiled libraries created using
compile_simlib
.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 18
Compiling Patched IP Repository in a New Output Directory Using MYVIVADO
Assume that the patched IP repository is at the following locaon:
'/test/patched_ip_repo/data/ip/xilinx'
To compile the default installed IP repository and the repository that is pointed to by MYVIVADO
in a new output directory, set the MYVIVADO environment (env) variable to point to this patched
IP repository and run compile_simlib. compile_simlib will process the IP library sources
from the default installed repository and the one set by MYVIVADO.
% setenv MYVIVADO /test/patched_ip_repo
% compile_simlib -simulator <simulator> -directory <new_clibs_dir>
Compiling Patched IP Repository in an Existing Output Directory Using MYVIVADO
Assume that the patched IP repository is at the following locaon:
'/test/patched_ip_repo/data/ip/xilinx'
To compile the repository pointed to by MYVIVADO in an exisng output directory where the
library was already compiled for the default installed IP repository, set the MYVIVADO env
variable to point to this patched IP repository and run compile_simlib. compile_simlib
will process the IP library sources from the repository set by MYVIVADO in the exisng output
directory.
% setenv MYVIVADO /test/patched_ip_repo
% compile_simlib -simulator <simulator> -directory <existing_clibs_dir>
Using Xilinx Simulation Libraries
You can use Xilinx simulaon libraries with any simulator that supports the VHDL-93 and
Verilog-2001 language standards. Certain delay and modeling informaon is built into the
libraries; this is required to simulate the Xilinx hardware devices correctly.
Use non-blocking assignments for blocks within clocking edges. Otherwise, write code using
blocking assignments in Verilog. Similarly, use variable assignments for local computaons within
a process, and use signal assignments when you want data-ow across processes.
If the data changes at the same me as a clock, it is possible that the simulator will schedule the
data input to occur aer the clock edge. The data does not go through unl the next clock edge,
although it is possible that the intent was to have the data clocked in before the rst clock edge.
RECOMMENDED:
To avoid such unintended simulaon results, do not switch data signals and clock
signals simultaneously.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 19
When you instanate a component in your design, the simulator must reference a library that
describes the funconality of the component to ensure proper simulaon. The Xilinx libraries are
divided into categories based on the funcon of the model.
The following table lists the Xilinx-provided simulaon libraries:
Table 2: Simulation Libraries
Library Name Description
VHDL Library
Name
Verilog Library
Name
UNISIM
Functional simulation of Xilinx primitives.
UNISIM UNISIMS_VER
UNIMACRO
Functional simulation of Xilinx macros.
UNIMACRO UNIMACRO_VER
UNIFAST
Fast simulation library.
UNIFAST UNIFAST_VER
SIMPRIM
Timing simulation of Xilinx primitives. N/A SIMPRIMS_VER
1
SECUREIP
Simulation library for both functional and timing
simulation of Xilinx device features, such as the PCIe
IP, Gigabit Transceiver etc.,
You can find the list of IP's under SECUREIP at the
following location:
<Vivado_Install_Dir>/data/secureip
SECUREIP SECUREIP
XPM
Functional simulation of Xilinx primitives
XPM
XPM
2
Notes:
1. The SIMPRIMS_VER is the logical library name to which the Verilog SIMPRIM physical library is mapped.
2. XPM is supported as a pre-compiled IP. Hence, you need not add the source file to the project. For third party
simulators, the Vivado tools will map to pre-compiled IP generated with compile_simlib.
IMPORTANT! You must specify dierent simulaon libraries according to the simulaon points. There are
dierent gate-level cells in pre- and post-implementaon netlists.
The following table lists the required simulaon libraries at each simulaon point.
Table 3: Simulation Points and Relevant Libraries
Simulation Point UNISIM UNIFAST UNIMACRO SECUREIP
SIMPRIM
(Verilog
Only)
SDF
1. Register Transfer
Level (RTL)
(Behavioral)
Yes Yes Yes Yes N/A No
2. Post-Synthesis
Simulation (Functional)
Yes Yes N/A Yes N/A N/A
3. Post-Synthesis
Simulation (Timing)
N/A N/A N/A Yes Yes Yes
4. Post-
Implementation
Simulation (Functional)
Yes Yes N/A Yes N/A N/A
5. Post-
Implementation
Simulation (Timing)
N/A N/A N/A Yes Yes Yes
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 20
IMPORTANT! The Vivado simulator uses precompiled simulaon device libraries. When updates to
libraries are installed the precompiled libraries are automacally updated.
Note: Verilog SIMPRIMS_VER uses the same source as UNISIM with the addion of specify blocks for
ming annotaon. SIMPRIMS_VER is the logical library name to which the Verilog physical SIMPRIM is
mapped.
The following table lists the library locaons.
Table 4: Simulation Library Locations
Library HDL Type Location
UNISIM
Verilog
<Vivado_Install_Dir>/data/verilog/src/unisims
VHDL
<Vivado_Install_Dir>/data/vhdl/src/unisims
UNIFAST
Verilog
<Vivado_Install_Dir>/data/verilog/src/unifast
VHDL
<Vivado_Install_Dir>/data/vhdl/src/unifast
UNIMACRO
Verilog
<Vivado_Install_Dir>/data/verilog/src/unimacro
VHDL
<Vivado_Install_Dir>/data/vhdl/src/unimacro
SECUREIP
Verilog
<Vivado_Install_Dir>/data/secureip/
The following subsecons describe the libraries in more detail.
UNISIM Library
Funconal simulaon uses the UNISIM library and contains descripons for device primives or
lowest-level building blocks.
IMPORTANT!
By default, the
compile_simlib
command compiles the stac simulaon les for all
the IP's in the IP Catalog.
Encrypted Component Files
The following table lists the UNISIM library component les that let you call precompiled,
encrypted library les when you include IP in a design. Include the path you require in your
library search path.
Table 5: Component Files
Component File Description
<Vivado_Install_Dir>/data/verilog/src/unisim_retarget_comp.vp
Encrypted Verilog file
<Vivado_Install_Dir>/data/vhdl/src/unisims/unisim_retarget_VCOMP.vhdp
Encrypted VHDL file
IMPORTANT! Verilog module names and le names are uppercase. For example, module BUFG is
BUFG.v
, and module IBUF is
IBUF.v
. Ensure that UNISIM primive instanaons adhere to an
uppercase naming convenon.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 21
VHDL UNISIM Library
The VHDL UNISIM library is divided into the following les, which specify the primives for the
Xilinx device families:
The component declaraons (unisim_VCOMP.vhd)
Package les (unisim_VPKG.vhd)
To use these primives, place the following two lines at the beginning of each le:
library UNISIM;
use UNISIM.VCOMPONENTS.all;
IMPORTANT! You must also compile the library and map the library to the simulator. The method
depends on the simulator.
Note: For Vivado simulator, the library compilaon and mapping is an integrated feature with no further
user compilaon or mapping required.
Note: Starng in Versal
®
ACAP, Xilinx is delivering Verilog/SystemVerilog models only for the new
primives. This does mean that a mixed-language environment is needed for VHDL-only designs, like what
has been needed in the past for IPs and XPMs. For more informaon, see AR76496.
Verilog UNISIM Library
In Verilog, the individual library modules are specied in separate HDL les. This allows the -y
library specicaon switch to search the specied directory for all components and automacally
expand the library.
The Verilog UNISIM library cannot be specied in the HDL le prior to using the module. To use
the library module, specify the module name using all uppercase leers.
The following example shows the instanated module name as well as the le name associated
with that module:
Module BUFG is BUFG.v
Module IBUF is IBUF.v
Verilog is case-sensive, ensure that UNISIM primive instanaons adhere to an uppercase
naming convenon.
If you use precompiled libraries, use the correct simulator command-line switch to point to the
precompiled libraries. The following is an example for the Vivado simulator:
-L unisims_ver
Where:
-L is the library specicaon opon.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 22
UNIMACRO Library
The UNIMACRO library is used during funconal simulaon and contains macro descripons for
selected device primives.
IMPORTANT! You must specify the UNIMACRO library anyme you include a device macro listed in the
Vivado Design Suite 7 Series FPGA and Zynq-7000 SoC Libraries Guide (UG953).
VHDL UNIMACRO Library
To use these primives, place the following two lines at the beginning of each le:
library UNIMACRO;
use UNIMACRO.Vcomponents.all;
Verilog UNIMACRO Library
In Verilog, the individual library modules are specied in separate HDL les. This allows the -y
library specicaon switch to search the specied directory for all components and automacally
expand the library.
The Verilog UNIMACRO library does not need to be specied in the HDL le prior to using the
modules as is required in VHDL. To use the library module, specify the module name using all
uppercase leers. You must also compile and map the library; the method you use depends on
the simulator you choose.
IMPORTANT!
Verilog module names and le names are uppercase. For example, module BUFG is
BUFG.v
. Ensure that UNIMACRO primive instanaons adhere to an uppercase naming convenon.
SIMPRIM Library
Use the SIMPRIM library for simulang ming simulaon netlists produced aer synthesis or
implementaon.
IMPORTANT!
Timing simulaon is supported in Verilog only; there is no VHDL version of the SIMPRIM
library.
TIP: If you are a VHDL user, you can run post synthesis and post implementaon funconal simulaon (in
which case no standard default format (SDF) annotaon is required and the simulaon netlist uses the
UNISIM library). You can create the netlist using the write_vhdl Tcl command. For usage informaon, refer
to the Vivado Design Suite Tcl Command Reference Guide (UG835).
Following is an example for specifying the library for Vivado simulator:
-L SIMPRIMS_VER
Where:
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 23
-L is the library specicaon opon.
SIMPRIMS_VER is the logical library name to which the Verilog SIMPRIM has been mapped.
SECUREIP Simulation Library
Use the SECUREIP library for funconal and ming simulaon of complex device components,
such as GT.
Note: Secure IP Blocks are fully supported in the Vivado simulator without addional setup.
Xilinx leverages the encrypon methodology as specied in the IEEE standard Recommended
Pracce for Encrypon and Management of Electronic Design Intellectual Property (IP) (IEEE-STD-
P1735). The library compilaon process automacally handles encrypon.
Note: See the simulator documentaon for the command line switch to use with your simulator to specify
libraries.
The following table lists special consideraons that must be arranged with your simulator vendor
for using these libraries.
Table 6: Special Considerations for Using SECUREIP Libraries
Simulator Name Vendor Requirements
Siemens EDA ModelSim SE Siemens If design entry is in VHDL, a mixed language license or a SECUREIP
OP is required. Contact the vendor for more information.
Siemens EDA Questa Advanced
Simulator
VCS Synopsys
Active-HDL Aldec If design entry is VHDL, a mixed language license is required.
Riviera-PRO*
IMPORTANT! See Vivado Design Suite User Guide: Release Notes, Installaon, and Licensing (UG973) for
the supported version of third-party simulators.
VHDL SECUREIP Library
The UNISIM library contains the wrappers for VHDL SECUREIP. Place the following two lines at
the beginning of each le so that the simulator can bind to the enty:
Library UNISIM;
UNISIM.VCOMPONENTS.all;
Verilog SECUREIP Library
When running a simulaon using Verilog code, you must reference the SECUREIP library for
most simulators.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 24
If you use the precompiled libraries, use the correct direcve to point to the precompiled
libraries. The following is an example for the Vivado simulator:
-L SECUREIP
IMPORTANT! You can use the Verilog SECUREIP library at compile me by using
-f
switch. The le list is
available in the following path:
<Vivado_Install_Dir>/data/secureip/
secureip_cell.list.f
.
UNIFAST Library
The UNIFAST library is an oponal library that you can use during RTL behavioral simulaon to
speed up simulaon runme.
IMPORTANT! The UNIFAST library is an oponal library that you can use during funconal simulaon to
speed up simulaon runme. UNIFAST libraries are supported for 7 series devices only. UltraScale and
later device architectures do not support UNIFAST libraries, as all the opmizaons are incorporated in the
UNISIM libraries by default. UNIFAST libraries cannot be used for sign-o simulaons because the library
components do not have all the checks/features that are available in a full model.
RECOMMENDED: Use the UNIFAST library for inial vericaon of the design and then run a complete
vericaon using the UNISIM library.
The simulaon run me improvement is achieved by supporng a subset of the primive
features in the simulaon mode.
Note: The simulaon models check for unsupported aribute values only.
MMCME2
To reduce the simulaon runmes, the fast MMCME2 simulaon model has the following
changes from the full model:
1. The fast simulaon model provides only basic clock generaon funcons. Other funcons,
such as DRP, ne phase shiing, clock stopped, and clock cascade are not supported.
2. It assumes that input clock is stable without frequency and phase change. The input clock
frequency sampling stops aer LOCKED signal is asserted HIGH.
3. The output clock frequency, phase, duty cycle, and other features are directly calculated from
input clock frequency and parameter sengs.
Note: The output clock frequency is not generated from input-to-VCO clock.
4. The standard and the fast MMCME2 simulaon model LOCKED signal asseron mes dier.
Standard Model LOCKED asseron me depends on the M and D seng. For large M and
D values, the lock me is relavely long for a standard MMCME2 simulaon model.
In the fast simulaon model, the LOCKED asseron me is shortened.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 25
DSP48E1
To reduce the simulaon runmes, the fast DSP48E1 simulaon model has the following features
removed from the full model.
Paern Detecon
OverFlow/UnderFlow
DRP interface support
GTHE2_CHANNEL/GTHE2_COMMON
To reduce the simulaon runmes, the fast GTHE2 simulaon model has the following feature
dierences:
GTH links must be synchronous with no Parts Per Million (PPM) rate dierences between the
near and far end link partners.
Latency through the GTH is not cycle accurate with the hardware operaon.
You cannot simulate the DRP producon reset sequence. Bypass it when using the UNIFAST
model.
Using Verilog UNIFAST Library
To reduce the simulaon runmes, the fast GTXE2 simulaon model has the following feature
dierences:
GTX links must be of synchronous with no Parts Per Million (PPM) rate dierences between
the near and far end link partners.
Latency through the GTX is not cycle accurate with the hardware operaon.
Method 1: Using the complete Verilog UNIFAST library (Recommended)
Method 1 is the recommended method whereby you simulate with all the UNIFAST models.
Use the following Tcl command in Tcl console to enable UNIFAST support (fast simulaon
models) in a Vivado project environment for the Vivado simulator, ModelSim or VCS:
set_property unifast true [current_fileset –simset]
See the UNISIM Library for more informaon regarding component les.
For more informaon, see the appropriate third-party simulaon user guide.
Method 2: Using specific UNIFAST modules
Recommended for more advanced users who want to specify which modules to simulate with
the UNIFAST models.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 26
To specify individual library components, Verilog conguraon statements are used. Specify the
following in the config.v le:
The name of the top-level module or conguraon (for example: config cfg_xilinx;)
The name to which the design conguraon applies (for example: design test bench;)
The library search order for cells or instances that are not explicitly called out (for example:
default liblist unisims_ver unifast_ver;)
The map for a parcular CELL or INSTANCE to a parcular library (For example: instance
testbench.inst.O1 use unifast_ver.MMCME2;)
Note: For ModelSim (vsim) only -genblk is added to hierarchy name (for example: instance
testbench.genblk1.inst.genblk1.O1 use unifast_ver.MMCME2; - VSIM).
Example config.v
config cfg_xilinx;
design testbench;
default liblist unisims_ver unifast_ver;
//Use fast MMCM for all MMCM blocks in design
cell MMCME2 use unifast_ver.MMCME2;
//use fast dSO48E1for only this specific instance in the design
instance testbench.inst.O1 use unifast_ver.DSP48E1;
//If using ModelSim or Questa, add in the genblk to the name
(instance testbench.genblk1.inst.genblk1.O1 use unifast_ver.DSP48E1)
endconfig
Using VHDL UNIFAST Library
The VHDL UNIFAST library has the same basic structure as Verilog and can be used with
architectures or libraries. You can include the library in the test bench le.
The following example uses a drill-down hierarchy with a for call:
library unisim;
library unifast;
configuration cfg_xilinx of testbench
is for xilinx
.. for inst:netlist
. . . use entity work.netlist(inst);
.......for inst
.........for all:MMCME2
..........use entity unifast.MMCME2;
.........end for;
.......for O1 inst:DSP48E1;
.........use entity unifast.DSP48E1;
.......end for;
...end for;
..end for;
end for;
end cfg_xilinx;
Note: If you want to use a VHDL UNIFAST model, you have to use a conguraon to bind the UNIFAST
library during elaboraon.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 27
Using Simulation Settings
You can use the simulaon sengs to specify the target simulator, display the simulaon set, the
simulaon top module name, top module (design under test), tabbed lisng of compilaon,
elaboraon, simulaon, netlist, and advanced opons. From the Vivado IDE Flow Navigator,
right-click Simulaon and select Simulaon Sengs to open the Simulaon Sengs in the
Sengs dialog box, as shown in the following gure.
Figure 3: Settings Dialog Box
The Sengs dialog box includes the following simulaon sengs:
Target simulator: From the simulator drop-down menu, select a simulator. Vivado
®
simulator
is the default simulator. However, many third-party simulators are also supported.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 28
Simulator language: Select the simulator language mode. The simulaon model used for
various IPs in your design varies depending on what language the IP supports.
Simulaon set: Select the simulaon set that the simulaon commands use by default.
IMPORTANT! The compilaon and simulaon sengs for a previously dened simulaon set are not
applied to a newly-dened simulaon set.
Simulaon top module name: Enter an alternate top module to use during simulaon.
Generate simulaon scripts only: Generates scripts if selected. Simulaon is not invoked.
Compiled library locaon: This opon is displayed when you select a third party simulator.
This is a directory path for saving the compiled library results. By default, the libraries are
saved in the current working directory in Non-Project mode. The libraries are saved in the
<project>/<project>.cache/compile_simlib directory in project mode.
Compilaon tab: This tab denes and manages compiler direcves, which are stored as
properes on the simulaon leset and used by the xvlog and xvhdl ulies to compile Verilog
and VHDL source les for simulaon.
Note: xvlog and xvhdl are Vivado simulator specic commands. The applicable ulies will change
based on the target simulator.
Elaboraon tab: This tab denes and manages elaboraon direcves, which are stored as
properes on the simulaon leset and used by the xelab ulity for elaborang and
generang a simulaon snapshot. Select a property in the table to display a descripon of the
property and edit the value.
Note: xelab is a Vivado simulator specic command. The applicable ulies will change based on the
target simulator.
Simulaon tab: This tab denes and manages simulaon direcves, which are stored as
properes on the simulaon leset and used by the xsim applicaon for simulang the current
project. Select a property in the table to display a descripon of the property and edit the
value.
Netlist tab: This tab provides access to netlist conguraon opons related to SDF annotaon
of the Verilog netlist and the process corner captured by SDF delays. These opons are stored
as properes on the simulaon leset and are used while wring the netlist for simulaon.
Advanced tab: This tab contains two opons:
Enable incremental compilaon: This opon enables the incremental compilaon and
preserves the simulaon les during successive run.
Include all design sources for simulaon: By default, this opon is enabled. Selecng this
opon ensures that all the les from design sources along with the les from the current
simulaon set will be used for simulaon. Even if you change the design sources, the same
changes will be updated when you launch behavioral simulaon.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 29
CAUTION! Changing the sengs in the Advanced tab should be done only if necessary. The Include
all design sources for simulaon check box is selected by default. Deselecng the box could produce
unexpected results. As long as the check box is selected, the simulaon set includes Out-of-Context
(OOC) IP, IP Integrator les, and DCP.
Note: For detailed informaon on the properes in the Compilaon, Elaboraon, Simulaon, Netlist,
and Advanced tabs, see Appendix A: Compilaon, Elaboraon, Simulaon, Netlist, and Advanced
Opons.
Understanding the Simulator Language Option
Most Xilinx IP deliver behavioral simulaon models for a single language only, eecvely
disabling simulaon for language-locked simulators if you are not licensed for the appropriate
language. The simulator_language property ensures that an IP delivers a simulaon model
for any given language. For example, if you are using a single language simulator, you set the
simulator_language property to match the language of the simulator.
The Vivado Design Suite ensures the availability of a simulaon model by using the available
synthesis les of an IP to generate a language-specic structural simulaon model on demand.
For cases in which a behavioral model is missing or does not match the licensed simulaon
language, the Vivado tools automacally generate a structural simulaon model to enable
simulaon. Otherwise, the exisng behavioral simulaon model for the IP is used. If no synthesis
or simulaon les exist, simulaon is not supported.
Note: The simulator_language property cannot deliver a language-specic simulaon netlist le if the
generated Synthesized checkpoint (.dcp) is disabled.
1. In the Flow Navigator, click IP Catalog to open the IP catalog.
2. Right-click the appropriate IP and select Customize IP from the popup menu.
3. In the Customize IP dialog box, click OK.
The Generate Output Products dialog box (shown in the following gure) opens.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 30
Figure 4: Generate Output Products Dialog Box
The following table illustrates the funcon of the simulator_language property.
Table 7: Function of simulator_language Property
IP Delivered Simulation Model simulator_language Value Simulation Model Used
IP delivers VHDL and Verilog behavioral
models
Mixed Behavioral model (target_language)
Verilog Verilog behavioral model
VHDL VHDL behavioral model
IP delivers Verilog behavioral model
only
Mixed Verilog behavioral model
Verilog Verilog behavioral model
VHDL VHDL simulation netlist generated from DCP
IP delivers VHDL behavioral model only Mixed VHDL behavioral model
Verilog Verilog simulation netlist generated from
DCP
VHDL VHDL behavioral model
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 31
Table 7: Function of simulator_language Property (cont'd)
IP Delivered Simulation Model simulator_language Value Simulation Model Used
IP delivers no behavioral models Mixed, Verilog, VHDL Netlist generated from DCP
(target_language)
Notes:
1. Where available, behavioral simulation models always take precedence over structural simulation models. The Vivado
tools select behavioral or structural models automatically, based on model availability. It is not possible to override
the automated selection.
2. Use the target_language property when either language can be used for simulation Tcl: set_property
target_language VHDL [current_project]
3. Setting VHDL as a target language for Versal
®
devices is not yet supported. This will result in an error in simulation.
Setting the Simulation Runtime Resolution
Set the simulaon run-me resoluon using `timescale in test bench. There is no simulator
performance gain achieved through use of coarser resoluon with the Xilinx simulaon models.
(In Xilinx simulaon models, most simulaon me is spent in delta cycles, and delta cycles are not
aected by simulator resoluon.)
IMPORTANT! Run simulaons using a me resoluon of 1 fs. Some Xilinx primive components, such as
GT, require a 1 fs resoluon to work properly in either funconal or ming simulaon.
See Simulaon Opons for detailed informaon on Simulaon Opons in Sengs dialog box.
IMPORTANT!
Picoseconds are used as the minimum resoluon because tesng equipment can measure
ming only to the nearest picosecond resoluon.
Adding or Creating Simulation Source Files
To add simulaon sources to a Vivado Design Suite project:
1. Select File → Add Sources, or click Add Sources in the Flow Navigator.
The Add Sources wizard opens.
2. Select Add or Create Simulaon Sources, and click Next.
The Add or Create Simulaon Sources dialog box opens. The opons are:
Add Files: Invokes a le browser so you can select simulaon source les to add to the
project.
Add Directories: Invokes directory browser to add all simulaon source les from the
selected directories. Files in the specied directory with valid source le extensions are
added to the project.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 32
Create File: Invokes the Create Source File dialog box where you can create new
simulaon source les. See this link in the Vivado Design Suite User Guide: System-Level
Design Entry (UG895) for more informaon about project source les.
Buons on the side of the dialog box let you do the following:
Remove : Removes the selected source les from the list of les to be added.
Move Up : Moves the le up in the list order.
Move Down
: Moves the le down in the list order.
Check boxes in the wizard provide the following opons:
- Scan and add RTL include les into project: Scans the added RTL le and adds any
referenced include les.
- Copy sources into project: Copies the original source les into the project and uses
the local copied version of the le in the project.
If you elected to add directories of source les using the Add Directories command, the
directory structure is maintained when the les are copied locally into the project.
- Add sources from subdirectories: Adds source les from the subdirectories of
directories specied in the Add Directories opon.
- Include all design sources for simulaon: Includes all the design sources for
simulaon.
VIDEO: For a demonstraon of this feature, see the Vivado Design Suite QuickTake Video: Logic
Simulaon.
Working with Simulation Sets
The Vivado IDE stores simulaon source les in simulaon sets that display in folders in the
Sources window, and are either remotely referenced or stored in the local project directory.
The simulaon set lets you dene dierent sources for dierent stages of the design. For
example, there can be one test bench source to provide smulus for behavioral simulaon of the
elaborated design or a module of the design, and a dierent test bench to provide smulus for
ming simulaon of the implemented design.
When adding simulaon sources to the project, you can specify which simulaon source set to
use.
To edit a simulaon set:
1. In the Sources window popup menu, right click Simulaon Sources and click Edit Simulaon
Sets, as shown in the following gure.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 33
The Add or Create Simulaon Sources wizard opens.
2. From the Add or Create Simulaon Sources wizard, select
Add Sources.
This adds the sources associated with the project to the newly-created simulaon set.
3. Add addional les as needed.
The selected simulaon set is used for the acve design run.
Generating a Netlist
To run simulaon of a synthesized or implemented design run the netlist generaon process. The
netlist generaon Tcl commands can take a synthesized or implemented design database and
write out a single netlist for the enre design.
The Vivado Design Suite generates a netlist automacally when you launch the simulator using
the IDE or the launch_simulation command.
Netlist generaon Tcl commands can write SDF and the design netlist. The Vivado Design Suite
provides the following Tcl commands:
write_verilog: Verilog netlist
write_vhdl: VHDL netlist
write_sdf: SDF generaon
TIP:
The SDF values are only esmates early in the design process (for example, during synthesis). As the
design process progresses, the accuracy of the ming numbers also progress when there is more
informaon available in the database.
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 34
Generating a Functional Netlist
The Vivado Design Suite supports wring out a Verilog or VHDL structural netlist for funconal
simulaon. The purpose of this netlist is to run simulaon (without ming) to check that the
behavior of the structural netlist matches the expected behavioral model (RTL) simulaon.
The funconal simulaon netlist is a hierarchical, folded netlist that is expanded to the primive
module or enty level; the lowest level of hierarchy consists of primives and macro primives.
These primives are contained in the following libraries:
UNISIMS_VER simulaon library for Verilog simulaon
UNISIMS simulaon library for VHDL simulaon
In many cases, you can use the same test bench that you used for behavioral simulaon to
perform a more accurate simulaon.
The following Tcl commands generate Verilog and VHDL funconal simulaon netlist,
respecvely:
write_verilog -mode funcsim <Verilog_Netlist_Name.v>
write_vhdl -mode funcsim <VHDL_Netlist_Name.vhd>
Generating a Timing Netlist
You can use a Verilog ming simulaon to verify circuit operaon aer the Vivado tools have
calculated the worst-case placed and routed delays.
In many cases, you can use the same test bench that you used for funconal simulaon to
perform a more accurate simulaon.
Compare the results from the two simulaons to verify that your design is performing as inially
specied.
There are two steps to generang a ming simulaon netlist:
1. Generate a simulaon netlist le for the design.
2. Generate an SDF delay le with all the ming delays annotated.
IMPORTANT! Vivado IDE supports Verilog ming simulaon only.
TIP: If you are a VHDL user, you can run post-synthesis and post-implementaon funconal
simulaon (in which case no standard default format (SDF) annotaon is required and the simulaon
netlist uses the UNISIM library). You can create the netlist using the write_vhdl Tcl command. For
usage informaon, see the Vivado Design Suite Tcl Command Reference Guide (UG835).
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 35
The following is the Tcl syntax for generang a ming simulaon netlist:
write_verilog -mode timesim -sdf_anno true <Verilog_Netlist_Name>
Using Versal CIPS VIP
The Versal
®
ACAP Control, Interfaces, and Processing System (CIPS) Vericaon Intellectual
Property (VIP) supports the funconal simulaon of Versal ACAP applicaons. It is targeted to
enable the funconal vericaon of the programmable logic (PL) by mimicking the processor
system (PS)-PL interfaces and OCM memories of the PS logic. This VIP is delivered as a package
of System Verilog modules. The VIP operaon is controlled by using a sequence of System
Verilog tasks. This is supported in the latest version of Vivado. For more informaon, see Versal
ACAP CIPS Vericaon IP Data Sheet (DS996).
Chapter 2: Preparing for Simulation
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 36
Chapter 3
Simulating with Third-Party
Simulators
The Vivado
®
Design Suite supports simulaon using third-party tools. Simulaon with third-party
tools can be performed directly from within the Vivado Integrated Design Environment (IDE) or
using a custom external simulaon environment.
Table 8: Supported Third-Party Simulators
Third-party Simulators Red Hat 64-bit Linux Windows 10 64-bit
Siemens EDA ModelSim SE Yes Yes
Siemens EDA Questa Advanced Simulator Yes Yes
Cadence Xcelium Parallel Simulator Yes NA
Synopsys VCS Yes NA
Aldec Active HDL NA Yes
Aldec Riviera PRO Yes Yes
The Vivado Design Suite User Guide: Using the Vivado IDE (UG893) describes the use of the Vivado
IDE.
Please set the following environment variables before running simulaon in Vivado IDE.
Table 9: Environment Variable Setting for Third-Party Simulators
Simulator Linux Windows
Modelsim
setenv MODEL_TECH <tool installation path>
setenv LM_LICENSE_FILE <license file>
setenv PATH ${MODEL_TECH}/bin:$PATH
set MODEL_TECH=<tool
installation path>
set LM_LICENSE_FILE=<license
file>
set Path=%MODEL_TECH%
\win32;%Path%
Questa
setenv MODEL_TECH <tool installation path>
setenv LM_LICENSE_FILE <license file>
setenv PATH ${MODEL_TECH}/bin:$PATH
set MODEL_TECH=<tool
installation path>
set LM_LICENSE_FILE=<license
file>
set Path=%MODEL_TECH%
\win32;%Path%
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 37
Table 9: Environment Variable Setting for Third-Party Simulators (cont'd)
Simulator Linux Windows
Riviera
In BASH
source <install_path>/etc/setenv
source <install_path>/etc/setgcc
call <install_path>/etc/
setenv.bat
call <install_path>/etc/
setgcc.bat
Active-HDL
NA
set ACTIVE_BIN=<tool
installation path>
set Path=%<Active_hdl install
dir>%\BIN;%Path%
set LM_LICENSE_FILE=<license
file>
Xcelium
setenv CDS_INST_DIR <xcelium_install_dir>
setenv LD_LIBRARY_PATH $CDS_INST_DIR/tools/
xcelium/lib:$LD_LIBRARY_PATH
setenv PATH $CDS_INST_DIR/tools/xcelium/
bin:$CDS_INST_DIR/tools/bin:$PATH
setenv CDS_LICENSE_DIR <tool_license>
NA
VCS
setenv VCS_HOME <tool_install_path>
setenv LM_LICENSE_FILE <license_file_path>
setenv PATH ${VCS_HOME}/bin:${PATH}
NA
Notes:
1. Tool installation path should be added to environment variable PATH (irrespective of OS). To simulate SystemC based
designs for the supported simulator, provide the required g++ version installation path as mentioned in Appendix F:
SystemC Support in Vivado IDE. The LD_LIBRARY_PATH should also include simulator library path.
For links to more informaon on your third party simulator, see Links to Addional Informaon
on Third-Party Simulators.
IMPORTANT!
Use only supported versions of third-party simulators. For more informaon on supported
Simulators and Operang Systems, see the Compable Third-Party Tools table in the Vivado Design Suite
User Guide: Release Notes, Installaon, and Licensing (UG973).
Running Simulation Using Third Party
Simulators with Vivado IDE
IMPORTANT!
Conrm the compiled library locaon (the path at which
compile_simlib
was invoked
or the one you specied with the
-directory
opon) before running a third-party simulaon.
From the Vivado IDE, you can compile, elaborate, and simulate the design based on the
simulaon sengs and launch the simulator in a separate window.
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 38
When you run simulaon prior to synthesizing the design, the simulator runs a behavioral
simulaon. Following each successful design step (synthesis and implementaon), the opon to
run a funconal or ming simulaon becomes available. You can iniate a simulaon run from
the Flow Navigator or by typing in a Tcl command.
From the Flow Navigator, click Run Simulaon, and select the type of simulaon you want to run,
as shown in the following gure:
Figure 5: Types of Simulation
To use the corresponding Tcl command, type: launch_simulation
TIP:
This command provides a
-scripts_only
opon that can be used to write a DO or SH le,
depending on the target simulator. Use the DO or SH le to run simulaons outside the IDE.
Note: If you are running VCS simulator outside of Vivado, make sure to use -full64 switch. Otherwise,
the simulator will not run if the design contains Xilinx IP.
IMPORTANT!
Use the following command to run the 32-bit Simulator:
set_property 32bit 1
[current_fileset -simset]
Note: Xilinx Vericaon IP (VIP) uses SystemVerilog construct. If you are using any IP which instanates
VIP, make sure that your simulator supports SystemVerilog.
Running Timing Simulation Using Third-Party Tools
TIP:
Post-Synthesis ming simulaon uses the esmated ming delay from the synthesized netlist. Post-
Implementaon ming simulaon uses actual ming delays.
When you run Post-Synthesis and Post-Implementaon ming simulaon, the simulators include:
Gate-level netlist containing SIMPRIMS library components
SECUREIP
Standard Delay Format (SDF) les
You dene the overall design funconality in the beginning. When the design is implemented,
accurate ming informaon is available.
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 39
To create the netlist and SDF, the Vivado Design Suite:
Calls the netlist writer, write_verilog with the -mode timesim switch and write_sdf
(SDF annotator)
Sends the generated netlist to the target simulator
You control these opons using Simulaon Sengs as described in Using Simulaon Sengs.
IMPORTANT! Post-Synthesis and Post-Implementaon ming simulaons are supported for Verilog only.
There is no support for VHDL ming simulaon. If you are a VHDL user, you can run post-synthesis and
post-implementaon funconal simulaon (in which case no SDF annotaon is required and the
simulaon netlist uses the UNISIM library). You can create the netlist using the
write_vhdl
Tcl
command. For usage informaon, refer to the Vivado Design Suite Tcl Command Reference Guide
(UG835).
Post-Synthesis Timing Simulation
When synthesis runs successfully, the Run Simulaon → Post-Synthesis Timing Simulaon
opon becomes available.
Aer you select a post-synthesis ming simulaon, the ming netlist and the SDF le are
generated. The netlist les includes $sdf_annotate command so that the generated SDF le is
picked up.
Post-Implementation Timing Simulations
When post-implementaon is successful, the Run Simulaon → Post-Implementaon Timing
Simulaon opon becomes available.
Aer you select a post-implementaon ming simulaon, the ming netlist and the SDF le are
generated. The netlist les includes $sdf_annotate command so that the generated SDF le is
picked up.
Annotating the SDF File for Timing Simulation
When you specied simulaon sengs, you specied whether or not to create an SDF le and
whether the process corner would be set to fast or slow.
TIP:
To nd the SDF le opons sengs, in the Vivado IDE Flow Navigator, right-click Simulaon and
select Simulaon Sengs. In the Sengs dialog box, select Simulaon category and click Netlist tab.
Based on the specied process corner, the SDF le contains dierent min and max numbers.
RECOMMENDED:
To run a setup check, create an SDF le with -process_corner slow, and use the max
column from the SDF le.
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 40
To run a hold check, create an SDF le with the -process_corner fast, and use the min column
from the SDF le. The method for specifying which SDF delay eld to use is dependent on the
simulaon tool you are using. Refer to the specic simulaon tool documentaon for informaon
on how to set this opon.
To get full coverage run all four ming simulaons, specify as follows:
1. Slow corner: SDFMIN and SDFMAX
2. Fast corner: SDFMIN and SDFMAX
Running Standalone Timing Simulation
If you are running ming simulaon from Vivado IDE, it will add the ming simulaon related
switches to simulator. If you run standalone ming simulaon, make sure to pass the following
switch to simulators during elaboraon:
For VCS:
+pulse_e/<number> and +pulse_r/<number> +transport_int_delays
During elaboraon (with VCS)
For ModelSim/Questa Advanced Simulator:
+transport_int_delays +pulse_int_e/0 +pulse_int_r/0
During elaboraon (with vsim)
IMPORTANT!
The Vivado simulator models use interconnect delays; consequently, addional switches
are required for proper ming simulaon, as follows:
-transport_int_delays -pulse_r 0 -
pulse_int_r 0
. Table 15: xelab, xvhd, and xvlog Command Opons provides descripons for the these
commands.
Dumping SAIF for Power Analysis
The Switching Acvity Interchange Format (SAIF) is an ASCII report that assists in extracng and
storing switching acvity informaon generated by simulator tools. This switching acvity can be
back-annotated into the Xilinx power analysis and opmizaon tools for the power
measurements and esmaons.
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 41
Dumping SAIF in Questa Advanced Simulator/
ModelSim
Questa Advanced Simulator/ModelSim uses explicit power commands to dump an SAIF le, as
follows:
1. Specify the scope or signals to dump, by typing:
power add <hdl_objects>
2. Run simulaon for specic me (or run -all).
3. Dump out the power report, by typing:
power report -all filename.saif
For more detailed usage or informaon about each commands, see the ModelSim
documentaon.
Example DO File
power add tb/fpga/*
run 500us
power report -all -bsaif routed.saif
quit
Dumping SAIF in VCS
VCS provides power commands to generate SAIF with specic requirements.
1. Specify the scope and signals to be generated, by typing:
power <hdl_objects>
2. Enable SAIF dumping. You can use the command line in the simulator workspace:
power -enable
3. Run simulaon for a specic me.
4. Disable power dumping and report the SAIF, by typing:
power -disable
power -report filename.saif
For more detailed usage or informaon about each command, see the Synopsys VCS
documentaon.
See Power Analysis Using Vivado Simulator for more informaon about Switching Acvity
Interchange Format (SAIF).
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 42
Dumping VCD
You can use a Value Change Dump (VCD) le to capture simulaon output. The Tcl commands
are based on Verilog system tasks related to dumping values.
Dumping VCD in Questa Advanced Simulator/
ModelSim
Questa Advanced Simulator/ModelSim uses explicit VCD commands to dump a VCS le, as
follows:
1. Open the VCD le:
vcd file my_vcdfile.vcd
2. Specify the scope or signals to dump:
vcd add <hdl_objects>
3. Run simulaon for a specied period of me (or run -all).
For more detailed usage or informaon about each commands, see the ModelSim
documentaon.
Example DO File:
vcd file my_vcdfile.vcd
vcd add -r tb/fpga/*
run 500us
quit
Dumping VCD in VCS
In VCS, you can generate a VCD le using the dumpvar command. Specify the le name and
instance name (by default its complete hierarchy).
vcs +vcs+dumpvars+test.vcd
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 43
Simulating IP
In the following example, the accum_0.xci le is the IP you generated from the Vivado
®
IP
catalog. Use the following commands to simulate this IP in VCS:
set_property target_simulator VCS [current_project]
set_property compxlib.vcs_compiled_library_dir
<compiled_library_location>[current_project]
launch_simulation -noclean_dir -of_objects [get_files accum_0.xci]
Using a Custom DO File During an Integrated
Simulation Run
If you have some specic set of commands (custom DO le) that you want to invoke just before
running the simulaon, add those commands in a le and pass that using the appropriate
command, as shown below:
In Questa Advanced Simulator
expanse="page">set_property -name {questa.simulate.tcl.post} -value
{<AbsolutePathOfFileLocation>}
-objects [get_filesets sim_1]
In Modelsim
expanse="page">set_property -name {modelsim.simulate.tcl.post} -value
{<AbsolutePathOfFileLocation>}
-objects [get_filesets sim_1]
In VCS
expanse="page">set_property -name {vcs.simulate.tcl.post} -value
{<AbsolutePathOfFileLocation>} -objects
[get_filesets sim_1]
In Xcelium
expanse="page">set_property -name {xcelium.simulate.tcl.post} -value
{<AbsolutePathOfFileLocation>}
-objects
expanse="page">[get_filesets sim_1]
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 44
Simulation Step Control Constructs for ModelSim
and Questa Advanced Simulator
The following table outlines the constructs used for controlling the step execuon based on the
do le format:
Nave do le: This is a default do le format. In this format, the compile and elaborate shell
scripts calls source <tb>_compile/elaborate.do. For example:
source bft_tb_compile.do 2>&1 | tee -a compile.log
The simulate script calls vsim -64 -c -do do {<tb>_simulate.do}. For example:
$bin_path/vsim -64 -c -do do {bft_tb_simulate.do} -l simulate.log
Classic do le: Classic do le format is dierent from the nave do le in compile and
elaborate shell scripts. There is no change in the simulate script. In compile and elaborate shell
scripts, it calls vsim -c -do do {<tb>_compile/elaborate.do}. For example,
$bin_path/vsim -64 -c -do do {bft_tb_compile.do} -l compile.log
To get this, set project.writeNativeScriptForUnifiedSimulation to 0 by invoking
set_param project.writeNativeScriptForUnifiedSimulation 0 on Tcl console
command.
This le format is useful for a shared project as the path for Questa Advanced Simulator/
ModelSim ulity is hard-coded inside the shell scripts.
Table 10: Simulation Step Control Construct Parameters
Parameter Description Default
project.writeNativeScriptForUnifiedSimulatio
n
Write a pure .do file with simulator command
only (no Tcl or Shell constructs).
0 (false)
simulator.quitOnSimulationComplete
Quit simulator on simulator completion for
ModelSim/Questa Advanced Simulator
simulation. To disable quit, set this parameter
to false.
1 (true)
simulator.modelsimNoQuitOnError
Do not quit on error or break by default for
ModelSim/Questa Advanced Simulator
simulation. To quit simulation on error or
break, set this parameter to false.
1 (true)
Explanation
simulator.quitOnSimulationComplete: By default, the generated simulate.do has
quit -force. When the simulaon is complete in the specied me, the simulator exits. If
you do not want the simulator to exit, set simulator.quitOnSimulationComplete to 0
by invoking set_peram simulator.quitOnSimulationComplete 0.
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 45
simulator.modelsimNoQuitOnError: By default, on error or break, simulator does not
exit. If you want to exit the simulator, set the following parameter:
set_param simulator.modelsimNoQuitOnError 0
This adds the following two lines in <tb>_simulate.do.
onbreak {quit -f}
onerror {quit -f}
Running Third-Party Simulators in Batch
Mode
The Vivado Design Suite supports batch or scripted simulaon for third party vericaon. With
the design les gathered, and the scripts generated to support your target simulator, you can
inspect the scripts and incorporate them into your vericaon environment. Xilinx recommends
that you use the export_simulation scripts as a starng point for your simulaon ow rather
than building a custom API to generate scripts. See Exporng Simulaon Files and Scripts for
more informaon on exporng simulaon scripts.
Make sure that you have the correct environment setup for the simulator before running the
scripts. See Using Simulaon Sengs for more informaon on conguring your simulator. See
the User Guide of your specic simulator for the details of running batch or scripted mode.
Chapter 3: Simulating with Third-Party Simulators
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 46
Chapter 4
Simulating with Vivado Simulator
The Vivado simulator is a Hardware Descripon Language (HDL) event-driven simulator that
supports funconal and ming simulaons for VHDL, Verilog, SystemVerilog (SV), and mixed
VHDL/Verilog or VHDL/SV designs.
The Vivado simulator supports the following features:
Source code debugging (step, breakpoint, current value display)
SDF annotaon for ming simulaon
VCD dumping
SAIF dumping for power analysis and opmizaon
Nave support for HardIP blocks (such as serial transceivers and PCIe
®
)
Mul-threaded compilaon
Mixed language (VHDL, Verilog, or SystemVerilog design constructs)
Single-click simulaon re-compile and re-launch
One-click compilaon and simulaon
Built-in support for Xilinx simulaon libraries
Real-me waveform update
See the Vivado Design Suite Tutorial: Logic Simulaon (UG937) for a step-by-step demonstraon of
how to run Vivado simulaon.
Running the Vivado Simulator
IMPORTANT!
If you are using the Vivado simulator, be sure to specify all appropriate project sengs for
your design before running simulaon. For supported third-party simulators, see Chapter 3: Simulang
with Third-Party Simulators.
From the Flow Navigator, click Run Simulaon and select a simulaon type to invoke the Vivado
simulator workspace, shown in the gure below.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 47
Figure 6: Vivado Simulator Workspace
Main Toolbar
The main toolbar provides one-click access to the most commonly used commands in the Vivado
IDE. When you hover over an opon, a tool p appears that provides more informaon.
Run Menu
The menus provide the same opons as the Vivado IDE with the addion of a Run menu aer
you have run a simulaon.
The Run menu for simulaon is shown in the following gure.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 48
Figure 7: Simulation Run Menu Options
The Vivado simulator Run menu opons:
Restart: Lets you restart an exisng simulaon from me 0. Tcl Command: restart
Run All: Lets you run an open simulaon to compleon. Tcl Command: run -all
Run For: Lets you specify a me for the simulaon to run. Tcl Command: run <time>
TIP: While you can always specify me units in the run command such as
run 100 ns
, you can also
omit the me unit. If you omit the me unit, the Vivado simulator will assume the me unit of the
TIME_UNIT Tcl property. To view the TIME_UNIT property use the Tcl command
get_property
time_unit [current_sim]
. To change the TIME_UNIT property use the Tcl command
set_property time_unit <unit> [current_sim]
, where <unit> is one of the following:
fs, ps, ns, us, ms, and s.
Step: Runs the simulaon up to the next HDL source line.
Break: Lets you pause a running simulaon.
Delete All Breakpoints: Deletes all breakpoints.
Relaunch Simulaon: Recompiles the simulaon les and restarts the simulaon.
Related Information
Re-running the Simulaon Aer Design Changes (relaunch)
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 49
Simulation Toolbar
When you run the Vivado simulator, the simulaon-specic toolbar (shown in the gure below)
opens to the right of the main toolbar.
Figure 8: Simulation Toolbar
These are the same buons labeled in Run Menu, above (without the Delete All Breakpoints
opon), and they are provided for ease of use.
Simulation Toolbar Button Descriptions
Hover over the toolbar buons for tool-p descripons.
Restart: resets the simulaon me to zero.
Run all: runs the simulaon unl it completes all events or unl an HDL statement indicates
that the simulaon should stop.
Run For: runs for a specied period of me.
Step: runs the simulaon unl the next HDL statement.
Break: Pauses the current simulaon.
Relaunch: Recompiles the simulaon sources and restarts the simulaon (aer making code
changes, for example).
Related Information
Re-running the Simulaon Aer Design Changes (relaunch)
Sources Window
The Sources window displays the simulaon sources in a hierarchical tree, with views that show
Hierarchy, IP Sources, Libraries, and Compile Order, as shown in the following gure.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 50
Figure 9: Sources Window
The Sources buons are described by tool ps when you hover the mouse over them. The
buons let you examine, expand, collapse, add to, open, lter and scroll through les.
You can also open or add a source le by right-clicking on the source object and selecng the
Open File or Add Sources opons.
Scope Window
A scope is a hierarchical paron of an HDL design. Whenever you instanate a design unit or
dene a process, block, package, or subprogram, you create a scope.
In the Scope window (shown in the gure below), you can see the design hierarchy. When you
select a scope in the Scope window, all HDL objects visible from that scope appear in the Objects
window. You can select HDL objects in the Objects window and add them to the waveform
viewer.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 51
Figure 10: Scope Window
Filtering Scopes
Click Sengs opon on the scopes sub-menu to toggle between showing or hiding (check or
uncheck) the corresponding scope type.
TIP: When you hide a scope using Seng opon, all scopes inside that scope are also hidden regardless
of type. For example, in the gure above, clicking the Verilog Module buon to hide all Verilog module
scopes would hide not only the
bft_tb
scope but also
uut
(even though
uut
is a VHDL enty
scope).
To limit the display to scopes containing a specied string, click the Search buon and
type the string in the text box.
The objects displayed in the Objects window change (or are ltered) based on the current scope.
Select the current scope to change the objects in the Objects window.
When you right-click a scope, a menu (shown in the following gure) appears with the following
opons:
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 52
Figure 11: Scope Window Options
Add to Wave Window: Adds all viewable HDL objects of the selected scope to the waveform
conguraon.
TIP: HDL objects of large bit width can slow down the display of the waveform viewer. You can lter
out such objects by seng a display limit on the wave conguraon before issuing the Add to Wave
Window command. To set a display limit, use the Tcl command
set_property DISPLAY_LIMIT
<maximum bit width> [current_wave_config]
.
The Add to Wave Window command might add a dierent set of HDL objects from the set
displayed in the Objects window. When you select a scope in the Scope window, the Objects
window might display HDL objects from enclosing scopes in addion to objects dened
directly in the selected scope. The Add to Wave Window command, on the other hand, adds
objects from the selected scope only.
Alternately, you can drag and drop items in the Objects window into the Name column of the
Wave window.
IMPORTANT! The Wave window displays the value changes of an object over me, starng from the
simulaon me at which the object was added.
TIP: To display object values prior to the me of inseron, the simulaon must be restarted. To avoid
having to restart the simulaon because of missing value changes: issue the
log_wave -r /
Tcl
command at the start of a simulaon run to capture value changes for all display-able HDL objects in
your design. For more informaon, see Using the log_wave Tcl Command.
Changes to the waveform conguraon, including creang the waveform conguraon or
adding HDL objects, do not become permanent unl you save the WCFG le.
Go To Source Code: Opens the source code at the denion of the selected scope.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 53
Go To Instanaon Source Code: For Verilog modules and VHDL enty instances, opens the
source code at the point of instanaon for the selected instance.
Set Current Scope to Acve: Set the current scope to selected scope. The selected scope
becomes the acve simulaon scope (i.e. get_property active_scope
[current_sim]). Acve simulaon scope is the HDL process scope, where the simulaon is
currently paused. When used by disabling the follow acve scope in seng, Vivado simulator
will remember the last current_scope selecon even when simulaon proceeds. When a
break-point is hit, current_scope will sll point to last scope which is set as acve scope
Log to Wave Database: You can log either of the following:
The objects of current scope
The objects of the current scope and all scope below the current scope.
TIP: By default, the Vivado simulator suppresses the logging of large HDL objects. To change the size
limit of logged objects, use the
set_property trace_limit <size> [current_sim]
Tcl
command, where
<size>
is the number of scalar elements in the HDL object.
In the source code text editor, you can hover over an idener in the code get the value, as
shown in Scope Window.
IMPORTANT! For this feature to work, be sure you have the scope associated with the source code
selected in the Scope window.
TIP: Because the top module is not instanated, the Go to Instanaon Source Code right-click opon
(shown in the gure above) is grayed out when the top module is selected.
TIP: Use
log_wave
to log the objects of current scope or below. Post simulaon, you can add any
objects on waveform and see the plot starng from me 0 ll current simulaon.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 54
Figure 12: Source Code with Identifier Value Displayed
Additional Scopes and Sources Options
In either the Scope or the Sources window, a search eld displays when you select the Show
Search buon
.
As an equivalent to using the Scope and Objects windows, you can navigate the HDL design by
typing the following in the Tcl Console:
get_scopes
current_scope
report_scopes
id="ai516872">report_values
TIP:
To access source les for eding, you can open les from the Scope or Objects window by selecng Go
to Source Code, as shown in Scope Window.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 55
Figure 13: Context Menu in Scope Window
TIP: Aer you have edited source code and saved the le, you can click the Relaunch buon to
recompile and relaunch simulaon without having to close and reopen the simulaon.
Objects Window
The Objects window displays the HDL simulaon objects associated with the scope selected in
the Scope window, as shown in the following gure.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 56
Figure 14: Objects Window
Icons beside the HDL objects show the type or port mode of each object. This view lists the
Name, Value, and Data Type of the simulaon objects.
You can obtain the current value of an object by typing the following in the Tcl Console.
get_value <hdl_object>
TIP:
To limit the number of digits to display for vectors, use the
set_property
array_display_limit <bits> [current_sim]
command, where <bits> is the number of bits
to display.
The following are the opons available at the top of the Objects window. Click Sengs to view
the selected objects in the Objects window. Use this to lter or limit the contents of the Objects
window.
Search: You can use the Search opon to search for an object name.
Sengs: Sengs opon allows you to display or hide various HDL objects in the Objects
window.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 57
Objects Context Menu
When you right-click an object in the Objects window, a context menu (shown in Objects
Window) appears. The opons in the context menu are described below.
Figure 15: Context Menu in Objects Window
Add to Wave Window: Add the selected object to the waveform conguraon. Alternately,
you can drag and drop the objects from the Objects window to the Name column of the wave
window.
Log to Wave Database: Logs events of the selected object to the waveform database (WDB)
for later viewing in the wave window.
TIP: By default, the Vivado simulator suppresses the logging of large HDL objects. To change the size
limit of logged objects, use the
set_property trace_limit <size> [current_sim]
Tcl
command, where
<size>
is the number of scalar elements in the HDL object.
Show in Wave Window: Highlights the selected object in the wave window.
Default Radix: Set the default radix for all objects in the Objects window and text editor. The
default radix is Hexadecimal. You can change this opon from the context menu.
Tcl command:
set_property radix <new radix> [current_sim]
Where <new radix> is any of the following:
bin
unsigned (for unsigned decimal)
hex
dec (for signed decimal)
ascii
oct
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 58
smag (for signed magnitude)
Note: If you need to change the radix of an individual signal, use radix opon from the context menu.
Radix: Select the numerical format to use when displaying the value of the selected object in
the Objects window and in the source code window.
You can change the radix of an individual object as follows:
1. Right-click an object in the Objects window.
2. From the context menu, select Radix and the format you want to use:
Default
Binary
Hexadecimal
Octal
ASCII
Unsigned Decimal
Signed Decimal
Signed Magnitude
TIP: If you change the radix in the Objects window, it will not be reected in the wave window.
Show as Enumeraon: Select to display the values of a SystemVerilog enumeraon signal or
variable using enumeraon labels.
Note: This menu item is enabled only for SystemVerilog enumeraons. If unchecked, all values of the
enumeraon object display numerically according to the radix set for the object. If checked, those
values for which the enumeraon declaraon denes a label display the label text, and all other values
display numerically.
Report Drivers: Display in the Tcl Console a report of the HDL processes that assign values to
the selected object.
Go To Source Code: Open the source code at the denion of the selected object.
Force Constant: Forces the selected object to a constant value.
Force Clock: Forces the selected object to an oscillang value.
Remove Force: Removes any force on the selected object.
TIP:
If you noce that some HDL objects do not appear in the Waveform Viewer, it is because Vivado
simulator does not support waveform tracing of some HDL objects, such as named events in Verilog
and local variables.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 59
Related Information
Using Force Commands
Wave Window
When you invoke the simulator it opens a wave window by default. The wave window displays a
new wave conguraon consisng of the traceable HDL objects from the top module of the
simulaon, as shown in Wave Window.
TIP: On closing and reopening a project, you must rerun simulaon to view the wave window. If, however,
you unintenonally close the default wave window while a simulaon is acve, you can restore it by
selecng Window → Waveform from the main menu.
Figure 16: Wave Window
To add an individual HDL object or set of objects to the wave window: in the Objects window,
right-click an object or objects and select the Add to Wave Window opon from the context
menu (shown in Objects Window).
To add an object using the Tcl command type: add_wave <HDL_objects>.
Using the add_wave command, you can specify full or relave paths to HDL objects.
For example, if the current scope is /bft_tb/uut, the full path to the reset register under uut
is /bft_tb/uut/reset: the relave path is reset.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 60
TIP: The
add_wave
command accepts HDL scopes as well as HDL objects. Using
add_wave
with a
scope is equivalent to the Add To Wave Window command in the Scope window. HDL objects of large bit
width can slow down the display of the waveform viewer. You can lter out such objects by seng a
display limit on the wave conguraon before issuing the Add to Wave Window command. To set a display
limit, use the Tcl command
set_property DISPLAY_LIMIT <maximum bit width>
[current_wave_config]
.
Wave Objects
The Vivado IDE Wave window is common across a number of Vivado Design Suite tools. An
example of the wave objects in a waveform conguraon is shown in the following gure.
Figure 17: HDL Objects in Waveform
The Wave window displays HDL objects, their values, and their waveforms, together with items
for organizing the HDL objects, such as: groups, dividers, and virtual buses.
Collecvely, the HDL objects and organizaonal items are called a wave conguraon. The
waveform poron of the Wave window displays addional items for me measurement, that
include: cursors, markers, and mescale rulers.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 61
The Vivado IDE traces the value changes of the HDL object in the Wave window during
simulaon, and you use the wave conguraon to examine the simulaon results.
The design hierarchy and the simulaon waveforms are not part of the wave conguraon, and
are stored in a separate wave database (WDB) le.
Context Menu in Waveform Window
When you right-click an object in the Waveform window, a context menu (shown in the following
gure) appears. See Understanding HDL Objects in Waveform Conguraons for more
informaon on HDL objects in Waveforms. The opons in the context menu are described below
Go To Source Code: Opens the source code at the denion of the selected design wave
object.
Show in Object Window: Displays the HDL objects for a design wave object in the Objects
window.
Report Drivers: Display in the Tcl Console a report of the HDL processes that assign values to
the selected wave object.
Force Constant: Forces the selected object to a constant value.
Force Clock: Forces the selected object to an oscillang value.
Remove Force: Removes any force on the selected object.
Find: Opens the Find Toolbar in the Waveform window to search for a wave object by name.
Find Value: Opens the Find Toolbar in the Waveform window to search a waveform for a
value.
Select All: Selects all the wave objects in the Waveform window.
Expand: Shows the sub-objects of the selected wave object.
Collapse: Hides the sub-objects of the selected wave object.
Ungroup: Unpacks the selected group or virtual bus.
Rename: Changes the displayed name of the selected wave object.
Name: Changes the display of the name of the selected wave object to show the full
hierarchical name (long name), the simple signal or bus name (short name), or a custom name.
Waveform Style: Changes the waveform of the selected design wave object to digital or
analog format.
Signal Color: Sets the waveform color of the selected design wave object.
Divider Color: Sets the bar color of the selected divider.
Radix: Sets the radix in which to display values of the selected design wave objects.
Show as Enumeraon: Shows values of the selected SystemVerilog enumeraon wave object
as enumerator labels in place of numbers, whenever possible.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 62
Reverse Bit Order: Reverses the bit order of values displayed for the selected array wave
object.
New Group: Packs the selected wave objects into a folder-like group wave object.
New Divider: Creates a horizontal separator in the list of the Waveform window's wave
objects.
New Virtual Bus: Creates a new logic vector wave object consisng of the bits of the selected
design wave objects.
Cut: Allows you to cut a signal in the Waveform window.
Copy: Allows you to copy a signal in the Waveform window.
Paste: Allows you to paste a signal in the Waveform window.
Delete: Allows you to delete a signal in the Waveform window.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 63
Figure 18: Context Menu of Waveform Objects Window
See Chapter 5: Analyzing Simulaon Waveforms with Vivado Simulator for more informaon
about using the Wave window.
Saving a Waveform Configuration
The new wave conguraon is not saved to disk automacally. Select File → Simulaon
Waveform → Save Conguraon As and supply a le name to save a WCFG le.
To save a wave conguraon to a WCFG le, type the Tcl command save_wave_config
<filename.wcfg>.
The specied command argument names and saves the WCFG le.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 64
IMPORTANT! Zoom sengs are not saved with the wave conguraon.
Related Information
Using Analog Waveforms
Changing the Format of SystemVerilog Enumeraons
Organizing Waveforms
Waveform Object Naming Styles
Using Force Commands
Searching a Value in Waveform Conguraon
Grouping Signals and Objects
Reversing the Bus Bit Order
Creating and Using Multiple Waveform
Configurations
In a simulaon session you can create and use mulple wave conguraons, each in its own
Wave window. When you have more than one Wave window displayed, the most recently-
created or recently-used window is the acve window. The acve window, in addion to being
the window currently visible, is the Wave window upon which commands external to the window
apply. For example: HDL Objects → Add to Wave Window.
You can set a dierent Wave window to be the acve window by clicking the tle of the window.
Related Information
Disnguishing Between Mulple Simulaon Runs
Creang a New Wave Conguraon
Running Functional and Timing Simulation
As soon as your project is created in the Vivado Design Suite, you can run behavioral simulaon.
You can run funconal and ming simulaons on your design aer successfully running synthesis
and/or implementaon. To run simulaon: in the Flow Navigator, select Run Simulaon and
choose the appropriate opon from the popup menu shown in the gure below.
TIP:
Availability of popup menu opons is dependent on the design development stage. For example, if you
have run synthesis but have not yet run implementaon, the implementaon opons in the popup menu
are grayed out.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 65
Figure 19: Simulation Run Options
Running Functional Simulation
Post-Synthesis Functional Simulation
You can view Run Simulaon → Post-Synthesis Funconal Simulaon opon (shown in the
previous gure) aer compleng a successful synthesis run.
Aer synthesis, the general logic design has been synthesized into device-specic primives.
Performing a post-synthesis funconal simulaon ensures that any synthesis opmizaons have
not aected the funconality of the design. Aer you select a post-synthesis funconal
simulaon, the funconal netlist is generated, and the UNISIM libraries are used for simulaon.
Post-Implementation Functional Simulations
The Run Simulaon → Post-Implementaon Funconal Simulaon opon (shown in the previous
gure) becomes available aer compleng implementaon run.
Aer implementaon, the design has been placed and routed in hardware. A funconal
vericaon at this stage is useful in determining if any physical opmizaons during
implementaon have aected the funconality of your design.
Aer you select a post-implementaon funconal simulaon, the funconal netlist is generated
and the UNISIM libraries are used for simulaon.
Running Timing Simulation
TIP:
Post-Synthesis ming simulaon uses the esmated ming delay from the device models and does not
include interconnect delay. Post-Implementaon ming simulaon uses actual ming delays.
When you run Post-Synthesis and Post-Implementaon ming simulaon the simulator tools
include:
Gate-level netlist containing SIMPRIMS library components
SECUREIP
Standard Delay Format (SDF) les
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 66
You dened the overall funconality of the design in the beginning. When the design is
implemented, accurate ming informaon is available.
To create the netlist and SDF, the Vivado Design Suite:
Calls the netlist writer, write_verilog with the -mode timesim switch and write_sdf
(SDF annotator)
Sends the generated netlist to the target simulator
You control these opons using Simulaon Sengs as described in Using Simulaon Sengs.
IMPORTANT! Post-Synthesis and Post-Implementaon ming simulaons are supported for Verilog only.
There is no support for VHDL ming simulaon. If you are a VHDL user, you can run post synthesis and
post implementaon funconal simulaon (in which case no SDF annotaon is required and the simulaon
netlist uses the UNISIM library). You can create the netlist using the write_vhdl Tcl command. For usage
informaon, refer to the Vivado Design Suite Tcl Command Reference Guide (UG835).
IMPORTANT! The Vivado simulator models use interconnect delays; consequently, addional switches
are required for proper ming simulaon, as follows:
-transport_int_delays -pulse_r 0 -
pulse_int_r 0
Post-Synthesis Timing Simulation
The Run Simulaon → Post-Synthesis Timing Simulaon opon (shown in the previous gure)
becomes available aer compleng a successful synthesis run.
Aer synthesis, the general logic design has been synthesized into device-specic primives, and
the esmated roung and component delays are available. Performing a post-synthesis ming
simulaon allows you to see potenal ming-crical paths prior to invesng in implementaon.
Aer you select a post-synthesis ming simulaon, the ming netlist and the esmated delays in
the SDF le are generated. The netlist les includes $sdf_annotate command so that the
simulaon tool includes the generated SDF le.
Post-Implementation Timing Simulations
The Run Simulaon → Post-Implementaon Timing Simulaon opon (shown in the previous
gure) becomes available aer compleng implementaon run.
Aer implementaon, the design has been implemented and routed in hardware. A ming
simulaon at this stage helps determine whether or not the design funconally operates at the
specied speed using accurate ming delays. This simulaon is useful for detecng
unconstrained paths, or asynchronous path ming errors, for example, on resets. Aer you select
a post-implementaon ming simulaon, the ming netlist and the SDF le are generated. The
netlist les includes $sdf_annotate command so that the generated SDF le is picked up.
When you specied simulaon sengs, you specied whether or not to create an SDF le and
whether the process corner would be set to fast or slow.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 67
TIP: To nd the SDF le oponal sengs, in the Vivado IDE Flow Navigator, right click Simulaon and
select Simulaon Sengs. In the Sengs dialog box, select Simulaon category and click Netlist tab.
Based on the specied process corner, the SDF le contains dierent min and max numbers.
Run two separate simulaons to check for setup and hold violaons.
To run a setup check, create an SDF le with -process_corner slow, and use the max column from
the SDF le.
To run a hold check, create an SDF le with the -process_corner fast, and use the min column
from the SDF le. The method for specifying which SDF delay eld to use is dependent on the
simulaon tool you are using. Refer to the specic simulaon tool documentaon for informaon
on how to set this opon.
To get full coverage run all four ming simulaons, specify as follows:
Slow corner: SDFMIN and SDFMAX
Fast corner: SDFMIN and SDFMAX
Saving Simulation Results
The Vivado simulator saves the simulaon results of the objects (VHDL signals, or Verilog reg or
wire) being traced to the Waveform Database (WDB) le (<filename>.wdb) in the
<project>.sim/<simset> directory.
If you add objects to the Wave window and run the simulaon, the design hierarchy for the
complete design and the transions for the added objects are automacally saved to the WDB
le. You can also add objects to the waveform database that are not displayed in the Wave
window using the log_wave command. For informaon about the log_wave command, see
Using the log_wave Tcl Command.
Distinguishing Between Multiple Simulation
Runs
When you have run several simulaons against a design, the Vivado simulator displays named
tabs at the top of the workspace with the simulaon type that is currently in the window
highlighted, as shown in the following gure.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 68
Figure 20: Active Simulation Type
Closing a Simulation
To close a simulaon, in the Vivado IDE:
Select File > Exit or click the X at the top-right corner of the project window.
CAUTION! When there are mulple simulaons running, clicking the X on the blue tle bar closes all
simulaons. To close a single simulaon, click the X on the small gray or white tab under the blue tle bar.
To close a simulaon from the Tcl Console, type:
close_sim
The Tcl command rst checks for unsaved wave conguraons. If any exist, the command issues
an error. Close or save unsaved wave conguraons before issuing the close_sim command, or
add the -force opon to the Tcl command.
Note: It is always recommended to use close_sim command to completely close the simulaon before
using close_project command to close the current project.
Adding a Simulation Start-up Script File
You can add custom Tcl commands in a batch le to the project so that they are run with the
simulaon. These commands are run aer simulaon begins. An example of this process is
described in the steps below.
1. Create a Tcl script with the simulaon commands you want to add to the simulaon source
les. For example, if you have a simulaon that runs for 1,000 ns, and you want it to run
longer, create a le that includes:
run 5us
Or, if you want to monitor signals that are not at the top level (because, by default, only top-
level signals are added to the waveform), you can add them to the post.tcl script. For
example:
add_wave/top/I1/<signalName>
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 69
2. Name the le post.tcl and save it.
3. Use the Add Sources opon in Flow Navigator to invoke the Add Sources wizard, and select
Add or Create Simulaon Sources.
4. Add the post.tcl le to your Vivado Design Suite project as a simulaon source. The
post.tcl le displays in the Simulaon Sources folder, as shown in the following gure.
5. From the Simulaon toolbar, click the Relaunch buon .
Simulaon runs again, with the addional me you specied in the post.tcl le added to
the originally specied me. Noce that the Vivado simulator automacally sources the
post.tcl le aer invoking all its commands.
Viewing Simulation Messages
The Vivado IDE contains a message area where you can view informaonal, warning, and error
messages. As shown in the following gure, some messages from the Vivado simulator contain an
issue descripon and a suggested resoluon.
To see the same detail in the Tcl Console, type:
help -message {message_number}
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 70
Figure 21: Simulator Message Description and Resolution Information
An example of such a command is as follows:
help -message {simulator 43-3120}
Managing Message Output
If your HDL design produces a large number of messages (for example, via the $display Verilog
system task or report VHDL statement), you can limit the amount of text output sent to the Tcl
Console and log le. This saves computer memory and disk space. To accomplish this, use the -
maxlogsize command line opon:
1. In the Flow Navigator, right-click on SIMULATION and select Simulaon Sengs.
2. In the Sengs dialog box, add -maxlogsize <size> next to
xsim.simulate.xsim.more_options, where <size> is the maximum amount of text
output in megabytes.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 71
Using the launch_simulation Command
The launch_simulation command lets you run any supported simulator in script mode.
The syntax of launch_simulation is as follows:
launch_simulation [-step <arg>] [-simset <arg>] [-mode <arg>] [-type <arg>]
[-scripts_only] [-of_objects <args>] [-absolute_path]
[-install_path <arg>] [-noclean_dir] [-quiet] [-
verbose][-gcc_install_path <arg>][-exec]
The following table describes the opons of launch_simulation.
Table 11: launch_simulation Options
Option Description
[-step]
Launch a simulation step. Values: all, compile, elaborate, simulate. Default: all (launch all
steps).
[-simset]
Name of the simulation fileset.
[-mode]
Simulation mode. Values: behavioral, post-synthesis, post-implementation Default: behavioral.
[-type]
Netlist type. Values: functional, timing. This is only applicable when the mode is set to post-
synthesis or post-implementation.
[-scripts_only]
Only generate scripts.
[-of_objects]
Generate compile order file for this object (applicable with -scripts_only option only)
[-absolute_path]
Make all file paths absolute with respect to the reference directory.
[-install_path]
Custom installation directory path.
[-noclean_dir]
Do not remove simulation run directory files.
[-quiet]
Ignore command errors.
[-verbose]
Suspend message limits during command execution.
[-gcc_install_path]
Specify GNU compiler installation directory path for g++/gcc executable
[-exec] Execute existing script for the step specified with the -step switch.
Examples
Running behavioral simulaon using Vivado simulator
create_project project_1 project_1 -part xc7vx485tffg1157-1
add_files -norecurse tmp.v
add_files -fileset sim_1 -norecurse testbench.v
import_files -force -norecurse
update_compile_order -fileset sources_1
update_compile_order -fileset sim_1
launch_simulation
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 72
Generang script for behavioral simulaon with Questa Advanced Simulator.
create_project project_1 project_1 -part xc7vx485tffg1157-1
add_files -norecurse tmp.v
add_files -fileset sim_1 -norecurse testbench.v
import_files -force -norecurse
update_compile_order -fileset sources_1
update_compile_order -fileset sim_1
set_property target_simulator Questa [current_project]
set_property compxlib.questa_compiled_library_dir
<compiled_library_location>
[current_project]
launch_simulation -scripts_only
Launching post-synthesis funconal simulaon using Synopsys VCS
set_property target_simulator VCS [current_project]
set_property compxlib.vcs_compiled_library_dir
<compiled_library_location>
[current_project]
launch_simulation -mode post-synthesis -type functional
Running post-implementaon ming simulaon using Synopsys VCS
set_property target_simulator vcs [current_project]
set_property compxlib.vcs_compiled_library_dir
<compiled_library_location> [current_project]
launch_simulation -mode post-implementation -type timing
Re-running the Simulation After Design
Changes (relaunch)
While debugging your HDL design with the Vivado simulator, you can determine that your HDL
source code needs correcon.
Use the following steps to modify your design and re-run the simulaon:
1. Use the Vivado code editor or other text editor to update and save any necessary source
code changes.
2. Use the Relaunch
buon on the Vivado IDE toolbar to re-compile and re-launch the
simulaon as shown in the following gure. You may alternavely use the relaunch_sim
Tcl command to re-compile and re-launch the simulaon.
Figure 22: Relaunch Sim Option
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 73
3. If the modied design fails to compile, an error box appears displaying the reason for failure.
The Vivado IDE connues to display the results of the previous run of the simulaon in a
disabled state. Return to step 1 to correct the errors and re-launch the simulaon again.
Aer the design successfully re-compiles, the simulaon starts again.
IMPORTANT! Relaunching may fail for reasons other than compilaon errors, such as in the case of a le
system error. If the Run buons on the Simulaon toolbar are grayed out aer a re-launch, indicang that
the simulaon is disabled, check the contents of the Tcl Console for possible errors that have prevented the
re-launch from succeeding.
CAUTION! You may also re-launch the simulaon using Run Simulaon in the Flow Navigator or using
launch_simulation
Tcl command. However, using these opons may fully close the simulaon,
discarding waveform changes and simulaon sengs such as radix customizaon.
Note: The Relaunch Simulaon buon will be acve only aer one successful run of Vivado simulator
using launch_simulation. The Relaunch Simulaon buon would be grayed out if the simulaon is run
in a Batch/Scripted mode.
Using the Saved Simulator User Interface
Settings
By default, the Vivado simulator saves your conguraon changes to a le under the simulaon's
working directory as you work with the user interface controls and Tcl commands of the Vivado
simulator. The sengs that are saved include the following:
The state of the lter buons and column widths of the Scopes and Objects windows.
Tcl properes of the simulaon, including array display limit, default radix, default me unit for
the run command, and trace limit.
Radixes and the Show as Enumeraon state that you set on HDL objects in the Objects
window.
Aer you shut down the simulaon, the Vivado simulator restores your sengs when you
reopen and run the Vivado simulator.
IMPORTANT!
Turn o the Clean Up Simulaon Files check box in Vivado's Simulaon Sengs to ensure
that the sengs le does not get erased when you relaunch the simulaon.
TIP: To revert the sengs to their defaults, delete the sengs le. You can nd the sengs le under the
Vivado project directory at
<project>.sim/<simset>/<simtype>/xsim.dir/<snapshot>/
xsimSettings.ini
. For example, the sengs le for the default behavioral simulaon run of the BFT
example design would reside at
bft.sim/sim_1/behav/xsim.dir/bft_tb_behav/
xsimSettings.ini
. Alternavely, turn on the Clean Up Simulaon Files check box in the Simulaon
Sengs.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 74
Default Settings
A Vivado
®
project Tcl object supports a few properes that allows you to supply default sengs
for cleaned up or newly created simulaons. These simulaons do not already have a sengs
le. The following list shows the default sengs properes of the project:
XSIM.ARRAY_DISPLAY_LIMIT
XSIM.RADIX
XSIM.TIME_UNIT
XSIM.TRACE_LIMIT
You can view the current values of the properes with the report_property
[current_project] Tcl command and set the values of the properes with the
set_property <property name> <property value> [current_project] Tcl
command. For example, to set the array display limit to 16, use the following command.
set_property xsim.array_display_limit 16 [current_project]
When you launch the new or cleaned-up simulaon, the simulaon Tcl object inherits your
project properes. You can verify it with the following Tcl command:
report_property [current_sim]
IMPORTANT!
The project properes apply only to cleaned-up or newly created simulaons. Aer you
have run a simulaon of a parcular run type and sim set such as
sim_1/behav
, that simulaon retains
a separate copy of the sengs for all subsequent launches. The changes to the project properes can no
longer take eect for that simulaon. The project properes take eect again only if the simulaon is
cleaned up or the sengs le is deleted.
Chapter 4: Simulating with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 75
Chapter 5
Analyzing Simulation Waveforms
with Vivado Simulator
In the Vivado
®
simulator, you can use the waveform to analyze your design and debug your code.
The simulator populates design signal data in other areas of the workspace, such as the Objects
and the Scope windows.
Typically, simulaon is set up in a test bench where you dene the HDL objects you want to
simulate. For more informaon about test benches see Wring Ecient Test Benches (XAPP199).
When you launch the Vivado simulator, a wave conguraon displays with top-level HDL
objects. The Vivado simulator populates design data in other areas of the workspace, such as the
Scope and Objects windows. You can then add addional HDL objects, or run the simulaon. See
Using Wave Conguraons and Windows below.
Using Wave Configurations and Windows
Vivado simulator allows customizaon of the wave display. The current state of the display is
called the wave conguraon. This conguraon can be saved for future use in a WCFG le.
A wave conguraon can have a name or be untitled. The name shows on the tle bar of the
wave conguraon window. A wave conguraon is untled when it has never been saved to a
le.
Creating a New Wave Configuration
Create a new waveform conguraon for displaying waveforms as follows:
1. Select File → Simulaon Waveform → New Conguraon.
A new Wave window opens and displays a new, untled waveform conguraon. Tcl
command: create_wave_config <waveform_name>.
2. Add HDL objects to the waveform conguraon using the steps listed in Understanding HDL
Objects in Waveform Conguraons .
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 76
See Chapter 4: Simulang with Vivado Simulator for more informaon about creang new
waveform conguraons. Also see Creang and Using Mulple Waveform Conguraons for
informaon on mulple waveforms.
Opening a WCFG File
Open a WCFG le to use with the simulaon as follows:
1. Select File > Simulaon Waveform > Open Conguraon .
The Open Waveform Conguraon dialog box opens.
2. Locate and select a WCFG le.
Note: When you open a WCFG le that contains references to HDL objects that are not present in a
stac simulaon HDL design hierarchy, the Vivado simulator ignores those HDL objects and omits
them from the loaded waveform conguraon.
A Wave window opens, displaying waveform data that the simulator nds for the listed wave
objects of the WCFG le.
Tcl command: open_wave_config <waveform_name>
Saving a Wave Configuration
Aer eding, to save a wave conguraon to a WCFG le, select File → Simulaon Waveform → 
Save Conguraon As, and type a name for the waveform conguraon.
Tcl command: save_wave_config <waveform_name>
Opening a Previously Saved Simulation Run
There are three methods for opening a previously saved simulaon using the Vivado Design
Suite: an interacve method and a programmac method.
Standalone mode
You can open WDB le outside Vivado using the following command:
xsim <name>.wdb -gui
TIP:
You can open a WCFG le together with the WDB le by adding
-view <WCFG file>
to the
xsim
command.
Interacve Method
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 77
If a Vivado Design Suite project is loaded, click Flow → Open Stac Simulaon and select the
WDB le containing the waveform from the previously run simulaon.
TIP: A stac simulaon is a mode of the Vivado simulator in which the simulator displays data from a
WDB le in its windows in place of data from a running simulaon.
Alternavely, in the Tcl Console, run: open_wave_database <name>.wdb.
Programmac Method
Create a Tcl le (for example, design.tcl) with contents:
current_fileset
open_wave_database <name>.wdb
Then run it as:
vivado -source design.tcl
IMPORTANT! Vivado simulator can open WDB les created on any supported operang system. It can
also open WDB les created in Vivado Design Suite versions 2014.3 and later. Vivado simulator cannot
open WDB les created in versions earlier than 2014.3 of the Vivado Design Suite.
When you run a
simulaon and display HDL objects in a Wave window, the running simulaon
produces a waveform database (WDB) le containing the waveform acvity of the displayed
HDL objects. The WDB le also stores informaon about all the HDL scopes and objects in the
simulated design. In this mode you cannot use commands that control or monitor a simulaon,
such as run commands, as there is no underlying 'live' simulaon model to control.
However, you can view waveforms and the HDL design hierarchy in a stac simulaon.
Understanding HDL Objects in Waveform
Configurations
When you add an HDL object to a waveform conguraon, the waveform viewer creates a wave
object of the HDL object. The wave object is linked to, but disnct from, the associated HDL
object.
You can create mulple wave objects from the same HDL object, and set the display properes
of each wave object separately.
For example, you can set one wave object for an HDL object named myBus to display values in
hexadecimal and another wave object for myBus to display values in decimal.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 78
There are other kinds of wave objects available for display in a waveform conguraon, such as:
dividers, groups, and virtual buses.
Wave objects created from HDL objects are specically called design wave objects. These objects
display with a corresponding icon. For design wave objects, the icon indicates whether the object
is a scalar
or a compound such as a Verilog vector or VHDL record.
TIP: To view the HDL object for a design wave object in the Objects window, right-click the name of the
design wave object and choose Show in Object Window.
The following gure shows an example of HDL objects in the waveform conguraon window.
The design objects display Name and Value.
Name: By default, shows the short name of the HDL object: the name alone, without the
hierarchical path of the object. You can change the Name to display a long name with full
hierarchical path or assign it a custom name.
Value: Displays the value of the object at the me indicated in the main cursor of the wave
window. You can change the formang, or radix, of the value independent of the formang
of other design wave objects linked to the same HDL object and independent of the
formang of values displayed in the Objects window and source code window.
Figure 23: Waveform HDL Objects
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 79
The Scope window provides the ability to add all viewable HDL objects for a selected scope to
the wave window. For informaon on using the Scope window, see Scope Window.
About Radixes
Understanding the type of data on your bus is important, and to use the digital and analog
waveform opons eecvely, you need to recognize the relaonship between the radix seng
and the data type.
IMPORTANT! Make a change to the radix seng in the window in which you wish to see the change. A
change to the radix of an item in the Objects window does not apply to values in the Wave window or the
Tcl Console. For example, the item wbOutputData[31:0] can be set to Signed Decimal in the objects
window, but it remains set to Binary in the Wave window.
Changing the Default Radix
The default waveform radix controls the numerical format of values for all wave objects whose
radix you did not explicitly set. The waveform radix defaults to Hexadecimal.
To change the default waveform radix:
1. In the Waveform window, click the Sengs buon
to open the Waveform Sengs.
2. On the General page, click the Default Radix drop-down menu.
3. From the drop-down list, select a radix.
Changing the Radix on Individual Objects
To change the radix of a wave object in the Wave window:
1. Right-click the wave object name.
2. Select Radix and the format you want from the drop-down menu:
Default
Binary
Hexadecimal
Octal
ASCII
Unsigned Decimal
Signed Decimal
Signed Magnitude
Real
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 80
Note: For a descripon of the usage for Real and Real Sengs see Using Analog Waveforms
3. From the Tcl Console, to change the numerical format of the displayed values, type the
following Tcl command:
set_property radix <radix> <hdl_object>
Where <radix> is one the following: bin, unsigned, hex, dec, ascii, or oct and where
<wave_object> is an object returned by the add_wave command.
TIP: If you change the radix in the Wave window, it will not be reected in the Objects window.
Customizing the Waveform
Using Analog Waveforms
Using Radixes and Analog Waveforms
Bus values are interpreted as numeric values, which are determined by the radix seng on the
bus wave object, as follows:
Binary, octal, hexadecimal, ASCII, and unsigned decimal radixes cause the bus values to be
interpreted as unsigned integers.
If any bit in the bus is neither 0 nor 1, the enre bus value is interpreted as 0.
The signed decimal and signed magnitude radixes cause the bus values to be interpreted as
signed integers.
Real radixes cause bus values to be interpreted as xed point or oang point real numbers,
based on sengs of the Real Sengs dialog box.
To set a wave object to the Real radix:
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 81
1. In the waveform conguraon window, select an HDL object, and right-click to open the
popup menu.
2. Select Radix → Real Sengs to open the Real Sengs dialog box, shown in the following
gure.
You can set the radix of a wave to Real to display the values of the object as real numbers. Before
selecng this radix, you must choose sengs to instruct the waveform viewer how to interpret
the bits of the values.
The Real Seng dialog box opons are:
Fixed Point: Species that the bits of the selected bus wave object(s) is interpreted as a xed
point, signed, or unsigned real number.
Binary Point: Species how many bits to interpret as being to the right of the binary point. If
Binary Point is larger than the bit width of the wave object, wave object values cannot be
interpreted as xed point, and when the wave object is shown in Digital waveform style, all
values show as <Bad Radix>. When shown as analog, all values are interpreted as 0.
Floang Point: Species that the bits of the selected bus wave object(s) should be interpreted
as an IEEE oang point real number.
Note: Only single precision and double precision (and custom precision with values set to those of single
and double precision) are supported.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 82
Other values result in <Bad Radix> values as in Fixed Point. Exponent Width and Fracon
Width must add up to the bit width of the wave object, or else <Bad Radix> values result.
TIP: If the row indices separator lines are not visible, you can turn them on in the Using the Waveform
Sengs Dialog Box, to make them visible.
Displaying Waveforms as Analog
IMPORTANT! When viewing an HDL bus object as an analog waveform—to produce the expected
waveform, select a radix that matches the nature of the data in the HDL object. For example:
If the data encoded on the bus is a 2's-compliment signed integer, you must choose a signed
radix.
If the data is oang point encoded in IEEE format, you must choose a real radix.
Customizing the Appearance of Analog Waveforms
To customize the appearance of an analog waveform, right-click an HDL object in the Name
column of the waveform conguraon window and select Waveform Style from the drop-down
menu. A popup menu appears, showing the following opons:
Analog: Sets the waveform to Analog.
Digital: Sets the waveform object to Digital.
Analog Sengs: Opens the Analog Sengs dialog box (shown in the following gure), which
provides opons for the analog waveform display.
The Wave window can display analog waveforms only for buses that are 64 bits wide or smaller.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 83
Figure 24: Analog Settings Dialog Box
Analog Settings Dialog Box Option Descriptions
Row Height: Species how tall to make the select wave object(s), in pixels. Changing the row
height does not change how much of a waveform is exposed or hidden vercally, but rather
stretches or contracts the height of the waveform.
When switching between Analog and Digital waveform styles, the row height is set to an
appropriate default for the style (20 for digital, 100 for analog).
TIP: If the row indices separator lines are not visible, enable the checkbox in the Waveform Sengs to
turn them on. Using the Waveform Sengs Dialog Box for informaon on how to change the opons
sengs. You can also change the row height by dragging the row index separator line to the le and
below the waveform name.
Y Range: Species the range of numeric values to be shown in the waveform area.
Auto: Species that the range should connually expand whenever values in the visible
me range of the window are discovered to lie outside the current range.
Fixed: Species that the me range is to remain at a constant interval.
Min: Species the value displays at the boom of the waveform area.
Max: Species the value displays at the top.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 84
Both values can be specied as oang point; however, if the wave object radix is integer, the
values are truncated to integers.
Interpolaon Style: Species how the line connecng data points is to be drawn.
Linear: Species a straight line between two data points.
Hold: Species that of two data points, a horizontal line is drawn from the le point to the
X-coordinate of the right point, then another line is drawn connecng that line to the right
data point, in an L shape.
O Scale: Species how to draw waveform values that lie outside the Y range of the
waveform area.
Hide: Species that outlying values are not shown, such that a waveform that reaches the
upper or lower bound of the waveform area disappears unl values are again within the
range.
Clip: Species that outlying values be altered so that they are at the top or boom of the
waveform area, so a waveform that reaches the upper- or lower-bound of the waveform
area follows the bound as a horizontal line unl values are once again within the range.
Overlap: Species that the waveform be drawn wherever its values are, even if they lie
outside the bounds of the waveform area and overlap other waveforms, up to the limits of
the Wave window itself.
Horizontal Line: Species whether to draw a horizontal rule at the given value. If the check-
box is on, a horizontal grid line is drawn at the vercal posion of the specied Y value, if that
value is within the Y range of the waveform.
As with Min and Max, the Y value accepts a oang point number but truncates it to an
integer if the radix of the selected wave objects is an integer.
Waveform Object Naming Styles
There are opons for renaming objects, viewing object names, and changing name displays.
Renaming Objects
You can rename any wave object in the waveform conguraon, such as design wave objects,
dividers, groups, and virtual buses.
1. Select the object name in the Name column.
2. Right-click and select Rename from the popup menu.
The Rename dialog box opens.
3. Type the new name in the Rename dialog box, and click OK.
Note: Changing the name of a design wave object in the wave conguraon does not aect the name
of the underlying HDL object.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 85
Changing the Object Display Name
You can display the full hierarchical name (long name), the simple signal or bus name (short
name), or a custom name for each design wave object. The object name displays in the Name
column of the wave conguraon. If the name is hidden:
1. Expand the Name column unl you see the enre name.
2. In the Name column, use the scroll bar to view the name.
To change the display name:
1. Select one or more signal or bus names. Use Shi+click or Ctrl+click to select many signal
names.
2. Right-click and select Name from the drop-down menu. A popup menu appears, showing the
following opons:
Long to display the full hierarchical name of the design object.
Short to display the name of the signal or bus only.
Custom to display the custom name given to the object when renamed. See Changing the
Object Display Name.
TIP: Renaming a wave object changes the name display mode to Custom. To restore the original name
display mode, change the display mode to Long or Short, as described above. Long and Short names
are meaningful only to design wave objects. Other wave objects (dividers, groups, and virtual buses)
display their Custom names by default and display an ID string for their Long and Short names.
Reversing the Bus Bit Order
You can reverse the bus bit order in the wave conguraon to switch between MSB-rst (big
endian) and LSB-rst (lile endian) bit order for the display of bus values.
To reverse the bit order:
1. Select a bus.
2. Right-click and select Reverse Bit Order.
The bus bit order reverses. The Reverse Bit Order command is marked to show that this is the
current behavior.
IMPORTANT!
The Reverse Bit Order command operates only on the values displayed on the bus. The
command does not reverse the list of bus elements that appears below the bus when you expand the
bus wave object.
TIP: The index ranges displayed on Long and Short names of buses indicate the bit order in bus
elements. For example, aer applying Reverse Bit Order on a bus
bus[0:7]
, the bus displays
bus[7:0]
.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 86
Changing the Format of SystemVerilog
Enumerations
A SystemVerilog enumeraon is an HDL object with numerical values for which text labels are
dened to represent specic values. For example, an enumeraon might dene LABEL1 to
represent the value 1 and LABEL2 to represent the value 5. The Show As Enumeraon opon on
the context menu lets you specify whether to show enumeraon values using their given labels
or numerically. In the previous example, if Show As Enumeraon is on, a value of 5 appears as
LABEL2. If the opon is o, the value 5 appears as in whatever radix is set for the enumeraon,
as shown in the Radix menu.
To display enumeraons using labels:
1. Select an enumeraon
2. Right-click and check Display As Enumeraon
To display enumeraons numerically:
1. Select an enumeraon
2. Right-click and uncheck Display As Enumeraon
Note: Enumeraon values for which there is no dened label always display numerically, regardless of
the Display As Enumeraon seng. The Display As Enumeraon opon is enabled only for
SystemVerilog enumeraon objects.
Controlling the Waveform Display
You can control the waveform display using:
Resizing handles between the Name, Value, and waveform columns of the wave window
Scroll combinaons with the mouse wheel
Zoom feature buons in the Wave window sidebar
Zoom combinaons with the mouse wheel
Vivado IDE Y-Axis zoom gestures
Vivado simulaon X-Axis zoom gestures. See the Vivado Design Suite User Guide: Using the
Vivado IDE (UG893) for more informaon about using the mouse to pan and zoom.
Note: In contrast to other Vivado Design Suite graphic windows, zooming in a Wave window applies to
the X (me) axis independent of the Y axis. As a result, the Zoom Range X gesture, which species a
range of me to which to zoom the window, replaces the Zoom to Area gesture of other Vivado Design
Suite windows.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 87
TIP: Saving a WCFG le records wave window sengs in addion to wave objects and markers. Wave
window sengs include the Name and Value column widths, zoom level, scroll posion, expansion state
of groups and buses, and the posion of the main cursor.
Using the Column Resizing Handles
To change the width of the Name or Value column, posion the mouse over the vercal bar to
the right of the column unl the mouse cursor changes shape, then drag the mouse le or right
to narrow or widen the column as desired.
Note: You may need to widen the Value column rst to widen the Name column, if the Value column's
width is already at its minimum.
Scrolling with the Mouse Wheel
Click within the wave window to scroll up and down with the mouse wheel. You can also scroll
the waveform le and right with the mouse wheel in combinaon with the Shi key.
Using the Zoom Feature Buttons
There are zoom funcons such as Zoom in, Zoom Out, and Zoom Fit as menu buons in the
Wave window that let you zoom in and out of a wave conguraon as needed.
Zooming with the Mouse Wheel
Click within the waveform area and use the mouse wheel in combinaon with the Ctrl key to
zoom in and out, emulang the operaon of the dials on an oscilloscope.
Y-Axis Zoom Gestures for Analog Waveforms
In addion to the zoom gestures supported for zooming in the X dimension, when over an analog
waveform, addional zoom gestures are available, as shown in the following gure.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 88
Figure 25: Analog Zoom Options
Zoom
Out
Y
Zoom Y
Range
Zoom
In
X
Zoom
X
Range
Zoom
Fit
X
Reset
Zoom
Y
Zoom
Out
X
Zoom
In
Y
To invoke a zoom gesture, hold down the le mouse buon and drag in the direcon indicated in
the diagram, where the starng mouse posion is the center of the diagram.
The addional zoom gestures are:
Zoom Out Y: Zooms out in the Y dimension by a power of 2 determined by how far away the
mouse buon is released from the starng point. The zoom is performed such that the Y value
of the starng mouse posion remains staonary.
Zoom Y Range: Draws a vercal curtain which species the Y range to display when the
mouse is released.
Zoom In Y: Zooms in toward the Y dimension by a power of 2 determined by how far away
the mouse buon is released from the starng point. The zoom is performed such that the Y
value of the starng mouse posion remains staonary.
Reset Zoom Y: Resets the Y range to that of the values currently displayed in the Wave
window and sets the Y Range mode to Auto.
All zoom gestures in the Y dimension set the Y Range analog sengs. Reset Zoom Y sets the Y
Range to Auto, whereas the other gestures set Y Range to Fixed.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 89
Using the Waveform Settings Dialog Box
Click the Sengs buon to open the Waveform Sengs as shown in the following gure.
Figure 26: Waveform Settings
From the General tab, you can congure the following Waveform Sengs:
Radix: Sets the numerical format to use for newly-created design wave objects.
Elide Seng: Controls truncaon of signal names that are too long for the Wave window.
Le truncates the le end of long names.
Right truncates the right end of long names.
Middle preserves both the le and right ends, oming the middle part of long names.
Draw Waveform Shadow: Creates a shaded representaon of the waveform.
Show signal indices: Displays the row numbers to the le of each wave object name. You can
drag the lines separang the row numbers to change the height of a wave object.
Show grid lines: Displays the wave window with grid lines.
Snap to Transion: When selected, causes dragged cursors and markers to gravitate to
waveform transions near the mouse cursor. See Using Cursors for more informaon.
Floang Ruler: Displays the oang ruler whenever the secondary cursor is visible or a marker
is selected. See Using the Floang Ruler for more informaon.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 90
TIP: If Floang Ruler opon appears disabled (unchecked) in the Sengs dialog box, use Shi+Click on
the Wave window to make the secondary cursor visible. This acon results in enabling the Floang
Ruler opon in the Sengs dialog box.
From the Colors tab, you can set colors of items within the waveform.
Changing the Display of the Time Scale
Right-click above the ruler to display the me scale menu. This menu lets you select how you
want to display me values on the me scale.
The following are the opons on the mescale menu:
Auto: The mescale choses me units suitable for the wave window's zoom level.
Default: Displays the me units corresponding to the precision of the simulaon that was
determined when the HDL design was compiled.
Samples: Displays the me in discrete sample numbers instead of fracons of a second (not
available for HDL simulaon).
User: User-dened me units (not available for HDL simulaon).
fs: Displays me units in femtoseconds.
ps: Displays me units in picoseconds.
ns: Displays me units in nanoseconds.
us: Displays me units in microseconds.
ms: Displays me units in milliseconds.
s: Displays me units in seconds
Organizing Waveforms
The following subsecons describe the opons that let you organize informaon within a
waveform.
Grouping Signals and Objects
A Group is an expandable and collapsible container for organizing related sets of wave objects.
The Group itself displays no waveform data but can be expanded to show its contents or
collapsed to hide them. You can add, change, and remove groups.
To add a Group:
1. In a Wave window, select one or more wave objects to add to a group.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 91
Note: A group can include dividers, virtual buses, and other groups.
2. Right-click and select New Group from the context menu.
This adds a Group that contains the selected wave object to the wave conguraon.
In the Tcl Console, type add_wave_group to add a new group.
A Group is represented with the Group buon . You can move other HDL objects to the group
by dragging and dropping the signal or bus name.
The new Group and its nested wave objects saves when you save the waveform conguraon
le.
You can move or remove Groups as follows:
Move Groups to another locaon in the Name column by dragging and dropping the group
name.
Remove a Group by highlighng it, right-click and select Ungroup from the popup menu.
Wave objects formerly in the Group are placed at the top-level hierarchy in the wave
conguraon.
Groups can be renamed also; see Changing the Object Display Name.
CAUTION!
The Delete key removes a selected group and its nested wave objects from the wave
conguraon.
Using Dividers
Dividers create a visual separator between HDL objects to make certain signals or objects easier
to see. You can add a divider to your wave conguraon to create a visual separator of HDL
objects, as follows:
1. In a Name column of the Wave window, click a signal to add a divider below that signal.
2. Right-click and select New Divider.
The new divider is saved with the wave conguraon le when you save the le.
Tcl command: add_wave_divider
You can move or delete Dividers as follows:
To move a Divider to another locaon in the waveform, drag and drop the divider name.
To delete a Divider, highlight the divider, and click the Delete key, or right-click and select
Delete from the context menu.
Dividers can be renamed also; see Changing the Object Display Name.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 92
Defining Virtual Buses
You dene a virtual bus to the wave conguraon, which is a grouping to which you can add
logic scalars and vectors.
The virtual bus displays a bus waveform, whose values are composed by taking the
corresponding values from the added scalars and arrays in the vercal order that they appear
under the virtual bus and aening the values to a one-dimensional vector.
To add a virtual bus:
1. In a wave conguraon, select one or more wave objects to add to a virtual bus.
2. Right-click and select New Virtual Bus from the popup menu.
The virtual bus is represented with the Virtual Bus buon
.
Tcl Command: add_wave_virtual_bus
You can move other logical scalars and arrays to the virtual bus by dragging and dropping the
signal or bus name.
The new virtual bus and its nested items save when you save the wave conguraon le. You can
also move it to another locaon in the waveform by dragging and dropping the virtual bus name.
You can rename a virtual bus; see Changing the Object Display Name.
To remove a virtual bus, and ungroup its contents, highlight the virtual bus, right-click, and select
Ungroup from the popup menu.
CAUTION!
The Delete key removes the virtual bus and nested HDL objects within the bus from the wave
conguraon.
Analyzing Waveforms
The following subsecons describe available features that help you analyze the data within the
waveform.
Using Cursors
Cursors are temporary me markers that can be moved frequently for measuring the me
between two waveform edges.
Placing Main and Secondary Cursors
You can place the main cursor with a single le-click in the Wave window.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 93
To place a secondary cursor, Ctrl+Click, hold the waveform, and drag either le or right. You can
see a ag that labels the locaon at the top of the cursor. Alternavely, you can hold the Shi
key and click a point in the waveform.
If the secondary cursor is not already on, this acon sets the secondary cursor to the present
locaon of the main cursor and places the main cursor at the locaon of the mouse click.
Note: To preserve the locaon of the secondary cursor while posioning the main cursor, hold the Shi key
while clicking. When placing the secondary cursor by dragging, you must drag a minimum distance before
the secondary cursor appears.
Moving Cursors
To move a cursor, hover over the cursor unl you see the grab symbol, and click and drag the
cursor to the new locaon.
As you drag the cursor in the Wave window, you see a hollow or lled-in circle if the Snap to
Transion waveform seng is selected, which is the default behavior.
A hollow circle
under the mouse indicates that you are between transions in the waveform
of the selected signal.
A lled-in circle under the mouse indicates that the cursor is locked in on a transion of
the waveform under the mouse or on a marker.
A secondary cursor can be hidden by clicking anywhere in the Wave window where there is no
cursor, marker, or oang ruler.
Finding the Next or Previous Transition on a Waveform
The Waveform window contains buons for jumping the main cursor to the next or previous
transion of selected waveform or from the current posion of the cursor.
To move the main cursor to the next or previous transion of a waveform:
1. Ensure the wave object in the waveform is acve by clicking the name.
This selects the wave object, and the waveform display of the object displays with a thicker
line than usual.
2.
Click the Next Transion or Previous Transion
buons in the waveform toolbar (?),
or use the right or le keyboard arrow key to move to the next or previous transion,
respecvely.
TIP:
You can jump to the nearest transion of a set of waveforms by selecng mulple wave objects
together.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 94
Using Markers
Use a marker when you want to mark a signicant event within your waveform in a permanent
fashion. Markers let you measure mes relevant to that marked event.
You can add, move, and delete markers as follows:
You add markers to the wave conguraon at the locaon of the main cursor.
1. Place the main cursor at the me where you want to add the marker by clicking in the
Wave window at the me or on the transion.
2. Right-click Markers → Add Marker .
A marker is placed at the cursor, or slightly oset if a marker already exists at the locaon
of the cursor. The me of the marker displays at the top of the line.
To create a new wave marker, use the Tcl command:
add_wave_marker <time> <timeunit> -name <name of the marker> -into
<wcfg file>
You can move the marker to another locaon in the Wave window using the drag and drop
method. Click the marker label (at the top of the marker or marker line) and drag it to the
locaon.
As you drag the marker in the Wave window, you see a hollow or lled-in circle if the Snap
to Transion opon is selected in Waveform Sengs window, which is the default
behavior.
A lled-in circle indicates that you are hovering over a transion of the waveform for
the selected signal or over another marker.
For markers, the lled-in circle is white.
A hollow circle
indicates that the marker is locked in on a transion of the waveform
under the mouse or on another marker.
Release the mouse key to drop the marker to the new locaon.
You can delete one or all markers with one command. Right-click over a marker, and do one of
the following:
Select Delete Marker from the popup menu to delete a single marker.
Select Delete All Markers from the popup menu to delete all markers.
You can also use the Delete key to delete a selected marker.
See the Vivado Design Suite help or the Vivado Design Suite Tcl Command Reference Guide
(UG835) for command usage.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 95
Using the Floating Ruler
The oang ruler assists with me measurements using a me base other than the absolute
simulaon me shown on the standard ruler at the top of the Wave window.
You can display (or hide) the oang ruler and drag it to change the vercal posion in the Wave
window. The me base (me 0) of the oang ruler is the secondary cursor, or, if there is no
secondary cursor, the selected marker.
The oang ruler is visible only when the secondary cursor or a marker is present.
1. Do either of the following to display or hide a oang ruler:
Place the secondary cursor.
Select a marker.
2. In the Waveform Sengs window, enable (check) the Floang Ruler opon.
You only need to follow this procedure the rst me. The oang ruler displays each me
you place the secondary cursor or select a marker.
Uncheck/disable the Floang Ruler opon to hide the oang ruler.
Searching a Value in Waveform Configuration
The Find Toolbar allows you to search one or more waveforms for a specied value. You can
search for either an exact value, such as 23FF, or a paern that matches a set of values, such as
"any value whose rst two digits are 23 and whose fourth digit is F."
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 96
Figure 27: Find Value Option and Find Toolbar
IMPORTANT! This search feature supports only scalar and vector (1-D) wave objects of a “logic” type.
Logic types include 2-state and 4-state types of Verilog/SystemVerilog and bit and std_logic of VHDL.
To perform the search:
1. In the Name column, select one or more design wave objects (wave objects that have
waveforms).
2. Right-click one of the selected wave objects in either the Name column or Value column and
choose the Find Value opon to acvate the Find Toolbar.
3. On the Find Toolbar, choose a radix for your search value from the Radix drop down list. The
search feature supports the following radixes:
Binary
Hexadecimal
Octal
Unsigned Decimal
Signed Decimal
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 97
4. In the blank text box on the Find Toolbar, enter a value paern consisng of a string of digits
valid for the radix you chose. Valid digits include numeric digits, VHDL MVL 9 literals (U, X, 0,
1, Z, W, L, H, -), and Verilog literals (0, 1, x, z).
Note: If you enter an invalid digit, the text box turns red, and an error message appears at the right side
of the toolbar. The set of valid numeric digits depends on the radix. For example, if you chose the
Octal radix, numeric digits are those between 0 and 7. Numeric digits for hexadecimal include 0
through 9 and A through F (or a through f). You may enter the special digit '.' to specify a match with
any digit value. For example, the Octal value paern “12.4” matches occurrences of 1234, 1204, and
12X4 encountered in the waveform.
5. Choose a match style from the following opons in the Match drop down list:
Exact: Waveform values must contain the same number of digits as in the value paern to
be considered a match. For example, a value paern of "1234" matches occurrences of
1234 encountered in the waveform but not 123 or 12345.
TIP: With the Exact match style you may omit leading zeros from the value paern. For example,
to nd the value 0023 in the waveform, you may specify a value paern of “0023” or simply “23.
Beginning: Any waveform value whose beginning digits match the value paern is
considered a match. For example, a value paern of “1234” matches occurrences of 1234
and 12345 encountered in the waveform but not 1235 or 123. This opon is available
only for radixes binary, octal, and hexadecimal.
End: Any waveform value whose ending digits match the value paern is considered a
match. For example, a value paern of “1234” matches occurrences of 1234 and 91234
encountered in the waveform but not 1235 or 234. This opon is available only for radixes
binary, octal, and hexadecimal.
Click the Next buon or press the Enter key to move the main cursor forward to the
nearest match, or click the Previous buon to move the main cursor backward to the
nearest match. With mulple wave objects selected, the cursor stops on the nearest
match of any of the selected wave objects.
TIP: If there are no matches in the requested direcon, the cursor remains staonary and a “Value
not found” message appears on the right side of the toolbar.
Analyzing AXI Interface Transactions
If you compose your design as a block design using the Vivado IP integrator, when you launch
the Vivado simulator, Vivado automacally imports the AMBA
®
AXI interfaces from your design
into the Vivado simulator as protocol instances to be viewed in the wave window. Once added to
the wave window, a protocol instance of an AXI interface shows you the data transacons
occurring on that interface during simulaon.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 98
Understanding Protocol Instances
An AXI interface consists of a standard set of logic signals as dened by Arm
®
in the AMBA
®
AXI
and ACE Protocol Specicaon and AMBA
®
4 AXI4-Stream Protocol Specicaon. These signals
convey the data transacons encoded as logic events as described by the specicaon. The
Vivado simulator makes those signals available for viewing directly in the wave viewer, however,
it can be dicult to visualize what transacons are happening from the signals alone.
To make it easier to view the transacons, the Vivado simulator provides a feature that analyzes
the signal acvity and produces new signals that summarize the acvity at the transacon level.
This process is called as protocol analysis. For each AXI interface the Vivado simulator creates a
new design object called a protocol instance that represents the AXI interface and the inputs and
outputs of protocol analysis. The protocol instance typically resides in the same scope as its input
signals.
Using the IP Integrator to Mark an AXI Interface to View in the
Vivado Simulator
The Vivado IP integrator provides a feature for idenfying AXI interfaces to display in the Vivado
simulator's wave viewer directly from the block design window. Perform the following steps to
mark an AXI interface for viewing in the Vivado simulator:
1. Locate the AXI interface you want to view.
2. Right-click the corresponding net connecon (orange line as shown in the following gure).
3. Click Mark Simulaon.
Note: Mark Simulaon opon can only be applied on an AXI interface.
4. Repeat steps 1-3 to mark addional interfaces.
5. Click Clear Simulaon opon to clear a marked AXI interface.
Note: Clear Simulaon opon is available only when an AXI interface is marked.
6. Launch the Vivado simulator. Save the block design if prompted.
When the Vivado simulator starts, the interfaces you marked appear in the Wave window. If
the Vivado project is customized to open a wave conguraon automacally, the marked
interfaces are added to the wave conguraon if not already present. If the Vivado project is
not customized to open a wave conguraon, the Vivado simulator creates a default wave
conguraon containing the marked interfaces in lieu of the usual top-level HDL signal list.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 99
CAUTION! Some AXI interfaces which are internal to an AXI interconnect may not display correctly in
the wave viewer depending on the conguraon of the interconnect. It is recommended that you mark
interfaces only on the boundary of an interconnect.
Finding Protocol Instances in the Vivado Simulator
When the Vivado simulator launches, it scans the design and its input les to locate protocol
instances. The results of the scan appear in the Tcl console near the top of the simulator output
as shown in the following gure. You can copy a protocol instance path from the Tcl console and
paste it into a Tcl command.
Figure 28: Protocol Instances Identified in the Tcl Console
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 100
Finding Protocol Instances in the Objects Window
Protocol instance objects appear in the Objects window in the scope containing the
corresponding AXI interface signals. Perform the following steps to nd a protocol instance using
the Scope window:
1. In the Scope window, select the scope containing AXI interface signals.
Note: The scope hierarchy roughly matches with your block design.
2. Locate the protocol instance for an AXI interface of a block in your block design. Select the
scope name that matches with the instance name of your block.
Perform the following steps to nd a protocol instance using the Objects window:
1. In the Objects window scroll to the boom of the list.
2. Locate the protocol instance name that matches with the port name of the AXI interface in
your block design. AXI port names usually end with _AXI and are frequently M_AXI or
S_AXI.
TIP: Protocol instances have a port mode of Internal Signal. To facilitate searching for protocol
instances in the Objects window, you can hide all objects except the Internal Signal object. Click the
gear icon, deselect the Select All check box and select the Internal Signal check box. To restore the
Objects window select the Select All check box.
Finding Protocol Instances Using a Tcl Command
Protocol instance objects have a Tcl type eld of proto_inst. You can use the get_objects
Tcl command to locate protocol instances in or under a specic scope.
Use the Following Command to Locate All Protocol Instances in the Design:
get_objects /* -r -filter {type==proto_inst}
Use the Following Command to Locate All Protocol Instances in a Scope:
get_objects <Design scope hierarchy>/* -filter {type==proto_inst}
Use the Following Command to Locate All Protocol Instances in or under a Scope:
get_objects /system_tb/base_mb_wrapper/base_mb_i/* -r -filter
{type==proto_inst}
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 101
Protocol Instance in the Objects Window
In the Objects window, a protocol instance appears as an aggregate design object that has the
same name as the port name of the AXI interface seen in the block design. Click the arrow
expand buon to view the inputs and outputs of protocol analysis for the protocol instance as
shown in the following gure for a protocol instance named M_AXI_DP.
Figure 29: Protocol Instance in the Objects Window
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 102
Note: To opmize computer resources, the protocol instance does not display its child objects unl the
protocol instance is added to the wave window for the rst me.
Protocol Instances Window:
The protocol instances window contains the complete protocol instance list present in a given
design. It has an absolute path to the protocol instance to ensure that an instance with same
name can be dierenated based on the path.
Figure 30: Protocol Instances Window
Protocol Instance Inputs:
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 103
The protocol instance input signals shown with an orange icon are the aliases of the AXI
signals from the HDL design. Hover over an input to see a tool p giving full path of the alias
as well as the full path of the actual (aliased) signal. From a protocol instance input you can
also jump the Scope and Objects window to the actual signal. Perform the following steps to
go to the actual signal of a protocol instance input:
1. To view all signal types in the Objects window, click the gear icon and select the Check All
check box.
2. Right click the protocol instance input.
3. Select Go To Actual.
TIP: If you would like to save the protocol instance input signals in a wave conguraon (WCFG) le, add
the actual signals of the input signals instead. Because, the protocol instance inputs and outputs are
created only aer a WCFG le is loaded, your saved inputs will be missing from the wave conguraon.
The protocol instance outputs cannot be saved in a WCFG le.
Protocol Instance Outputs:
The protocol instance outputs are shown with a green O icon. These are special signals of the
protocol instance that have no counterparts in the HDL design. The output signals produce
events meaningful only to the wave viewer for displaying transacons.
CAUTION!
The set of protocol instance output signals and their contents are subject to change from one
Vivado release to the next. It is recommended not to depend on the specic behavior of protocol instance
output signals when scripng using Tcl.
Adding Protocol Instances to the Wave Window
You can add any protocol instance present in the design to the wave window. Adding a protocol
instance to the wave window causes the Vivado simulator to run protocol analysis on the
protocol instance inputs starng from the simulaon me 0 regardless of how much simulaon
me has already elapsed. As protocol analysis ulizes the waveform database (WDB), inputs of
all protocol instances are always traced in the waveform database even if you have not requested
tracing of the inputs or added the protocol instance to the wave window.
In addion to marking an AXI interface in your IP integrator block design as described in Using
the IP Integrator to Mark an AXI Interface to View in the Vivado Simulator secon, you can add a
protocol instance to the wave window using the Objects window or a Tcl command.
IMPORTANT!
Protocol instances may use more computer resources, it is recommended that you add just
the protocol instances you currently need. You can always add addional protocol instances at a later me
during the simulaon without missing the data.
Perform the following steps to add a protocol instance to the Wave window using the Objects
window:
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 104
1. To locate the protocol instance in the Objects window, see the steps described in the secon
Finding Protocol Instances in the Objects Window.
2. Add the protocol instance to the Wave window by the following two ways:
a. Right click the protocol instance and choose Add to Wave.
b. Drag and drop the protocol instance to the Name column of the Wave window.
Perform the following steps to add a protocol instance to the Wave window using a Tcl
command:
1. To locate the protocol instance in the Objects window, see the steps described in the secon
Finding Protocol Instances in the Vivado Simulator.
2. Copy the protocol instance path to the clipboard:
a. If you have located the protocol instance in the Objects window, le click the protocol
instance to select it and copy the protocol instance path.
b. If you have located the protocol instance in the Tcl console, use your mouse to select the
protocol instance path and copy it.
c. If you have located the protocol instance using the get_objects Tcl command, use your
mouse to select the text of the protocol instance path in the Tcl console and copy it.
Alternavely, you can get objects together as described in the following secon.
3. Type add_wave and paste the protocol instance name.
TIP:
If your protocol instance path contains special characters, surround the path with double braces. For
example,
add_wave {{path}}
.
Using get_objects Programmatically
When you use the get_objects Tcl command as described in Finding Protocol Instances Using
a Tcl Command, the command returns the protocol instances as a Tcl list. You can store the list in
a Tcl variable:
set p [get_objects -r /* -filter {type==proto_inst}]
and use the list with the add_wave Tcl command to add all the protocol instances in the list:
add_wave $p
or a specic protocol instance from the list using the built-in lindex command as shown in the
following example that adds the rst protocol instance of the list:
add_wave [lindex $p 0]
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 105
Analyzing Protocol Instances in the Wave Window
This secon describes the waveform features common to all interface types. See the following
protocol specic secons for more informaon about a specic interface type (AXI Memory
Mapped or AXI4 Stream).
Understanding Protocol Instances in the Wave Window
When you add a protocol instance to the wave window, the Vivado simulator creates a hierarchy
of wave objects to represent the protocol instance. You cannot change the structure of the
hierarchy. The type of AXI interface determines the hierarchy.
TIP: You may need to view the protocol instance input signals not included in the wave object hierarchy.
While you cannot add the signals into the hierarchy, you can add them before or aer the hierarchy.
Understanding Transaction Waveforms
Transacon waveforms dier from other types of waveforms. A transacon waveform displays
periods of acvity and inacvity of some aspect of the simulated design in contrast with
displaying value changes of a signal over me. The following gure shows an example of a
transacon waveform. A thin line indicates periods of inacvity, while the rectangles represent
periods of acvity which are generally called transacon bars. The example in the gure shows
three transacon bars.
Figure 31: Transaction Waveform Display
As shown in the following gure, the transacon waveform displays a gray bar with the text
Loading while protocol analysis is performed on the inputs of the protocol instance. As the
protocol analysis progresses, the gray bars shrink to reveal newly processed transacon data.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 106
Figure 32: Transaction Waveforms Showing Incomplete Protocol Analysis
Using Transaction Bars
Selecting Transaction Bars
Place your cursor on a transacon bar and le click to select the transacon bar which is
highlighted with a double border as shown in the following gure:
Figure 33: A Selected Transaction Bar
If the selected transacon bar is a member of a group of related transacon bars, arrows appear
called associaons connecng the related transacon bars. The rest of the objects in the wave
window appear dim to highlight the group of transacon bars. The following gure shows a
selected transacon bar and its related transacon bars connected with associaons.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 107
Figure 34: Transaction Bars with Associations
Press the Esc key to clear the transacon bar selecon.
TIP: To reposion the main cursor within a transacon waveform, hold the Ctrl key and le click at the
desired cursor me.
Navigation Transactions Using Associations
When you click on one end of an associaon, the selecon moves to the transacon bar at the
other end of the associaon, and the wave window scrolls so that the other end is in view.
Note: The wave window may not scroll if the other end is already in view.
Tool Tips
When you hover over a transacon bar or an associaon using your mouse, a tool p displaying
extra informaon about the transacon bar or associaon may appear depending on the type of
protocol instance interface.
Analyzing AXI Memory-Mapped (AXI-MM) Interfaces
This secon describes the transacon viewing features specic to AXI-MM protocol instances. A
protocol instance of an AXI-MM interface appears in the wave window with a wave object
hierarchy as shown in the following gure.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 108
Figure 35: AXI-MM Interface
Understanding the Top Summary Row
The top of the wave object hierarchy of an AXI-MM protocol instance is the top summary row.
This transacon waveform shows the overall read and write acvity of an AXI interface based on
the following rules:
If one or more AXI read transacons are in progress, the top summary shows a Read
transacon bar in purple color.
If one or more AXI write transacons are in progress, the top summary shows a Write
transacon bar in pink color.
If one or more of AXI read and write transacons are in progress, the top summary shows
Read/Write transacon bar in teal color.
An AXI transacon is an abstract concept not to be confused with the graphical transacon bar.
It is a complete data exchange carried out using AXI signaling including the Address, Data, and
oponally Response phases.
TIP:
For performance reasons, the wave viewer does not display the transacon bars in dierent colors
when zoomed out. Instead, it displays all transacon bars in teal color. You need to zoom in to disnguish
between read and write transacons.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 109
Understanding the Outstanding Reads and Outstanding Writes Rows
There are a group of outstanding AXI read transacons and a group of write transacons located
under the top of the wave object hierarchy of an AXI-MM protocol instance. An AXI transacon
is known as outstanding if the interface master has raised A*VALID or WVALID but the last data
phase or oponally response phase has not yet completed. The outstanding reads row shows the
current count of outstanding AXI read transacons or is inacve (shown as a thin line) to indicate
zero outstanding AXI read transacons. Similarly, the outstanding writes row shows the current
count of outstanding AXI write transacons or is inacve to indicate zero outstanding AXI write
transacons.
Understanding the Transaction Summary Rows
There is a set of transacon summary rows under each outstanding read and write row labeled as
Row <n>, where <n> is an integer. A transacon summary is a transacon bar that depicts a
single AXI transacon starng at the rst phase and ending at the last phase of an AXI
transacon. The assignment of a transacon summary to a specic numbered row conveys no
special meaning. Instead, it prevents overlapping of mulple outstanding AXI transacons in the
same row.
TIP: The number of transacon summary rows can increase as simulaon progresses. For performance
reasons, the wave window updates the rows only when protocol analysis is complete. To see the latest
state of the rows during simulaon without waing for the enre simulaon to complete, you can pause
the simulaon and allow the Loading bars to disappear.
Each transacon summary is labeled with a sequence number. The rst AXI transacon has a
sequence number of 1, the second AXI transacon has a sequence number of 2, and so forth.
The progression of sequence numbers for reads and writes are separate from each other and
from the AXI transacons of all other protocol instances. For example, a parcular protocol
instance can have an AXI read transacon with the sequence number 16 and a separate AXI
write transacon with the sequence number 16.
Understanding Channel Rows
The channels wave object group is collapsed by default. When you expand the group, you see
logic signals for the AXI interface clock and reset (if present) and one transacon row for each
AXI channel present in the interface.
Note: Not all ve channels are necessarily present in an AXI interface. For read only interfaces, the write
channels are absent. For write only interfaces, the read channels are absent. Some AXI interfaces that
employ the write channels may omit the response channel if the AXI master has no use of the response
informaon.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 110
Each channel row shows a transacon bar summarizing individual handshakes of that AXI
channel from VALID to READY, except that the mulple conguous data beats of the same AXI
transacon appear as a single transacon bar. To visually e all channel transacon bars of an
AXI transacon together, each channel transacon bar is tagged with the same sequence number
as the corresponding transacon summary. You can expand the channel row to show key AXI
signals for that channel.
TIP: You may need to view protocol instance input signals not included in the wave object hierarchy. While
you cannot add the signals into the hierarchy, you can add them before or aer the hierarchy.
TIP: You may noce that channel transacon bars appear up to one clock cycle aer the corresponding
AXI signal event. The AXI protocol analyzers consider AXI signal events that occur on or aer a posive
clock edge to take eect at the following posive clock edge.
When you hover over any channel transacon bar, associaon, or transacon summary using
your mouse, a tool p appears showing the values of the informaonal AXI address channel
signals from the address phase of the AXI transacon.
Note: Oponal AXI address channel signals which are absent from the interface are omied from the tool
p.
When you select a channel transacon bar, associaons appear for all channel transacon bars
parcipang in the same AXI transacon as the selected transacon bar. You can click the tails of
the associaon arrows to follow the progress of the AXI transacon from address phase through
response phase. The chain of associaons always begins with the address phase transacon even
if the data phase precedes the address phase.
Error Conditions
If there is a handshaking error on the interface, you may see a sequence number on a channel
transacon consisng of a string of all 9s. This sequence number indicates that the data and/or
response phases could not be matched with an address and/or data phase. Common causes are
mismatched read/write ID tags and the protocol analyzer being held in reset (ARESET or
ARESETn signal acve) while the AXI phases are in progress.
CAUTION!
Because certain conguraons of an AXI interconnect are opmized for performance rather
than transacon debugging, AXI interfaces internal to an AXI interconnect may respect a dierent reset
signal than the one connected to the interface causing transacon errors in the wave viewer. If you observe
transacon errors on the interface, it is recommended that you monitor interfaces on the outside of the
interconnect instead.
Analyzing AXI4-Stream (AXI-S) Interfaces
This secon describes the transacon viewing features specic to AXI-Stream protocol instances.
A protocol instance of an AXI-S interface appears in the wave window with a wave object
hierarchy as shown in the following gure.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 111
Figure 36: AXI-Stream (AXI-S) Interface
The wave object hierarchy of an AXI-S interface contains only one transacon row which is at
the top of the hierarchy. Each transacon bar in the row corresponds to one complete AXI
transacon. The text on the transacon consists of the stream idener from AXI signal TID and
the coarse roung informaon from AXI signal TDEST.
The transacon bar contains color coded stripes to indicate the status of an AXI transacon as
described in the following table.
Table 12: AXI Transaction Status
Color Status Description
Green Normal Data is streaming normally.
Yellow Starve Slave is waiting for data from the master.
Red Stall Master is producing data faster than slave can consume it.
Under the top transacon row, the wave object hierarchy contains some of the key AXI signals
plus stall and starve status signals to indicate stall and starve condions. The status signals
provide the same informaon as the color stripes do in the transacon row.
TIP:
You may noce that the channel transacon bars appear up to one clock cycle aer the
corresponding AXI signal event. The AXI protocol analyzers consider AXI signal events that occur on or
aer a posive clock edge to take eect at the following posive clock edge.
Error Conditions
A handshaking error produces an error transacon with the text containing all Fs.
Chapter 5: Analyzing Simulation Waveforms with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 112
Chapter 6
Debugging a Design with Vivado
Simulator
The Vivado
®
Design Suite simulator provides you with the ability to:
Examine source code
Set breakpoints and run simulaon unl a breakpoint is reached
Step over secons of code
Force waveform objects to specic values
This chapter describes debugging methods and includes Tcl commands that are valuable in the
debug process. There is also a ow descripon on debugging with third-party simulators.
Debugging at the Source Level
You can debug your HDL source code to track down unexpected behavior in the design.
Debugging is accomplished through controlled execuon of the source code to determine where
issues might be occurring. Available strategies for debugging are:
Step through the code line by line: For any design at any point in development, you can use
the step command to debug your HDL source code one line at a me to verify that the
design is working as expected. Aer each line of code, run the step command again to
connue the analysis. For more informaon, see Stepping Through a Simulaon.
Set breakpoints on the specic lines of HDL code, and run the simulaon unl a breakpoint is
reached: In larger designs, it can be cumbersome to stop aer each line of HDL source code is
run. Breakpoints can be set at any predetermined points in your HDL source code, and the
simulaon is run (either from the beginning of the test bench or from where you currently are
in the design) and stops are made at each breakpoint. You can use the Step, Run All, or Run
For command to advance the simulaon aer a stop. For more informaon, see the secon,
Using Breakpoints, below.
Set condions. The tools evaluate each condion and execute Tcl commands when the
condion is true. Use the Tcl command:
add_condition <condition> <instruction>
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 113
See Adding Condions for more informaon.
Stepping Through a Simulation
You can use the step command, which executes your HDL source code one line of source code
at a me, to verify that the design is working as expected.
The line of code is highlighted and an arrow points to the currently execung line of code.
You can also create breakpoints for addional stops while stepping through your simulaon. For
more informaon on debugging strategies in the simulator, seethe secon, Using Breakpoints,
below.
1. To step through a simulaon:
From the current running me, select Run > Step, or click the Step buon .
The HDL associated with the top design unit opens as a new view in the Wave window.
From the start (0 ns), restart the simulaon. Use the Restart command to reset me to the
beginning of the test bench. See Chapter 4: Simulang with Vivado Simulator.
2. In the waveform conguraon window, right-click the waveform or HDL tab and select Tile
Horizontally see the waveform and the HDL code simultaneously.
3. Repeat the Step acon unl debugging is complete.
As each line is executed, you can see the arrow moving down the code. If the simulator is
execung lines in another le, the new le opens, and the arrow steps through the code. It is
common in most simulaons for mulple les to be opened when running the Step command.
The Tcl Console also indicates how far along the HDL code the step command has progressed.
Using Breakpoints
A breakpoint is a user-determined stopping point in the source code that you can use for
debugging the design.
TIP:
Breakpoints are parcularly helpful when debugging larger designs for which debugging with the Step
command (stopping the simulaon for every line of code) might be too cumbersome and me consuming.
You can set breakpoints in executable lines in your HDL le so you can run your code
connuously unl the simulator encounters the breakpoint.
Note: You can set breakpoints on lines with executable code only. If you place a breakpoint on a line of
code that is not executable, the breakpoint is not added.
1. Run a simulaon.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 114
2. Go to your source le and click the hollow circle to the le of the source line of interest.
A red dot conrms the breakpoint is set correctly.
Aer the procedure completes, a simulaon breakpoint buon opens next to the line of code.
Type the Tcl Command: add_bp <file_name> <line_number>
This command adds a breakpoint at <line_number> of <file_name>. See the Vivado
Design Suite help or the Vivado Design Suite Tcl Command Reference Guide (UG835) for
command usage.
Open the HDL source le.
3. Set breakpoints on executable lines in the HDL source le.
4. Repeat steps 1 and 2 unl all breakpoints are set.
5. Run the simulaon, using a Run opon:
To run from the beginning, use the Run > Restart command.
Use the Run > Run All or Run > Run For command.
The simulaon runs unl a breakpoint is reached, then stops.
The HDL source le displays an arrow, indicang the breakpoint stopping point.
6. Repeat Step 4 to advance the simulaon, breakpoint by breakpoint, unl you are sased
with the results.
A controlled simulaon runs, stopping at each breakpoint set in your HDL source les.
During design debugging, you can also run the Run > Step command to advance the
simulaon line by line to debug the design at a more detailed level.
You can delete a single breakpoint or all breakpoints from your HDL source code.
To delete a single breakpoint, click the Breakpoint buon
.
To remove all breakpoints, either select Run> Delete All Breakpoints or click the Delete All
Breakpoints buon .
To delete all breakpoints:
Type the Tcl command remove_bps -all.
To get breakpoint informaon on the specied list of breakpoint objects:
Type the Tcl command report_bps
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 115
Adding Conditions
To add breakpoints based on a condion and output a diagnosc message, use the following
commands:
add_condition <condition> <message>
Using the Vivado IDE BFT example design, to stop when the wbClk signal and the reset are
both acve-High, issue the following command at start of simulaon to print a diagnosc
message and pause simulaon when reset goes to 1 and wbClk goes to 1:
add_condition {reset == 1 && wbClk == 1} {puts "Reset went to high"; stop}
In the BFT example, the added condion causes the simulaon to pause at 5 ns when the
condion is met and "Reset went to high" is printed to the console. The simulator waits
for the next step or run command to resume simulaon.
-notrace Option
Normally, when you execute the add_condition command, the specied Tcl commands also
echo to the console, log le, and journal le. The -notrace switch causes those commands to
execute silently, suppressing the commands (but not their output) from appearing in those three
places.
For Example, If you execute the following example command:
puts 'Hello'
The normal behavior of the above command would be to emit the following output in the
console, log le, and journal le:
# puts ‘Hello’
Hello
When you execute -notrace switch, it would produce only the following output:
Hello
Pausing a Simulation
While running a simulaon for any length of me, you can pause a simulaon using the Break
command, which leaves the simulaon session open.
To pause a running simulaon, select Simulaon > Break or click the Break buon .
The simulator stops at the next executable HDL line. The line at which the simulaon stopped is
displayed in the text editor.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 116
Note: This behavior applies to designs that are compiled with the -debug <kind> switch.
Resume the simulaon any me using the Run All, Run, or Step commands. See Stepping
Through a Simulaon for more informaon.
Tracing the Execution of a Simulation
You can display a note on the Tcl console for every source line that the simulaon encounters
while running. This connuous display of encountered lines is called line tracing.
To turn on line tracing, use one of the following Tcl commands:
ltrace on
set_property line_tracing true [current_sim]
To turn o line tracing use one of the following Tcl commands:
ltrace off
set_property line_tracing false [current_sim]
You can display a note on the Tcl console for every process that the simulaon encounters while
running. This connuous display of encountered processes is called process tracing.
To turn on process tracing, use one of the following Tcl commands:
ptrace on
set_property process_tracing true [current_sim]
To turn o process tracing, use one of the following Tcl commands:
ptrace off
set_property process_tracing false [current_sim]
Forcing Objects to Specific Values
Using Force Commands
The Vivado simulator provides an interacve mechanism to force a signal, wire, or register to a
specied value at a specied me or period of me. You can also force values on objects to
change over a period of me.
TIP:
A 'force' is both an acon (that is, the overriding of HDL-dened behavior on a signal) and also a Tcl
rst-class object, something you can hold in a Tcl variable.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 117
You can use force commands on an HDL signal to override the behavior for that signal as dened
in your HDL design. You might, for example, choose to override the behavior of a signal to:
Supply a smulus to a test bench signal that the HDL test bench itself is not driving
Correct a bad value temporarily during debugging (allowing you to connue analyzing a
problem)
The available force commands are:
Force Constant
Force Clock
Remove Force
The following gure illustrates how the add_force funconality is applied given the following
command:
add_force mySig {0 t
1
} {1 t
2
} {0 t
3
} {1 t
4
} {0 t
5
} -repeat_every tr -
cancel_after t
c
Figure 37: Illustration of -add_force Functionality
tc
tr
t1
t2
t3
t4
t5
Current Time
You can get more detail on the command by typing the following in the Tcl Console:
add_force -help
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 118
Force Constant
The Force Constant opon lets you x a signal to a constant value, overriding the assignments
made within the HDL code or another previously applied constant or clock force.
Force Constant and Force Clock are opons in the Objects or wave window right-click menu (as
shown in the following gure), or in the text editor (source code).
TIP: Double-click an item in the Objects, Sources, or Scope window to open it in the text editor. For
addional informaon about the text editor, see the Vivado Design Suite User Guide: Using the Vivado IDE
(UG893).
Figure 38: Force Options
The Force opons are disabled for the objects for which the Vivado simulator does not support
forcing. The type of object or limitaons in the Vivado simulator's modeling for those objects
may be the cause for not supporng such objects.
TIP:
To force a module or enty port whose Force opons are disabled, try forcing its connected actual
signal one scope level up. Use the
add_force
Tcl command (for example,
add_force myObj 0
) to
view the reason why the opons are disabled.
When you select the Force Constant opon, the Force Constant dialog box opens so you can
enter the relevant values, as shown in the following gure.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 119
Figure 39: Force Constant Dialog Box
The following are Force Constant opon descripons:
Signal name: Displays the default signal name, that is, the full path name of the selected
object.
Value radix: Displays the current radix seng of the selected signal. You can choose one of
the supported radix types: Binary, Hexadecimal, Unsigned Decimal, Signed Decimal, Signed
Magnitude, Octal, and ASCII. The GUI then disallows entry of the values based on the Radix
seng. For example: if you choose Binary, no numerical values other than 0 and 1 are
allowed.
Force value: Species a force constant value using the dened radix value. (For more
informaon about radixes, see Changing the Default Radix and Using Analog Waveforms.)
Starng aer me oset: Starts aer the specied me. The default starng me is 0. Time
can be a string, such as 10 or 10 ns. When you enter a number without a unit, the Vivado
simulator uses the default (ns).
Cancel aer me oset: Cancels aer the specied me. Time can be a string such as 10 or
10 ns. If you enter a number without a unit, the default simulaon me unit is used.
Tcl command:
add_force /testbench/TENSOUT 1 200 -cancel_after 500
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 120
Force Clock
The Force Clock command lets you assign a signal a value that toggles at a specied rate
between two states, in the manner of a clock signal, for a specied length of me. When you
select the Force Clock opon in the Objects window menu, the Force Clock dialog box opens, as
shown in the following gure.
Figure 40: Force Clock Dialog Box
The
opons in the Force Clock dialog box are shown below.
Signal name: Displays the default signal name; the full path name of the item selected in the
Objects window or waveform.
TIP: The Force Clock command can be applied to any signal (not just clock signals) to dene an
oscillang value.
Value radix: Displays the current radix seng of the selected signal. Select one of the
displayed radix types from the drop-down menu: Binary, Hexadecimal, Unsigned Decimal,
Signed Decimal, Signed Magnitude, Octal, or ASCII.
Leading edge value: Species the rst edge of the clock paern. The leading edge value uses
the radix dened in Value radix eld.
Trailing edge value: Species the second edge of the clock paern. The trailing edge value
uses the radix dened in the Value radix eld.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 121
Starng aer me oset: Starts the force command aer the specied me from the current
simulaon. The default starng me is 0. Time can be a string, such as 10 or 10 ns. If you
enter a number without a unit, the Vivado simulator uses the default user unit.
Cancel aer me oset: Cancels the force command aer the specied me from the current
simulaon me. Time can be a string, such as 10 or 10 ns. When you enter a number without
a unit, the Vivado simulator uses the default simulaon me unit.
Duty cycle (%): Species the percentage of me that the clock pulse is in an acve state. The
acceptable value is a range from 0 to 100 (default is 50%).
Period: Species the length of the clock pulse, dened as a me value. Time can be a string,
such as 10 or 10 ns.
Note: For more informaon about radixes, see Changing the Default Radix and Using Analog
Waveforms.
Example Tcl command:
add_force /testbench/TENSOUT -radix bin {0} {1} -repeat_every 10ns -
cancel_after 3us
Remove Force
Remove Force
To remove any specied force from an object use the following Tcl command:
remove_forces <force object>
remove_forces <HDL object>
Using Force in Batch Mode
The code examples below show how to force a signal to a specied value using the add_force
command. A simple verilog circuit is provided. The rst example shows the interacve use of the
add_force command and the second example shows the scripted use.
Example 1: Adding Force
The following code snippet is a Verilog circuit:
module bot(input in1, in2,output out1);
reg sel;
assign out1 = sel? in1: in2;
endmodule
module top;
reg in1, in2;
wire out1;
bot I1(in1, in2, out1);
initial
begin
#10 in1 = 1'b1; in2 = 1'b0;
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 122
#10 in1 = 1'b0; in2 = 1'b1;
end
initial
$monitor("out1 = %b\n", out1);
endmodule
You can invoke the following commands to observe the eect of add_force:
xelab -vlog tmp.v -debug all
xsim work.top
At the command prompt, type:
add_force /top/I1/sel 1
run 10
add_force /top/I1/sel 0
run all
You can use the add_force Tcl command to force a signal, wire, or register to a specied value:
add_force [-radix <arg>] [-repeat_every <arg>] [-cancel_after <arg>] [-
quiet]
[-verbose] <hdl_object> <values>...
For more info on this and other Tcl commands, see the Vivado Design Suite Tcl Command Reference
Guide (UG835).
Example 2: Scripted Use of add_force with remove_forces
The following is an example Verilog le, top.v, which instanates a counter. You can use this le
in the following command example.
module counter(input clk,reset,updown,output [4:0] out1);
reg [4:0] r1;
always@(posedge clk)
begin
if(reset)
r1 <= 0;
else
if(updown)
r1 <= r1 + 1;
else
r1 <= r1 - 1;
end
assign out1 = r1;
endmodule
module top;
reg clk;
reg reset;
reg updown;
wire [4:0] out1;
counter I1(clk, reset, updown, out1);
initial
begin
reset = 1;
#20 reset = 0;
end
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 123
initial
begin
updown = 1; clk = 0;
end
initial
#500 $finish;
initial
$monitor("out1 = %b\n", out1);
endmodule
Command Example
1. Create a le called add_force.tcl with following command:
create_project add_force -force
add_files top.v
set_property top top [get_filesets sim_1]
set_property -name xelab.more_options -value {-debug all} -objects
[get_filesets
sim_1]
set_property runtime {0} [get_filesets sim_1]
launch_simulation -simset sim_1 -mode behavioral
add_wave /top/*
2. Invoke the Vivado Design Suite in Tcl mode, and source the add_force.tcl le.
3. In the Tcl Console, type:
set force1 [add_force clk {0 1} {1 2} -repeat_every 3 -cancel_after 500]
set force2 [add_force updown {0 10} {1 20} -repeat_every 30]
run 100
Observe that the value of out1 increments as well as decrements in the Wave window. You
can observe the waveforms in the Vivado IDE using the start_gui command.
Observe the value of updown signal in the Wave window.
4. In the Tcl Console, type:
remove_forces $force2
run 100
Observe that only the value of out1 increments.
5. In the Tcl Console, type:
remove_forces $force1
run 100
Observe that the value of out1 is not changing because the clk signal is not toggling.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 124
Power Analysis Using Vivado Simulator
The Switching Acvity Interchange Format (SAIF) is an ASCII report that assists in extracng and
storing switching acvity informaon generated by simulator tools. This switching acvity can be
back-annotated into the Xilinx
®
power analysis and opmizaon tools for the power
measurements and esmaons.
Switching Acvity Interchange Format (SAIF) dumping is opmized for Xilinx power tools and for
use by the report_power Tcl command. The Vivado simulator writes the following HDL types
to the SAIF le. Refer to this link in the Vivado Design Suite User Guide: Power Analysis and
Opmizaon (UG907) for addional informaon.
Verilog:
Input, Output, and Inout ports
Internal wire declaraons
VHDL:
Input, Output, and Inout ports of type std_logic, std_ulogic, and bit (scalar, vector,
and arrays).
Note: A VHDL netlist is not generated in the Vivado Design Suite for ming simulaons; consequently,
the VHDL sources are for RTL-level code only, and not for netlist simulaon.
For RTL-level simulaons, only block-level ports are generated and not the internal signals.
For informaon about power analysis using third-party simulaon tools, see Dumping SAIF for
Power Analysis, and Dumping SAIF in VCS in Chapter 3: Simulang with Third-Party Simulators.
Generating SAIF Dumping
Before you use the log_saif command, you must call open_saif. The log_saif command
does not return any object or value.
1. Compile your RTL code with the -debug typical opon to enable SAIF dumping:
xvlog -sv <fileName>.sv
xelab xsim mysim -debug typical top -s mysim
2. Use the following Tcl command to start SAIF dumping:
open_saif <saif_file_name>
3. Add the scopes and signals to be generated by typing one of the following Tcl commands:
log_saif [get_objects]
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 125
To recursively log all instances, use the Tcl command:
log_saif [get_objects -r *]
4. Run the simulaon (use any of the run commands).
5. Import simulaon data into an SAIF format using the following Tcl command:
close_saif
Example SAIF Tcl Commands
To log SAIF for:
All signals in the scope: /tb: log_saif /tb/*
All the ports of the scope: /tb/UUT
Those objects having names that start with a and end in b and have digits in between:
log_saif [get_objects -regexp {^a[0-9]+b$}]
The objects in the current_scope and children_scope:
log_saif [get_objects -r *]
The objects in the current_scope:
log_saif * or log_saif [get_objects]
Only the ports of the scope /tb/UUT, use the command:
id="ah453025">log_saif [get_objects -filter {type == in_port || type ==
out_port || type ==
inout_port || type == port } /tb/UUT/* ]
Only the internal signals of the scope /tb/UUT, use the command:
log_saif [get_objects -filter { type == signal } /tb/UUT/* ]
TIP: This ltering is applicable to all Tcl commands that require HDL objects.
Dumping SAIF using a Tcl Simulation Batch File
sim.tcl:
open_saif xsim_dump.saif
log_saif /tb/dut/*
run all
close_saif
quit
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 126
Using the report_drivers Tcl Command
You can use the report_drivers Tcl command to determine what signal is driving a value on
an HDL object. The syntax is as follows:
report_drivers <hdl_object>
The command prints drivers (HDL statements doing the assignment) to the Tcl Console along
with current driving values on the right side of the assignment to a wire or signal-type HDL
object.
You can also call the report_drivers command from the Object or Wave window context
menu or text editor. To open the context menu (shown in the gure below), right-click any signal
and click Report Drivers. The result appears in the Tcl console.
Figure 41: Context Menu with Report Drivers Command Option
Using the Value Change Dump Feature
You can use a Value Change Dump (VCD) le to capture simulaon output. The Tcl commands
are based on Verilog system tasks related to dumping values.
For the VCD feature, the Tcl commands listed in the table below model the Verilog system tasks.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 127
Table 13: Tcl Commands for VCD
Tcl Command Description
open_vcd
Opens a VCD file for capturing simulation output. This Tcl command models the behavior
of $dumpfile Verilog system task.
checkpoint_vcd
Models the behavior of the $dumpall Verilog system task.
start_vcd
Models the behavior of the $dumpon Verilog system task.
log_vcd
Logs VCD for the specified HDL objects. This command models behavior of the
$dumpvars Verilog system task.
flush_vcd
Models behavior of the $dumpflush Verilog system task.
limit_vcd
Models behavior of the $dumplimit Verilog system task.
stop_vcd
Models behavior of the $dumpoff Verilog system task.
close_vcd
Closes the VCD generation.
See the Vivado Design Suite Tcl Command Reference Guide (UG835), or type the following in the Tcl
Console:
<command> -help
Example:
open_vcd xsim_dump.vcd
log_vcd /tb/dut/*
run all
close_vcd
quit
See Verilog Language Support Excepons for more informaon.
You can use the VCD data to validate the output of the simulator to debug simulaon failures.
Related Information
Vivado Simulator Mixed Language Support and Language Excepons
Using the log_wave Tcl Command
The log_wave command logs simulaon output for viewing specied HDL objects with the
Vivado simulator waveform viewer. Unlike add_wave, the log_wave command does not add
the HDL object to the waveform viewer (that is, the Waveform Conguraon). It simply enables
the logging of output to the Vivado simulator Waveform Database (WDB).
TIP:
To display object values prior to the me of inseron, the simulaon must be restarted. To avoid
having to restart the simulaon because of missing value changes: issue the log_wave -r / Tcl command at
the start of a simulaon run to capture value changes for all display-able HDL objects in your design.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 128
Syntax:
log_wave [-recursive] [-r] [-quiet] [-verbose] <hdl_objects>...
Example log_wave TCL Command Usage
To log the waveform output for:
All signals in the design (excluding those of alternate top modules):
log_wave -r /
All signals in a scope: /tb:
log_wave /tb/*
Those objects having names that start with a and end in b and have digits in between:
log_wave [get_objects -regexp {^a[0-9]+b$}]
All objects in the current scope and all child scopes, recursively:
log_wave -r *
Temporarily overriding any message limits and return all messages from the following
command:
log_wave -v
The objects in the current scope:
log_wave *
Only the ports of the scope /tb/UUT, use the command:
log_wave [get_objects -filter {type == in_port || type == out_port ||
type ==
inout_port || type == port} /tb/UUT/*]
Only the internal signals of the scope /tb/UUT, use the command:
log_wave [get_objects -filter {type == signal} /tb/UUT/*]
The wave conguraon sengs; which include the signal order, name style, radix, and color; are
saved to the wave conguraon (WCFG) le upon demand. See Chapter 5: Analyzing Simulaon
Waveforms with Vivado Simulator.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 129
Cross Probing Signals in the Object, Wave,
and Text Editor Windows
In Vivado simulator, you can do cross probing on signals present in the Objects, Wave, and text
editor windows.
From the Objects window, you can check to see if a signal is present in the Wave window and
vice versa. Right-click the signal to open the context menu shown in the following gure. Click
Show in Wave Window or Add to Wave Window (if signal is not yet present in the Wave
window).
Figure 42: Objects Window Context Menu Options
You can also cross probe a signal from the text editor. Right-click a signal to open the context
menu shown in the gure below. Select Add to Wave Window, Show in Waveform or Show in
Objects. The signal then appears highlighted in the Wave or Objects window.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 130
Figure 43: Text Editor Right-Click (Context) Menu
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 131
Tool Specific init.tcl
During execuon of simulaon, Vivado simulator sources the init le present at the following
locaon:
$HOME/.xilinx/xsim/xsim_init.tcl
It is useful, if you want to set a property across mulple runs. In such a scenario, you can write
these inside a tcl le and Vivado simulator will source this tcl le before me 0' during execuon.
Subprogram Call-Stack Support
You can now step-through subprogram calls and access automac (as well as stac) variables
inside subprogram using get_value/set_value opons.
Currently, you can only access these variables if the subprogram is at the top of the call-stack.
Use the following opons to support access to variables at any level of the call-stack.
Call Stacks Window
Call Stacks window shows HDL scopes for all the VHDL/Verilog processes in a design which are
waing inside a subprogram at the current simulaon me. This is similar to get_stacks Tcl
command.
By default, the current process in which simulaon is stopped (inside a subprogram) will be
selected in the Call Stacks window. However, you can select any other processes waing in a
subprogram. The eect of selecng a process on the Call Stack window is same as selecng a
process scope from the Scope window or using current_scope Tcl command. When you
select a process on the Call Stacks window, the updated process appears in the Scope window,
Objects window, Stack Frames window and Locals tab. The process name with absolute path and
its type of the selected process is shown in the Call Stacks window.
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 132
Figure 44: Call Stacks Window
Stack Frames Window
Stack Frames window shows the current HDL process that is waing inside a subprogram and
the subprograms in its call-stack. This is similar to report_frames and current_frame Tcl
commands. In the Stack Frames windows, the most recent subprogram in the current hierarchy is
shown at the top, followed by caller subprograms. The caller HDL process is shown the boom.
You can select other frames to be current and the eect is same as the current_frame –set
<selected_frame_index> Tcl command. The Locals tab in the Objects window follows the
subprogram frame selecon and shows the stac and automac variables local to the selected
subprogram frame. The frame number, subprogram/process name, source le and current line for
the selected HDL process is shown in the Stack Frames window.
Figure 45: Stack Frames Window
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 133
Locals Tab in Objects Window
The Locals tab in Objects window shows the name, value and type of stac and automac
variables local to the currently execung (or selected) subprogram. This is similar to
get_objects –local Tcl command. This window follows the frame selected in the Stack
Frames window. For every variable/argument, its name, value and type would be shown in the
Locals tab.
Figure 46: Locals Tab in Objects Window
Debugging with Dynamic Type
In the SystemVerilog, there are dynamic types such as Class, Dynamic Array, Queue, and
Associave Array etc. These dynamic types are supported in the Vivado simulator. Vivado allows
you to probe the dynamic type variables. For example:
module top();
int dynamicArray[];
byte queue[$];
initial
begin
dynamicArray = new[3];
dynamicArray = '{10, 20, 30};
queue.push_back(8'hab);
queue.push_back(8'hff);
#10;
dynamicArray = new[5](dynamicArray);
$display(queue.pop_front());
end
endmodule
You can probe the dynamic type variables using the following windows as shown in the following
gure:
Objects window
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 134
Tcl Console window by using get_value and report_value commands.
Toolp in the Sources window
Figure 47: Probing Dynamic Type
Note: Dynamic types are not supported for tracing waveform (add_wave) or for creang waveform
data base (log_wave).
Chapter 6: Debugging a Design with Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 135
Chapter 7
Simulating in Batch or Scripted
Mode in Vivado Simulator
This chapter describes the command line compilaon and simulaon process.
Vivado supports an integrated simulaon ow where the tool can launch Vivado simulator, or a
third party simulator from the IDE. However, many users also want to run simulaon in batch or
scripted mode in their vericaon environment, which may include system-level simulaon, or
advanced vericaon such as UVM. The Vivado Design Suite supports batch or scripted
simulaon in the Vivado simulator.
This chapter describes a process to gather the needed design les, to generate simulaon scripts
for your target simulator, and to run simulaon in batch mode. The simulaon scripts can be
generated for a top-level HDL design, or for hierarchical modules, managed IP projects, or block
designs from Vivado IP integrator. Batch simulaon is supported in both project and non-project
script-based ow.
Exporting Simulation Files and Scripts
Running a simulaon from the command line for either a behavioral or ming simulaon requires
you to perform the following steps:
1. Idenfying and parsing design les.
2. Elaborang and generang an executable simulaon snapshot of the design.
3. Running simulaon using the executable snapshot.
The Vivado Design Suite provides an Export Simulaon command to let you quickly gather the
design les required for simulaon, and generate the simulaon scripts for the top-level RTL
design, or a sub-design. The export_simulation command will generate scripts for all of the
supported third-party simulators, or for the target simulator of your choice.
From within the Vivado IDE, use the File → Export → Export Simulaon command to open the
Export Simulaon dialog box as shown in the following gure.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 136
Figure 48: Export Simulation Dialog Box
The Export Simulaon command writes a simulaon script le for all supported simulators, or for
the specied Target simulator. The generated scripts will contain simulator commands for
compiling, elaborang, and simulang the design.
The features of the Export Simulaon dialog box include the following:
Target simulator: Species all simulators, or a specic simulator to generate command line
scripts for. Target simulators include Vivado simulator as well as various supported third-party
simulators. Refer to Chapter 3: Simulang with Third-Party Simulators for more informaon.
Note: On the Windows operang system, scripts will only be generated for those simulators that run on
Windows.
Compiled library locaon: In order to perform simulaon with the script generated by Export
Simulaon, your simulaon libraries must rst be compiled with the compile_simlib Tcl
command. The generated scripts will automacally include the setup les needed for the
target simulator from the compiled library directory. Refer to Compiling Simulaon Libraries
for more informaon.
TIP:
It is recommended to provide the path to the Compile library locaon whenever running Export
Simulaon. This insures that the scripts will always point to the correct simulaon libraries.
Export directory: Species the output directory for the scripts wrien by Export Simulaon.
By default, the simulaon scripts are wrien to the local directory of the current project.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 137
Overwrite les: Overwrites the les of the same name that already exist in the export
directory.
Use absolute paths: By default, source les and directory paths in the generated scripts will be
relave to a reference directory that is dened in the scripts. Use this switch to make le
paths in the script absolute rather than relave.
Copy source les to export directory: Copy design les to the output directory. This copies
the simulaon source les as well as the generated scripts to make the enre simulaon folder
more portable.
Command: This eld provides the Tcl command syntax for the export_simulation
command that will be run as a result of the various opons and sengs that you have
specied in the Export Simulaon dialog box.
Help: For detailed informaon on various opons in Export Simulaon les dialog box, click
the help buon.
The Export Simulaon command supports both project and non-project designs. It does not read
properes from the current project to query for Verilog denes and include directories. Instead,
the Export Simulaon command gets direcves from the dialog box or from
export_simulation command opons. You must specify the appropriate opons to get the
results you want. In addion, you must have output products generated for all IP and BD that are
used in the top-level design.
IMPORTANT!
The
export_simulation
command will not generate output products for IP and BD if
they do not exist. Instead it will return an error and exit.
When you click OK on the Export Simulaon dialog box, the command gets the simulaon
compile order of all design les required for simulang the specied design object: the top-level
design, a hierarchical module, IP core, a block design from Vivado IP integrator, or a Managed IP
project with mulple IP. The simulaon compile order of the required design les is exported to a
shell script with compiler commands and opons for the target simulator.
The simulaon scripts are wrien to separate folders in the Export directory as specied in the
Export Simulaon dialog box. A separate folder is created for each specied simulator, and
compile, elaborate, and simulate scripts are wrien for the simulator.
The scripts generated by the Export Simulaon command uses a 3-step process, analyze/
compile, elaborate and simulate, that is common to many simulators including the Vivado
simulator. However, for ModelSim and Riviera the generated scripts use the two-step process of
compile and simulate that the tool requires.
TIP:
To use the two-step process in the Questa simulator, you can start with the scripts generated for
ModelSim and modify them as needed.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 138
The Export Simulaon command will also copy data les (if any) from the leset, or from an IP, to
the specied export directory. If the design contains Verilog sources, then the generated script
will also copy the glbl.v le from the Vivado soware installaon path to the output directory.
export_ip_user_files -no_script -force
export_simulation -directory "C:/Data/project_wave1" -simulator all
When you run the Export Simulaon command from the dialog box, the Vivado IDE actually runs
a sequence of commands that denes the base directory (or locaon) for the exported scripts,
exports the IP user les, and then runs the export_simulation command.
The export_ip_user_files command is run automacally by the Vivado IDE to ensure that
all required les needed to support simulaon for both core container and non-core container IP,
as well as block designs, are available. See this link in the Vivado Design Suite User Guide: Designing
with IP (UG896) for more informaon. While export_ip_user_files is run automacally
when working with the Export Simulaon dialog box, you must be sure to run it manually before
running the export_simulation command.
TIP: Noce the
-no_script
opon is specied when
export_ip_user_files
is run automacally
by the Vivado IDE. This is to prevent the generaon of simulaon scripts for the individual IP and BDs that
are used in the top-level design because it can add signicant run me to the command. However, you can
generate these simulaon scripts for individual IP and BD by running
export_ip_user_files
on
specied objects (
-of_objects
), or without the
-no_script
opon.
The export_ip_user_files command sets up the user le environment for IP and block
design needed for simulaon and synthesis. The command creates a folder called
ip_user_files which contains instanaon templates, stub les for use with third-party
synthesis tools, wrapper les, memory inializaon les, and simulaon scripts.
The export_ip_user_files command also consolidates stac simulaon les that are
shared across all IP and block designs in the project and copies them to an ipstatic folder.
Many of the IP les that are shared across mulple IP and BDs in a project do not change for
specic IP customizaons. These stac les are copied into the ipstatic directory. The scripts
created for simulaon reference the shared les in this directory as needed. The dynamic
simulaon les that are specic to an IP customizaon are copied to the IP folder. See this link,
or "Understanding IP User Files" in Vivado Design Suite User Guide: Designing with IP (UG896) for
more informaon.
IMPORTANT!
The scripts and les generated by the
export_simulation
command point to the les
in the
ip_user_files
directory. You must run the
export_ip_user_files
command before you
run
export_simulation
or simulaon errors may occur.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 139
Exporting the Top Level Design
To create simulaon scripts for the top-level RTL design use export_simulation and provide
the simulaon leset object. In the following example sim_1 is the simulaon leset, and export
simulaon will create simulaon scripts for all the RTL enes, IP, and BD objects in the design.
export_ip_user_files -no_script
export_simulation -of_objects [get_filesets sim_1] -directory C:/test_sim \
-simulator questa
Exporting IP from the Xilinx Catalog and Block
Designs
To generate scripts for an IP, or a Vivado IP integrator block design, you can simply run the
command on the IP or block design object:
export_ip_user_files -of_objects [get_ips blk_mem_gen_0] -no_script -force
export_simulation -simulator xcelium -directory ./export_script \
-of_objects [get_ips blk_mem_gen_0]
Or, export the ip_user_les for all IP and BDs in the design:
export_ip_user_files -no_script -force
export_simulation -simulator xcelium -directory ./export_script
You can also generate simulaon scripts for block design objects:
export_ip_user_files -of_objects [get_files base_microblaze_design.bd] \
-no_script -force
export_simulation -of_objects [get_files base_microblaze_design.bd] \
-directory ./sim_scripts
IMPORTANT!
You must have output products generated for all IP and BD that are used in the top-level
design. The
export_simulation
command will not generate output products for IP and BD if they do
not exist. Instead it will return an error and exit.
Exporting a Manage IP Project
Manage IP project provides users an ability to create and manage a centralized repository of
customized IPs. See this link in the Vivado Design Suite User Guide: Designing with IP (UG896) for
more informaon on Manage IP projects. When generang the IP output products for Manage IP
projects, the Vivado tool also generates simulaon scripts for each IP using the
export_ip_user_files command as previously discussed.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 140
Figure 49: Managed IP Project
The Managed IP Project shown above features four dierent customized IP: blk_mem_gen_0,
c_addsub_0, fifo_generator_0, xdma_0. For this project the Vivado Design Suite creates
an ip_user_files folder as shown in the following gure.
Figure 50: Managed IP Directory Structure
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 141
The ip_user_files folder is generated by the export_ip_user_files command as
previously described. When this command is run on a Manage IP project, it will recursively
process all the IP in the project and generate the scripts and other les needed for synthesis and
simulaon of the IP. The ip_user_files folder contains the scripts used for batch simulaon,
as well as the dynamic and stac IP les needed to support simulaon.
The simulaon scripts for your target simulator, or for all supported simulators, are located in
the ./sim_scripts folder as seen in Exporng a Manage IP Project. You can go to the folder
of your target simulator and incorporate the compile, elaborate, and simulate scripts into
your simulaon ow.
The Vivado tool consolidates all the shared simulaon les, used by mulple IP and BD in the
design, into a folder called ./ipstatic. The dynamic les that vary depending on the specics
of an IP customizaon are located in the ./ip folder.
TIP: In addion to exporng all the IP in a Manage IP project, you can use the steps outlined in Exporng
IP from the Xilinx Catalog and Block Designs to generate scripts for individual IP in the project.
Running the Vivado Simulator in Batch Mode
To run in batch or scripted mode, the Vivado simulator relies on three processes which are
supported by the les generated by the export_simulation command.
Parsing Design Files, xvhdl and xvlog
Elaborang and Generang a Design Snapshot, xelab
Simulang the Design Snapshot, xsim
For ming simulaon, there are addional steps and data required to complete the simulaon, as
described in the following:
Generang a Timing Netlist
Running Post-Synthesis and Post-Implementaon Simulaons
Parsing Design Files, xvhdl and xvlog
The xvhdl and xvlog commands parse VHDL and Verilog les, respecvely. Descripons for
each opon are available in Table 15: xelab, xvhd, and xvlog Command Opons.
xvhdl
The xvhdl command is the VHDL analyzer (parser).
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 142
xvhdl Syntax
xvhdl
[-encryptdumps]
[-f [-file] <filename>]
[-h [-help]
[-initfile <init_filename>]
[-L [-lib] <library_name> [=<library_dir>]]
[-log <filename>]
[-nolog]
[-prj <filename>]
[-relax]
[-v [verbose] [0|1|2]]
[-version]
[-work <library_name> [=<library_dir>]
[-incr]
[-2008]
[-93_mode]
[-nosignalhandlers]
This command parses the VHDL source le(s) and stores the parsed dump into a HDL library on
disk.
xvhdl Examples
xvhdl file1.vhd file2.vhd
xvhdl -work worklib file1.vhd file2.vhd
xvhdl -prj files.prj
xvlog
The xvlog command is the Verilog parser. The xvlog command parses the Verilog source le(s)
and stores the parsed dump into a HDL library on disk.
xvlog Syntax
xvlog
[-d [define] <name>[=<val>]]
[-encryptdumps]
[-f [-file] <filename>]
[-h [-help]]
[-i [include] <directory_name>]
[-initfile <init_filename>]
[-L [-lib] <library_name> [=<library_dir>]]
[-log <filename>]
[-nolog]
[-noname_unamed_generate]
[-relax]
[-prj <filename>]
[-sourcelibdir <sourcelib_dirname>]
[-sourcelibext <file_extension>]
[-sourcelibfile <filename>]
[-sv]
[-v [verbose] [0|1|2]]
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 143
[-version]
[-work <library_name> [=<library_dir>]
[-incr]
[-nosignalhandlers]
[-uvm_version arg]
xvlog Examples
xvlog file1.v file2.v
xvlog -work worklib file1.v file2.v
xvlog -prj files.prj
Note: xelab, xvlog and xvhdl are not Tcl commands. The xvlog, xvhdl, xelab are Vivado-
independent compiler executables. Hence, there is no Tcl command for them.
The simulaon launching is Vivado dependent and hence is done through xsim Tcl command.
For usage of simulaon outside Vivado, an executable by the same name as xsim is provided.
The xsim executable launches Vivado in project less mode and executes xsim Tcl command to
launch simulaon. Hence, to get help on xvlog, xvhdl, xelab form within Vivado IDE, please
precede the command with exec.
Example: exec xvlog –help.
To get help on xsim, use xsim –help.
Elaborating and Generating a Design
Snapshot, xelab
Simulaon with the Vivado simulator happens in two phases:
In the rst phase, the simulator compiler xelab, compiles your HDL model into a snapshot,
which is a representaon of the model in a form that the simulator can execute.
In the second phase, the simulator loads and executes (using the xsim command) the
snapshot to simulate the model. In Non-Project Mode, you can reuse the snapshot by skipping
the rst phase and repeang the second.
When the simulator creates a snapshot, it assigns the snapshot a name based on the names of
the top modules in the model. You can, however, override the default by specifying a snapshot
name as an opon to the compiler. Snapshot names must be unique in a directory or SIMSET;
reusing a snapshot name, whether default or custom, results in overwring a previously-built
snapshot with that name.
IMPORTANT!
You cannot run two simulaons with the same snapshot name in the same directory or
SIMSET.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 144
xelab
The xelab command, for given top-level units, does the following:
Loads children design units using language binding rules or the -L <library> command line
specied HDL libraries
Performs a stac elaboraon of the design (sets parameters, generics, puts generate
statements into eect, and so forth)
Generates executable code
Links the generated executable code with the simulaon kernel library to create an executable
simulaon snapshot
You then use the produced executable simulaon snapshot name as an opon to the xsim
command along with other opons to eect HDL simulaon.
TIP:
xelab
can implicitly call the parsing commands,
xvlog
and
xvhdl
. You can incorporate the
parsing step by using the
xelab -prj
opon. See Project File (.prj) Syntax for more informaon about
project les.
Note: xelab, xvlog and xvhdl are not Tcl commands. The xvlog, xvhdl, xelab are Vivado-
independent compiler executables. Hence, there is no Tcl command for them.
xelab Command Syntax Options
Descripons for each opon are available in the following codeblock.
xelab
[-d [define] <name>[=<val>]
[-debug <kind>]
[-f [-file] <filename>]
[-generic_top <value>]
[-h [-help]
[-i [include] <directory_name>]
[-initfile <init_filename>]
[-log <filename>]
[-L [-lib] <library_name> [=<library_dir>]
[-maxdesigndepth arg]
[-mindelay]
[-typdelay]
[-maxarraysize arg]
[-maxdelay]
[-mt arg]
[-nolog]
[-noname_unnamed_generate]
[-notimingchecks]
[-nosdfinterconnectdelays]
[-nospecify]
[-O arg]
[-override_timeunit]
[-override_timeprecision]
[-prj <filename>]
[-pulse_e arg]
[-pulse_r arg]
[-pulse_int_e arg]
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 145
[-pulse_int_r arg]
[-pulse_e_style arg]
[-r [-run]]
[-R [-runall]]
[-rangecheck]
[-relax]
[-s [-snapshot] arg]
[-sdfnowarn]
[-sdfnoerror]
[-sdfroot <root_path>]
[-sdfmin arg]
[-sdftyp arg]
[-sdfmax arg]
[-sourcelibdir <sourcelib_dirname>]
[-sourcelibext <file_extension>]
[-sourcelibfile <filename>]
[-stats]
[-timescale]
[-timeprecision_vhdl arg]
[-transport_int_delays]
[-v [verbose] [0|1|2]]
[-version]
[-sv_root arg]
[-sv_lib arg]
[-sv_liblist arg]
[-dpiheader arg]
[-driver_display_limit arg]
[-dpi_absolute]
[-incr]
[-93_mode]
[-nosignalhandlers]
[-dpi_stacksize arg]
[-transform_timing_checkers]
[-a[ --standalone]
[-ignore_assertions]
[-ignore_coverage]
[-cov_db_dir arg]
[-cov_db_name arg]
[-uvm_version arg]
[-report_assertion_pass]
[-dup_entity_as_module]
[-cc_celldefines]
[-cc_libs]
[-cc_type arg]
[-cc_db arg]
[-cc_dir arg]
[-cov_db_dir arg]
[-cov_db_name arg]
[-ignore_localparam_override]
[-sc_lib arg]
[-sc_root arg]
xelab Examples
xelab work.top1 work.top2 -s cpusim
xelab lib1.top1 lib2.top2 -s fftsim
xelab work.top1 work.top2 -prj files.prj -s pciesim
xelab lib1.top1 lib2.top2 -prj files.prj -s ethernetsim
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 146
Verilog Search Order
The xelab command uses the following search order to search and bind instanated Verilog
design units:
1. A library specied by the 'uselib direcve in the Verilog code. For example:
module
full_adder(c_in, c_out, a, b, sum)
input c_in,a,b;
output c_out,sum;
wire carry1,carry2,sum1;
`uselib lib = adder_lib
half_adder adder1(.a(a),.b(b),.c(carry1),.s(sum1));
half_adder adder1(.a(sum1),.b(c_in),.c(carry2),.s(sum));
c_out = carry1 | carry2;
endmodule
2. Libraries specied on the command line with -lib|-L switch.
3. A library of the parent design unit.
4. The work library.
Verilog Instantiation Unit
When a Verilog design instanates a component, the xelab command treats the component
name as a Verilog unit and searches for a Verilog module in the user-specied list of unied
logical libraries in the user-specied order.
If found, xelab binds the unit and the search stops.
If the case-sensive search is not successful, xelab performs a case-insensive search for a
VHDL design unit name constructed as an extended idener in the user-specied list and
order of unied logical libraries, selects the rst one matching name, then stops the search.
If xelab nds a unique binding for any one library, it selects that name and stops the search.
Note: For a mixed language design, the port names used in a named associaon to a VHDL enty
instanated by a Verilog module are always treated as case insensive. Also note that you cannot use a
defparam statement to modify a VHDL generic. See Using Mixed Language Simulaon, for more
informaon.
IMPORTANT! Connecng a whole VHDL record object to a Verilog object is unsupported.
VHDL Instantiation Unit
When a VHDL design instanates a component, the xelab command treats the component
name as a VHDL unit and searches for it in the logical work library.
If a VHDL unit is found, the xelab command binds it and the search stops.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 147
If xelab does not nd a VHDL unit, it treats the case-preserved component name as a Verilog
module name and connues a case-sensive search in the user-specied list and order of
unied logical libraries. The command selects the rst matching the name, then stops the
search.
If case sensive search is not successful, xelab performs a case-insensive search for a
Verilog module in the user-specied list and order of unied logical libraries. If a unique
binding is found for any one library, the search stops.
`uselib Verilog Directive
The Verilog `uselib direcve is supported, and sets the library search order.
`uselib Syntax
<uselib compiler directive> ::= `uselib [<Verilog-XL uselib directives>|
<lib
directive>]
<Verilog-XL uselib directives> :== dir = <library_directory> | file =
<library_file>
| libext = <file_extension>
<lib directive>::= <library reference> {<library reference>}
<library reference> ::= lib = <logical library name>
`uselib Lib Semantics
The `uselib lib direcve cannot be used with any of the Verilog-XL `uselib direcves. For
example, the following code is illegal:
`uselib dir=./ file=f.v lib=newlib
Mulple libraries can be specied in one `uselib direcve.
The order in which libraries are specied determines the search order. For example:
`uselib lib=mylib lib=yourlib
Species that the search for an instanated module is made in mylib rst, followed by
yourlib.
Like the direcves, such as `uselib dir, `uselib file, and `uselib libext, the
`uselib lib direcve is persistent across HDL les in a given invocaon of parsing and
analyzing, just like an invocaon of parsing is persistent. Unless another `uselib direcve is
encountered, a `uselib (including any Verilog XL `uselib) direcve in the HDL source
remains in eect. A `uselib without any argument removes the eect of any currently acve
`uselib <lib|file|dir|libext>.
The following module search mechanism is used for resolving an instanated module or UDP by
the Veric Verilog elaboraon algorithm:
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 148
First, search for the instanated module in the ordered list of logical libraries of the currently
acve `uselib lib (if any).
If not found, search for the instanated module in the ordered list of libraries provided as
search libraries in xelab command line.
If not found, search for the instanated module in the library of the parent module. For
example, if module A in library work instanated module B of library mylib and B
instanated module C, then search for module C in the /mylib, library, which is the library of
B (parent of C).
If not found, search for the instanated module in the work library, which is one of the
following:
The library into which HDL source is being compiled
The library explicitly set as work library
The default work library is named as work
`uselib Examples
Table 14: `uselib Examples
File half_adder.v compiled into
Logical Library Named adder_lib
File full_adder.v compiled into Logical Library Named
Work
module half_adder(a,b,c,s);
input a,b;
output c,s;
s = a ^ b;
c = a & b;
endmodule
module
full_adder(c_in, c_out, a, b, sum)
input c_in,a,b;
output c_out,sum;
wire carry1,carry2,sum1;
`uselib lib = adder_lib
half_adder
adder1(.a(a),.b(b),. c(carry1),.s(sum1)); half_adder
adder1(.a(sum1),.b(c_in),.c (carry2),.s(sum)); c_out =
carry1 | carry2; endmodule
xelab, xvhdl, and xvlog xsim Command Options
The following table lists the command opons for the xelab, xvhdl, and xvlog xsim
commands.
Table 15: xelab, xvhd, and xvlog Command Options
Command Option Description
Used by
Command
-d [define] <name>[=<val>]
Define Verilog macros. Use -d|--define for each
Verilog macro. The format of the macro is
<name>[=<val>] where <name> is name of the macro
and <value> is an optional value of the macro.
xelab
Parsing Design Files,
xvhdl and xvlog
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 149
Table 15: xelab, xvhd, and xvlog Command Options (cont'd)
Command Option Description
Used by
Command
-debug <kind>
Compile with specified debugging ability turned on.
The <kind> options are:
typical: Most commonly used abilities, including:
line and wave.
line: HDL breakpoint.
wave: Waveform generation, conditional execution,
force value.
xlibs: Visibility into Xilinx
®
precompiled libraries.
This option is only available on the command line.
off: Turn off all debugging abilities (Default).
all: Uses all the debug options.
xelab
-encryptdumps
Encrypt parsed dump of design units being compiled. Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
-f [-file] <filename>
Read additional options from the specified file. xelab
xsim Executable
Options
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
-generic_top <value>
Override generic or parameter of a top-level design
unit with specified value. Example: -generic_top
"P1=10"
xelab
-h [-help]
Print this help message. xelab
xsim Executable
Options
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
-i [include] <directory_name>
Specify directories to be searched for files included
using Verilog `include. Use -i|--include for each
specified search directory.
xelab
Parsing Design Files,
xvhdl and xvlog
-initfile <init_filename>
User-defined simulator initialization file to add to or
override settings provided by the default xsim.ini
file.
xelab
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
-L [-lib] <library_name>
[=<library_dir>]
Specify search libraries for the instantiated non-VHDL
design units; for example, a Verilog design unit.
Use -L|--lib for each search library. The format of
the argument is <name>[=<dir>] where <name> is the
logical name of the library and <library_dir> is an
optional physical directory of the library.
xelab
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 150
Table 15: xelab, xvhd, and xvlog Command Options (cont'd)
Command Option Description
Used by
Command
-log <filename>
Specify the log file name. Default: <xvlog|xvhdl|
xelab|xsim>.log.
xelab
xsim Executable
Options
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
-maxarraysize <arg>
Set maximum vhdl array size to be 2**n (Default: n =
28, which is 2**28).
xelab
-maxdelay
Compile Verilog design units with maximum delays. xelab
-maxdesigndepth <arg>
Override maximum design hierarchy depth allowed by
the elaborator (Default: 5000).
xelab
-maxlogsize <arg>
Set the maximum size a log file can reach in MB. The
default setting is unlimited.
xsim Executable
Options
-mindelay
Compile Verilog design units with minimum delays. xelab
-mt <arg>
Specifies the number of sub-compilation jobs which
can be run in parallel. Possible values are auto, off, or
an integer greater than 1.
If auto is specified, xelab selects the number of
parallel jobs based on the number of CPUs on the host
machine. (Default = auto.)
Advanced usage: to further control the -mt option, you
can set the Tcl property as follows:
set_property XELAB.MT_LEVEL off|N
[get_filesets sim_1]
xelab
-nolog
Suppress log file generation. xelab
xsim Executable
Syntax
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
-noieeewarnings
Disable warnings from VHDL IEEE functions. xelab
-noname_unnamed_generate
Do not generate name for an unnamed generate block. xelab
Parsing Design Files,
xvhdl and xvlog
-notimingchecks
Ignore timing check constructs in Verilog specify
block(s).
xelab
-nosdfinterconnectdelays
Ignore SDF port and interconnect delay constructs in
SDF.
xelab
-nospecify
Ignore Verilog path delays and timing checks. xelab
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 151
Table 15: xelab, xvhd, and xvlog Command Options (cont'd)
Command Option Description
Used by
Command
-O <arg>
Enable or disable optimizations.
-O 0 = Disable optimizations
-O 1 = Enable basic optimizations
-O 2 = Enable most commonly desired
optimizations (Default)
-O 3 = Enable advanced optimizations
Note: A lower value speeds compilation at expense of
slower simulation: a higher value slows compilation but
simulation runs faster.
xelab
-override_timeunit
Override timeunit for all Verilog modules, with the
specified time unit in -timescale option.
xelab
-override_timeprecision
Override time precision for all Verilog modules, with
the specified time precision in -timescale option.
xelab
-pulse_e <arg>
Path pulse error limit as percentage of path delay.
Allowed values are 0 to 100 (Default is 100).
xelab
-pulse_r <arg>
Path pulse reject limit as percentage of path delay.
Allowed values are 0 to 100 (Default is 100).
xelab
-pulse_int_e arg
Interconnect pulse reject limit as percentage of delay.
Allowed values are 0 to 100 (Default is 100).
xelab
-pulse_int_r <arg>
Interconnect pulse reject limit as percentage of delay.
Allowed values are 0 to 100 (Default is 100).
xelab
-pulse_e_style <arg>
Specify when error about pulse being shorter than
module path delay should be handled. Choices are:
ondetect: Report error right when violation is
detected.
onevent: Report error after the module path delay.
Default: onevent
xelab
-prj <filename>
Specify the Vivado simulator project file containing one
or more entries of vhdl|verilog <work lib> <HDL
file name>.
xelab
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
-r [-run]
Run the generated executable snapshot in command-
line interactive mode.
xelab
-rangecheck
Enable run time value range check for VHDL. xelab
-R [-runall]
Run the generated executable snapshot until the end
of simulation.
xelab
xsim Executable
Syntax
-relax
Relax strict language rules. xelab
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 152
Table 15: xelab, xvhd, and xvlog Command Options (cont'd)
Command Option Description
Used by
Command
-s [-snapshot] <arg>
Specify the name of output simulation snapshot.
Default is <worklib>.<unit>; for example:
work.top. Additional unit names are concatenated
using #; for example: work.t1#work.t2.
xelab
-sdfnowarn
Do not emit SDF warnings. xelab
-sdfnoerror
Treat errors found in SDF file as warning. xelab
-sdfmin <arg>
<root>=<file> SDF annotate <file> at <root> with
minimum delay.
xelab
-sdftyp <arg>
<root>=<file> SDF annotate <file> at <root> with
typical delay.
xelab
-sdfmax <arg>
<root>=<file> SDF annotate <file> at <root> with
maximum delay.
xelab
-sdfroot <root_path>
Default design hierarchy at which SDF annotation is
applied.
xelab
-sourcelibdir
<sourcelib_dirname>
Directory for Verilog source files of uncompiled
modules.
Use -sourcelibdir <sourcelib_dirname> for each
source directory.
xelab
Parsing Design Files,
xvhdl and xvlog
-sourcelibext <file_extension>
File extension for Verilog source files of uncompiled
modules.
Use -sourcelibext <file extension> for source
file extension.
xelab
Parsing Design Files,
xvhdl and xvlog
-sourcelibfile <filename>
File name of a Verilog source file with uncompiled
modules.
xelab
Parsing Design Files,
xvhdl and xvlog
-stat
Print tool CPU and memory usages, and design
statistics.
xelab
-sv
Compile input files in SystemVerilog mode. Parsing Design Files,
xvhdl and xvlog
-timescale
Specify default timescale for Verilog modules. Default:
1ns/1ps.
xelab
-timeprecision_vhdl <arg>
Specify time precision for vhdl designs. Default: 1ps. xelab
-transport_int_delays
Use transport model for interconnect delays. xelab
-typdelay
Compile Verilog design units with typical delays
(Default).
xelab
-v [verbose] [0|1|2]
Specify verbosity level for printing messages. Default =
0.
xelab
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
-version
Print the compiler version to screen. xelab
xsim Executable
Options
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 153
Table 15: xelab, xvhd, and xvlog Command Options (cont'd)
Command Option Description
Used by
Command
-work <library_name>
[=<library_dir>]
Specify the work library. The format of the argument is
<name>[=<dir>] where:
<name> is the logical name of the library.
<library_dir> is an optional physical directory of
the library.
Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
-sv_root <arg>
Root directory of which DPI libraries are to be found.
Default: <current_directory/xsim.dir/xsc>
xelab
--sc_lib arg
Shared library name for SystemC functions; (.dll/.so)
without the file extension
xelab
--sc_root <arg>
Root directory of which SystemC libraries are to be
found. Default: <current_directory>/xsim.dir/
work/xsc
xelab
-sv_lib <arg>
Shared library name for DPI imported functions
(.dll/.so) without the file extension.
xelab
-sv_liblist <arg>
Bootstrap file pointing to DPI shared libraries. xelab
-dpiheader <arg>
Header filename for the exported and imported
functions.
xelab
-driver_display_limit <arg>
Enable driver debugging for signals with maximum size
(Default: n = 65536).
xelab
-dpi_absolute
Use absolute paths instead of LD_LIBRARY_PATH on
Linux for DPI libraries that are formatted as
lib<libname>.so.
xelab
-incr
Enable incremental analysis/elaboration in simulation. Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
xelab
-93_mode
Compile VHDL in pure 93 mode. Parsing Design Files,
xvhdl and xvlog
xelab
-2008
Compile VHDL file in 2008 mode. Parsing Design Files,
xvhdl and xvlog
-nosignalhandlers
Don't allow compiler to trap Antivirus, firewall signal. Parsing Design Files,
xvhdl and xvlog
Parsing Design Files,
xvhdl and xvlog
xelab
-dpi_stacksize <arg>
User defined stack size for DPI task. xelab
-transform_timing_checkers
Transform timing checker to Verilog process. xelab
-a
Generate a standalone non-interactive simulation
executable that performs run-all.
Always use with -R.
To run the simulation faster without any debug
capability, use -standalone with -R. It will invoke the
Simulation standalone without invoking Vivado IDE.
This option will save the license loading time.
xelab
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 154
Table 15: xelab, xvhd, and xvlog Command Options (cont'd)
Command Option Description
Used by
Command
-ignore_assertions
Ignore SystemVerilog concurrent assertions. xelab
-ignore_coverage
Ignore SystemVerilog functional coverage. xelab
-cov_db_dir <arg>
Functional coverage database dump directory. The
coverage data is present under <arg>/xsim.covdb/
<cov_db_name> directory. Default is ./.
xelab
-cov_db_name <arg>
Functional coverage database name. The coverage data
is present under <cov_db_dir>/xsim.covdb/<arg>
directory. Default is a snapshot name.
xelab
-uvm_version <arg>
Specify UVM version (default 1.2). Parsing Design Files,
xvhdl and xvlogxelab
-report_assertion_pass
Report SystemVerilog Concurrent Assertions Pass, even
if there is no pass action block.
xelab
-dup_entity_as_module
Enable support for hierarchical references inside the
Verilog hierarchy in mixed language designs.
CAUTION! This may cause significant slow down of
compilation.
xelab
-cc_celldefines
Specify if code coverage information needs to be
captured for libs/modules with cell define attribute set.
OFF by default.
xelab
-cc_libs
Specify if code coverage information needs to be
captured for all the libraries specified. OFF by default.
xelab
-cc_type arg
Specify options for generating Code Coverage Statistics
-bcesfxt. (s)Statement Coverage, (b)Branch Coverage,
(c)Condition Coverage Supported.
xelab
-cc_db arg
Code coverage database will be saved inside
<cc_dir_argvalue>/xsim.codecov/<cc_db_argvalue>.
Default is SnapshotName.
xelab
-cc_dir arg
Code coverage database will be saved under the dir
<cc_dir_argvalue>/xsim.codeCov/<cc_db_argvalue>.
Default is ./xsim.codecov/.
xelab
-ignore_localparam_override
Ignore localparam override xelab
Simulating the Design Snapshot, xsim
The xsim command loads a simulaon snapshot to eect a batch mode simulaon or provides a
workspace (GUI) and/or a Tcl-based interacve simulaon environment.
xsim Executable Syntax
The command syntax is as follows:
xsim <options> <snapshot>
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 155
Where:
xsim is the command.
<options> are the opons specied in the following table.
<snapshot> is the simulaon snapshot.
xsim Executable Options
Table 16: xsim Executable Command Options
xsim Option Description
-f [-file] <filename>
Load the command line options from a file.
-g [-gui]
Run with interactive workspace.
-h [-help]
Print help message to screen.
-log <filename>
Specify the log file name.
-maxdeltaid arg (=-1)
Specify the maximum delta number. Report an error if it exceeds maximum
simulation loops at the same time.
-maxlogsize arg (=-1)
Set the maximum size a log file can reach in MB. The default setting is unlimited.
-ieeewarnings
Enable warnings from VHDL IEEE functions.
-nolog
Suppresses log file generation.
-nosignalhandlers
Disables the installation of OS-level signal handlers in the simulation. For
performance reasons, the simulator does not check explicitly for certain conditions,
such as an integer division by zero, that could generate an OS-level fatal run time
error. Instead, the simulator installs signal handlers to catch those errors and
generates a report.
With the signal handlers disabled, the simulator can run in the presence of such
security software, but OS-level fatal errors could crash the simulation abruptly with
little indication of the nature of the failure.
CAUTION! Use this option only if your security software prevents the simulator
from running successfully.
-onfinish <quit|stop>
Specify the behavior at end of simulation.
-onerror <quit|stop>
Specify the behavior upon simulation run time error.
-R [-runall]
Runs simulation till end (such as do 'run all;quit').
-stats
Display memory and CPU stats upon exiting.
-testplusarg <arg>
Specify plusargs to be used by $test$plusargs and $value$plusargs system
functions.
-t [-tclbatch] <filename>
Specify the Tcl file for batch mode execution.
-tp
Enable printing to screen of hierarchical names of process being executed.
-tl
Enable printing to screen of file name and line number of statements being
executed.
-wdb <filename.wdb>
Specify the waveform database output file.
-version
Print the compiler version to screen.
-view <wavefile.wcfg>
Open a wave configuration file. Use this switch together with -gui switch.
-protoinst
Specify a .protoinst file for protocol analysis.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 156
Table 16: xsim Executable Command Options (cont'd)
xsim Option Description
-sv_seed
Seed for SystemVerilog constraint random.
-cov_db_dir
Functional coverage database dump directory. The coverage data is present under
<arg>/xsim.covdb/<cov_db_name> directory. Default is ./ or inherits the value set in
xelab.
-cov_db_name
Functional coverage database name. The coverage data will be present under
<cov_db_dir>/xsim.covdb/<arg> directory. Default is snapshot name or inherits the
value set in xelab.
-downgrade_error2info
Downgrade the severity level of the HDL messages from Error to Info.
-downgrade_error2warning
Downgrade the severity level of the HDL messages from Error to Warning.
-downgrade_fatal2info
Downgrade the severity level of the HDL messages from Fatal to Info.
-downgrade_fatal2warning
Downgrade the severity level of the HDL messages from Fatal to Warning.
-downgrade_severity
Downgrade the severity level of the HDL messages. Following are the choices:
error2warning
error2info
fatal2warning
fatal2info
-ignore_assertions
Ignore SystemVerilog concurrent assertions.
-ignore_coverage
Ignore SystemVerilog functional coverage.
-ignore_feature
Ignore the effect of a specific HDL feature or construct. Following are the choices:
assertion
coverage
-tempDir
Specify the temporary directory name.
-autoloadwcfg
Load already saved waveform configuration file.
TIP: When running the
xelab
,
xsc
,
xsim
,
xvhdl
,
xcrg
, or
xvlog
commands in batch les or scripts,
it might also be necessary to dene the XILINX_VIVADO environment variable to point to the installaon
hierarchy of the Vivado Design Suite. To set the XILINX_VIVADO variable, add one of the following to your
script or batch le:
On Windows: set XILINX_VIVADO=<vivado_install_area>/Vivado/<version>
On Linux: setenv XILINX_VIVADO vivado_install_area>/Vivado/<version>
Where <version> is the version of Vivado tools you are using: 2014.3, 2014.4, 2015.1, etc
Functional Coverage Report Generator
Vivado simulator provides a ulity using which you can generate the funconal coverage report
either in text or html format. The Xilinx Coverage Report Generator (XCRG) can also be used for
merging mulple coverage databases into a single database.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 157
Table 17: xcrg Command Options and Description
xcrg Option Description
-db_name arg
Name of the database inside xsim.covdb. If unspecified all databases present in the
directory are used.
-dir arg
Path where the xsim.covdb database directory is located. Default is ./xsim.covdb.
-file arg
Specify file with location of the coverage databases to be restored.
-h
Print help message and exit.
-help
Print help message and exit.
-merge_db_name arg
Name of the merged database. Default is xcrg_mdb.
-merge_dir arg
Directory where the merged database is saved. Default is ./xsim.covdb.
-nolog
Suppresses the log file generation.
-report_dir arg
Directory where the coverage database and the report are saved. Default is ./
xcrg_report.
-report_format arg
Specify the desired format of the coverage report html or text or all. Default is html.
-log arg
Specify the file name which has the log saved. Default is xcrg.log.
-version
Print the version of XCRG and exit.
-cc_db <arg>
Specify the DB Name (Snapshot Name) which is used to save the code coverage
database. Code coverage database can be restored from <cc_dir_argvalue>/
xsim.codeCov/<cc_db_argvalue>.
-cc_dir <arg>
Specify the directory where the code coverage information database is saved. Code
coverage database can be restored from <cc_dir_argvalue>/xsim.codeCov/
<cc_db_argvalue>. Default is ./xsim.CodeCov/.
-cc_fullfile
Show the entire file in the code coverage report. By default this is OFF for files more
than 50000 lines and only the file's module contents are shown.
-cc_report <arg>
Directory where the code coverage HTML report is saved. Default is
xcrg_code_cov_report.
-merge_cc
Merge the code coverage databases specified and create a output merged code
coverage database.
-cc_instancescount <arg>
Specify the maximum number of instances shown in the code coverage report. Default
is 100.
xcrg Example Syntax
xcrg -h
xcrg -file /path/to/file
xcrg -file /path/to/file -db_name work.top
xcrg -dir /path/to/abc
xcrg -dir ./abc -report_dir def -report_format html
xcrg -dir ./abc -db_name work.top -report_dir def -report_format html
xcrg -dir /path/to/abc -db_name work.top -report_dir def -report_format text
xcrg -merge_dir m
xcrg -merge_db_name xyz -report_dir def
xcrg -report_format html -nolog
xcrg -report_format html -log xcrgOutput.log
xcrg -cc_db a1 -cc_dir ./
xcrg -cc_report abc -cc_db work.testbench -cc_dir ./xsim.codeCov/
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 158
Example of Running Vivado Simulator in
Standalone Mode
When running the Vivado simulator in standalone mode, you can execute commands to:
Analyze the design le
Elaborate the design and create a snapshot
Open the Vivado simulator workspace and wave conguraon le(s) and run simulaon
Step 1: Analyzing the Design File
To begin, analyze your HDL source les by type, as shown in the table below. Each command can
take mulple les.
Table 18: File Types and Associated Commands for Design File Analysis
File Type Command
Verilog
xvlog <VerilogFileName(s)>
SystemVerilog
xvlog -sv <SystemVerlilogFileName(s)>
VHDL
xvhdl <VhdlFileName(s)>
Step 2: Elaborating and Creating a Snapshot
Aer analysis, elaborate the design and create a snapshot for simulaon using the xelab
command:
xelab <topDesignUnitName> -debug typical
IMPORTANT!
You can provide mulple top-level design unit names with
xelab
. To use the Vivado
simulator workspace for purposes similar to those used during
launch_simulation
, you must set
debug level to
typical
.
Step 3: Running Simulation
Aer successful compleon of the xelab phase, the Vivado simulator creates a snapshot used
for running simulaon.
To invoke the Vivado simulator workspace, use the following command:
xsim <SnapShotName> -gui
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 159
To open the wave cong le:
xsim <SnapShotName> -view <wcfg FileName> -gui
You can provide mulple wcfg les using mulple -view ags. For example:
xsim <SnapShotName> -view <wcfg FileName> -view <wcfg FileName>
Project File (.prj) Syntax
Note: The project le discussed here is a Vivado simulator text-based project le. It is not the same as the
project le (.xpr) created by the Vivado Design Suite.
To parse design les using a project le, create a text le called <proj_name>.prj, and use the
syntax shown below inside the project le.
verilog <work_library> <file_names>... [-d <macro>]...[-i
<include_path>]...
vhdl <work_library> <file_name>
sv <work_library> <file_name>
vhdl2008 <work_library> <file_name>
Where:
<work_library>: Is the library into which the HDL les on the given line are to be compiled.
<file_names>: Are Verilog source les. You can specify mulple Verilog les per line.
<file_name>: Is a VHDL source le; specify only one VHDL le per line.
1. For Verilog or SystemVerilog: [-d <macro>] provides you the opon to dene one or more
macros.
2. For Verilog or SystemVerilog: [-i <include_path>] provides you the opon to dene
one or more <include_path> directories.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 160
Predefined Macros
XILINX_SIMULATOR is a Verilog predened-macro. The value of this macro is 1. Predened
macros perform tool-specic funcons, or idenfy which tool to use in a design ow. The
following is an example usage:
`ifdef VCS
// VCS specific code
`endif
`ifdef INCA
// NCSIM specific code
`endif
`ifdef MODEL_TECH
// MODELSIM specific code
`endif
`ifdef XILINX_ISIM
// ISE Simulator (ISim) specific code
`endif
`ifdef XILINX_SIMULATOR
// Vivado Simulator (XSim) specific code
`endif
`ifdef _VCP
//Aldec specific code
`endif
Library Mapping File (xsim.ini)
The HDL compile programs, xvhdl, xvlog, and xelab, use the xsim.ini conguraon le to
nd the denions and physical locaons of VHDL and Verilog logical libraries.
The compilers aempt to read xsim.ini from these locaons in the following order:
1. xsim.ini in current working directory
2. User-le specied through the -initfile switch. If -initfile is not specied, the
program searches for xsim.ini in the current working directory.
3. <Vivado_Install_Dir>/data/xsim
The xsim.ini le has the following syntax:
<logical_library1> = <physical_dir_path1>
<logical_library2> = <physical_dir_path2>
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 161
The following is an example xsim.ini le:
std=<Vivado_Install_Area>/xsim/vhdl/std
ieee=<Vivado_Install_Area>/xsim/vhdl/ieee
vl=<Vivado_Install_Area>/xsim/vhdl/vl
ieee_proposed=$RDI_DATADIR/xsim/vhdl/ieee_proposed
synopsys=<Vivado_Install_Area>/xsim/vhdl/synopsys
uvm=<Vivado_Install_Area>/xsim/system_verilog/uvm
unisim=<Vivado_Install_Area>/xsim/vhdl/unisim
unimacro=<Vivado_Install_Area>/xsim/vhdl/unimacro
unifast=<Vivado_Install_Area>/xsim/vhdl/unifast
simprims_ver=<Vivado_Install_Area>/xsim/verilog/simprims_ver
unisims_ver=<Vivado_Install_Area>/xsim/verilog/unisims_ver
unimacro_ver=<Vivado_Install_Area>/xsim/verilog/unimacro_ver
unifast_ver=<Vivado_Install_Area>/xsim/verilog/unifast_ver
secureip=<Vivado_Install_Area>/xsim/verilog/secureip
work=./work
The xsim.ini le has the following features and limitaons:
There must be no more than one library path per line inside the xsim.ini le.
If the directory corresponding to the physical path does not exist, xvhd or xvlog creates it
when the compiler rst tries to write to that path.
You can describe the physical path in terms of environment variables. The environment
variable must start with the $ character.
The default physical directory for a logical library is xsim/<language>/
<logical_library_name>, for example, a logical library name of:
<Vivado_Install_Area>/xsim/vhdl/unisim
File comments must start with --.
Note: From 2018.2 release onwards, Xilinx provides two init les named as xsim.ini and
xsim_legacy.ini. The xsim_legacy.ini le is similar to xsim.ini of older version. It contains
mapping for UNISIM library while the new xsim.ini le contains mapping for all the les of UNISIM
library along with the mapping for pre-compiled IP.
Running Simulation Modes
You can run any mode of simulaon from the command line. The following subsecons illustrate
and describe the simulaon modes when run from the command line.
Behavioral Simulation
The following gure illustrates the behavioral simulaon process:
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 162
Figure 51: Behavioral Simulation Process
Gather Files
Parse Using XVLOG/XVHDL
Compile and Elaborate Using
XELAB (Create Snapshot)
Debug on Waveform
Execute Using
XSIM <snapshot>
X23705-021420
To run behavioral simulaon from within the Vivado Design Suite, use the Tcl command:
launch_simulation -mode behavioral.
Running Post-Synthesis and Post-Implementation
Simulations
At post-synthesis and post-implementaon, you can run a funconal or a Verilog ming
simulaon. The following gure illustrates the post-synthesis and post-implementaon
simulaon process:
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 163
Figure 52: Post-Synthesis and Post-Implementation Simulation
Run Synthesis or Implementation
Parse Using xvlog/xvhdl
Simulation Using
xsim <snapshot>
Create Netlist
write_verilog or write_vhdl
Post-Synthesis
Post-Implementation
Simulation
Gather Files
(Create Project File )
Compile and Elaborate
Using xelab
Debug in Waveform
Or Self-checking Test Bench
X12985
For Timing Simulation
write_sdf
The following is an example of running a post-synthesis funconal simulaon from the command
line:
synth_design -top top -part xc7k70tfbg676-2
open_run synth_1 -name netlist_1
write_verilog -mode funcsim test_synth.v
launch_simulation
TIP:
When you run a post-synthesis or post-implementaon ming simulaon, you must run the
write_sdf
command aer the
write_verilog
command, and the appropriate annotate command
is needed for elaboraon and simulaon.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 164
Using Tcl Commands and Scripts
You can run Tcl commands on the Tcl Console individually, or batch the commands into a Tcl
script to run simulaon.
Using a -tclbatch File
You can type simulaon commands into a Tcl le, and reference the Tcl le with the following
command: -tclbatch <filename>
Use the -tclbatch opon to contain commands within a le and execute those command as
simulaon starts. For example, you can have a le named run.tcl that contains the following:
run 20ns
id="ag415279">current_time
quit
Then launch simulaon as follows:
xsim <snapshot> -tclbatch run.tcl
You can set a variable to represent a simulaon command to quickly run frequently used
simulaon commands.
Launching Vivado Simulator from the Tcl Console
The following is an example of Tcl commands that create a project, read in source les, launch the
Vivado simulator, do placing and roung, write out an SDF le, and re-launch simulaon.
Vivado -mode Tcl
Vivado% create_project prj1
Vivado% read_verilog dut.v
Vivado% synth_design -top dut
Vivado% launch_simulation -simset sim_1 -mode post-synthesis -type
functional
Vivado% place_design
Vivado% route_design
Vivado% write_verilog -mode timesim -sdf_anno true -sdf_file postRoute.sdf
postRoute_netlist.v
Vivado% write_sdf postRoute.sdf
Vivado% launch_simulation -simset sim_1 -mode post-implementation -type
timing
Vivado% close_project
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 165
export_simulation
Export a simulaon script le for the target simulator. The generated script will contain simulator
commands for compiling, elaborang and simulang the design.
This command will retrieve the simulaon compile order of specied objects, and export this
informaon in a shell script with the compiler commands and default opons for the target
simulator. The specied object can be either a simulaon leset or an IP. If you want to run
simulaon outside Vivado IDE, export_simulation can be used in place of
launch_simulation -scripts_only to generate scripts le.
export_simulation [-simulator <arg>] [-of_objects <arg>]
[-ip_user_files_dir <arg>] [-ipstatic_source_dir <arg>]
[-lib_map_path <arg>] [-script_name <arg>]
[-directory <arg>] [-runtime <arg>] [-define <arg>]
[-generic <arg>] [-include <arg>] [-use_ip_compiled_libs]
[-absolute_path] [-export_source_files]
[-generate_hier_access] [-32bit] [-force] [-quiet]
[-verbose][-gcc_install_path <arg>] [-more_options <arg>]
Usage
Table 19: export_simulation Options
Name Description
[-simulator]
Simulator for which the simulation script will be created. Allowed values are all,
xsim, modelsim, questa, vcs, xcelium, riviera, and activehdl.
Default: all
[-of_objects]
Export simulation script for the specified object.
Default: None
[-lib_map_path]
Precompiled simulation library directory path. If not specified, follow the
instructions in the generated script header to manually provide the simulation
library mapping information.
Default: Empty
[-script_name]
Output shell script filename. If not specified, then file with a default name will be
created.
Default: top_module.sh
[-directory]
Directory where the simulation script will be generated.
Default: export_sim
[-runtime]
Run simulation for this time.
Default: full simulation run or until a logical break or finish condition
[-absolute_path]
Make all file paths absolute with respect to the reference directory.
[-export_source_files]
Copy IP/BD design files to output directory.
[-32bit]
Perform 32-bit compilation.
[-force]
Overwrite previous files.
[-quiet]
Ignore command errors.
[-verbose]
Suspend message limits during command execution.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 166
Table 19: export_simulation Options (cont'd)
Name Description
[-ip_user_files_dir]
Directory path to exported IP/BD user files (for static, dynamic and data files).
Default: Empty
[-ipstatic_source_dir]
Directory path to the exported IP/BD static files.
Default: Empty
[-define]
Read Verilog defines from the list specified with this switch.
Default: Empty
[-generic]
Read VHDL generics from the list specified with this switch.
Default: Empty
[-include]
Read include directory paths from the list specified with this switch.
Default: Empty
[-use_ip_compiled_libs]
Reference pre-compiled IP static library during compilation. This switch requires -
ip_user_files_dir and -ipstatic_source_dir switches also for generating
scripts using pre-compiled IP library.
[-generate_hier_access]
Extract path for hierarchical access simulation
[-gcc_install_path]
GNU compiler installation directory path for the g++/gcc executables.
Default: Empty
[-more_options]
Pass specified options to the simulator tool.
Default: Empty
Description
Export a simulaon script le for the target simulator (please see the list of supported simulators
below). The generated script will contain simulator commands for compiling, elaborang and
simulang the design.
The command will retrieve the simulaon compile order of specied objects, and export this
informaon in a shell script with the compiler commands and default opons for the target
simulator. The specied object can be either a simulaon leset, IP or a BD (block design).
If the object is not specied, then this command will generate the script for the acve simulaon
top. Any Verilog include directories or le paths for the les containing Verilog dene
statements will be added to the compiler command line.
By default, the design source le and include directory paths in the compiler command line will
be set relave to the reference_dir variable that is set in the generated script. To make these
paths absolute, specify the -absolute_path switch.
The command will also copy data les (if any) from the leset, or from an IP, to the output
directory. If the design contains Verilog sources, then the generated script will also copy the
glbl.v le from the soware installaon path to the output directory.
A default .do le that is used in the compiler commands in the simulaon script for the target
simulator, will be wrien to the output directory.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 167
Note: In order to perform simulaon with the generated script, the simulaon libraries must be compiled
rst using the compile_simlib Tcl command. The compiled library directory path must be specied
when generang this script. The generated script will automacally include the setup les for the target
simulator from the compiled library directory.
Supported Simulators
Vivado simulator (xsim)
ModelSim Simulator (modelsim)
Questa Advanced Simulator (questa)
Verilog Compiler Simulator (vcs)
Riviera-PRO Simulator (riviera)
Acve-HDL Simulator (acvehdl)
Cadence Xcelium Parallel Simulator (xcelium)
Arguments
-of_objects: (Oponal) Specify the target object for which the simulaon script le needs
to be generated. The target object can be either a simulaon leset (simset) or an IP. If this
opon is not specied then this command will generate le for the current simulaon leset.
-lib_map_path: (Oponal) Specify path to the Xilinx pre-compiled simulaon library for the
selected simulator. The simulaon library is compiled using compile_simlib. See the
header secon in the generated script for more informaon. If this switch is not specied,
then the generated script will not reference the pre-compiled simulaon library and the stac
IP les will be locally compiled.
-script_name: (Oponal) Specify name of the generated script. Default name is
<simulation_top>.sh. If the -of_objects switch is specied, then the default syntax of the
script will be as follows:
-of_objects [current_fileset -simset] .sh
-of_objects [get_ips ] .sh
-of_objects [get_files .xci] .sh
-of_objects [get_files .bd] .sh
-absolute_path: (Oponal) Specify this opon to make source and include directory paths
absolute. By default, all paths are set relave to the output directory specied with the -
directory switch.
-32bit: (Oponal) Specify this opon to perform 32-bit simulaon. If this opon is not
specied then by default 64-bit opon will be added to the simulaon command line.
-force: (Oponal) Overwrite an exisng script le of the same name. If the script le already
exists, the tool returns an error unless the -force argument is specied.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 168
-directory: (Required) Specify the directory path where the script le will be exported.
-simulator: (Required) Specify the target simulator name for the simulaon script. The valid
simulators names are xsim, modelsim, questa, and vcs (or vcs_mx).
-quiet: (Oponal) Execute the command quietly, ignoring any command line errors and
returning no messages. The command also returns TCL_OK regardless of any errors
encountered during execuon.
-verbose: (Oponal) Temporarily override any message limits and return all messages from
this command.
-generate_hier_access: (Oponal) Extract path for hierarchical access simulaon.
-runtime: (Oponal) Specify simulaon run-me.
-define: (Oponal) Specify the list of verilog denes used in the design.
-generic: (Oponal) Specify the list of VHDL generics used in the design.
-include: (Oponal) Specify the list of include directory paths for verilog include les in the
design.
-export_source_files: (Oponal) Specify this opon to copy the IP design les to the
generated script directory in a sub-directory named srcs. The generated script will reference
the design les from this srcs directory.
export_ip_user_files
Generate and export IP/IP integrator user les from a project. This can be scoped to work on one
or more IPs.
Syntax
export_ip_user_files [-of_objects <arg>] [-ip_user_files_dir <arg>]
[-ipstatic_source_dir <arg>] [-lib_map_path <arg>]
[-no_script] [-sync] [-reset] [-force] [-quiet]
[-verbose]
Returns: List of les that were exported.
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 169
Usage
Table 20: export_ip_user_files
Name Description
[-of_objects]
IP, IP integrator or a fileset.
Default: None
[-ip_user_files_dir]
Directory path to simulation base directory (for static, dynamic, wrapper, netlist,
script, and MEM files).
Default: None
[-ipstatic_source_dir]
Directory path to the static IP files.
Default: None
[-lib_map_path]
Compiled simulation library directory path.
Default: Empty
[-no_script]
Do not export simulation scripts.
Default: 1
[-sync]
Delete IP/IP integrator dynamic and simulation script files.
[-reset]
Delete all IP/IP integrator static, dynamic and simulation script files.
[-force]
Overwrite files.
[-quiet]
Ignore command errors.
[-verbose]
Suspend message limits during command execution.
Description
Export IP user les repository with stac, dynamic, netlist, Verilog/VHDL stubs and memory
inializaon les.
Arguments
-of_objects: (Oponal) Specify the target object for which the IP stac and dynamic les
needs to be exported.
-ip_user_files_dir: (Oponal) Directory path to IP user les base directory (for dynamic
and other IP non stac les). By default, if this switch is not specied then this command will
use the path specied with the IP.USER_FILES_DIR project property value.
-ipstatic_source_dir: (Oponal) Directory path to the stac IP les. By default, if this
switch is not specied then this command will use the path specied with the
SIM.IPSTATIC_SOURCE_DIR project property value.
Note: If the -ip_user_files_dir switch is specied, by default the IP stac les will be exported
under the sub-directory with the name ipstatic. If this switch is specied with -
ipstatic_source_dir, then the IP stac les will be exported in the path specied with the -
ipstatic_source_dir switch.
-clean_dir: (Oponal) Delete all les from central directory (including stac, dynamic and
other les)
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 170
Examples
The following command will export char_fifo IP dynamic les to <project>/
<project>.ip_user_files/ip/char_fifo directory and char_fifo IP stac les to
<project>/<project>.ip_user_files/ipstatic directory:
% export_ip_user_files -of_objects [get_ips char_fifo]
Chapter 7: Simulating in Batch or Scripted Mode in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 171
Appendix A
Compilation, Elaboration,
Simulation, Netlist, and Advanced
Options
From the Vivado IDE Flow Navigator, you can right-click Simulaon, and select Simulaon
Sengs to open the simulaon sengs in the Sengs dialog box. From the Simulaon sengs,
you can set various compilaon, elaboraon, simulaon, netlist, and advanced opons.
Compilation Options
The Compilaon tab denes and manages compiler direcves, which are stored as properes on
the simulaon leset and used by the xvlog and xvhdl ulies to compile Verilog and VHDL
source les for simulaon.
Vivado Simulator Compilation Options
Table 21: Vivado Simulator Compilation Options
Option Description
Verilog options Browse to set Verilog include path and to define macro
Generics/Parameters options Specify or browse to set the generic/parameter value
xsim.compile.tcl.pre
Tcl file containing set of commands that should be invoked before launch of
compilation
xsim.compile.xvlog.nosort
Do not sort Verilog file during compilation
xsim.compile.xvhdl.nosort
Do not sort VHDL file during compilation
xsim.compile.xvlog.relax
Relax strict Verilog and SystemVerilog language checking rules
xsim.compile.xvhdl.relax
Relax strict VHDL language checking rules
xsim.compile.xvlog.more_options
More XVLOG compilation options
xsim.compile.xvhdl.more_options
More XVHDL compilation options
xsim.compile.xsc.more_options
More XSC compilation options
Appendix A: Compilation, Elaboration, Simulation, Netlist, and Advanced Options
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 172
Questa Advanced Simulator Compilation Options
Table 22: Questa Advanced Simulator Compilation Options
Option Description
Verilog options Browse to set Verilog include path and to define macro
Generics/Parameters options Specify or browse to set the generic/parameter value
questasim.compile.tcl.pre TCL file containing set of commands that should be invoked before
launch of compilation
questasim.compile.vhdl_syntax Specify VHDL syntax
questasim.compile.use_explicit_decl Log all signals
questasim.compile.load_glbl Load GLBL module
questasim.compile.vlog.more_options More VLOG compilation options
questasim.compile.vcom.more_options More VCOM compilation options
questasim.compile.sccom.cores Specify the number of process cores to run in parallel
questasim.compile.sccom.more_options More SCCOM compilation options
ModelSim Simulator Compilation Options
Table 23: ModelSim Compilation Options
Option Description
Verilog options Browse to set Verilog include path and to define macro
Generics/Parameters options Specify or browse to set the generic/parameter value
modelsim.compile.tcl.pre TCL file containing set of commands that should be invoked before launch
of compilation
modelsim.compile.vhdl_syntax Specify VHDL syntax
modelsim.compile.use_explicit_decl Log all signals
modelsim.compile.load_glbl Load GLBL module
modelsim.compile.vlog.more_options More VLOG compilation options
modelsim.compile.vcom.more_options More VCOM compilation options
VCS Simulator Compilation Options
Table 24: VCS Simulator Compilation Options
Option Description
Verilog options Browse to set the Verilog include path and to define macro
Generics/Parameters options Specify or browse to set the generic/parameter values
vcs.compile.tcl.pre TCL file containing set of commands that should be invoked before launch of
compilation
vcs.compile.load_glbl Load GLBL module
vcs.compile.vhdlan.more_options More VHDLAN compilation options
Appendix A: Compilation, Elaboration, Simulation, Netlist, and Advanced Options
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 173
Table 24: VCS Simulator Compilation Options (cont'd)
Option Description
vcs.compile.vlogan.more_options Extra VLOGAN compilation options
vcs.compile.syscan.more_options More SYSCAN compilation options
vcs.compile.g++.more_options More G++ compilation options
vcs.compile.gcc.more_options More GCC compilation options
Xcelium Simulator Compilation Options
Table 25: Xcelium Compilation Options
Options Description
Verilog Options Browse to set Verilog include path and to define macro
Generics/Parameters options Specify or browse to set the generic/parameter value
xcelium.compile.tcl.pre TCL file containing set of commands that should be invoked before the
launch of a compilation
xcelium.compile.v93 Enable VHDL-93 features
xcelium.compile.relax Enable relaxed VHDL interpretation
xcelium.compile.load_glbl Load GLBL module
xcelium.compile.xmvhdl.more_options More XMVHDL compilation options
xcelium.compile.xmvlog.more_options More XMVLOG compilation options
xcelium.compile.xmsc.more_option More XMSC compilation option
xcelium.compile.g++.more_option More G++ compilation option
xcelium.compile.gcc.more_option More GCC compilation option
Elaboration Options
The Elaboraon tab denes and manages elaboraon direcves, which are stored as properes
on the simulaon leset and used by the xelab ulity for elaborang and generang a simulaon
snapshot. Select a property in the table to display a descripon of the property and edit the
value.
Vivado Simulator Elaboration Options
Table 26:
Vivado Simulator Elaboration Options
Option Description
xsim.elaborate.snapshot Specifies the simulation snapshot name
xsim.elaborate.debug_level Choose simulation debug visibility level. By default it is "typical"
Appendix A: Compilation, Elaboration, Simulation, Netlist, and Advanced Options
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 174
Table 26: Vivado Simulator Elaboration Options (cont'd)
Option Description
xsim.elaborate.relax Relax strict HDL Language checking rules
xsim.elaborate.mt_level Specify number of sub-compilation jobs to run in parallel
xsim.elaborate.load_glbl Load GLBL module
xsim.elaborate.rangecheck Enables run time value range check for VHDL
xsim.elaborate.sdf_delay Specifies sdf timing delay type to be read for use in timing simulation
xsim.elaborate.xelab.more_option More XELAB elaboration options
xsim.elaborate.xsc.more_option More options for XSC during elaboration
xsim.elaborate.coverage.name Specify coverage database name
xsim.elaborate.coverage.dir Specify coverage database directory name
xsim.elaborate.coverage.type Specify coverage type(s) (line branch condition or all)
xsim.elaborate.coverage.library Track std/unisims/retarget libraries
xsim.elaborate.coverage.celldefine Track modules with celldefine attributes
xsim.elaborate.link.sysc Specify SystemC library to bind
xsim.elaborate.link.c Specify C/C++ library to bind
Questa Advanced Simulator Elaboration Options
Table 27: Questa Advanced Simulator Elaboration Options
Option Description
questasim.elaborate.acc Enables access to simulation objects that might be optimized by
default (default: npr)
questasim.elaborate.vopt.more_options More VOPT elaboration options
questasim.elaborate.sccom.more_options More options for sccom during elaboration
questasim.elaborate.link.sysc Specify SystemC library to bind
questasim.elaborate.link.c Specify C/C++ library to bind
ModelSim Simulator Elaboration Options
Table 28: ModelSim Elaboration Options
Option Description
modelsim.elaborate.acc Enables access to simulation objects that might be optimized by default
modelsim.elaborate.vopt.more_options More VOPT elaboration options
Appendix A: Compilation, Elaboration, Simulation, Netlist, and Advanced Options
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 175
VCS Simulator Elaboration Options
Table 29: VCS Elaboration Options
Option Description
vcs.elaborate.debug_pp Enable post-process debug access
vcs.elaborate.vcs.more_options More VCS elaboration options
vcs.elaborate.link.sysc Specify SystemC library to bind
vcs.elaborate.link.c Specify C/C++ library to bind
Xcelium Simulator Elaboration Options
Table 30: Xcelium Elaboration Options
Option Description
xcelium.elaborate.update Checks if unit is up-to-date before writing
xcelium.elaborate.xmelab.more_options More xmelab elaboration options
xcelium.elaborate.link.sysc Specify SystemC library to bind
xcelium.elaborate.link.c Specify C/C++ library to bind
Simulation Options
The Simulaon tab denes and manages simulaon direcves, which are stored as properes on
the simulaon leset and used by the xsim applicaon for simulang the current project. Select a
property in the table to display a descripon of the property and edit the value.
Vivado Simulator Simulation Options
Table 31: Vivado Simulator Simulation Options
Option Description
xsim.simulate.runtime Specifies simulation run time for the Vivado simulator. Enter blank to load just
the simulation snapshot and wait for user input.
xsim.simulate.tcl.post Tcl file containing set of commands that you want to invoke at end of simulation.
xsim.simulate.log_all_signals Logs all object signals
xsim.simulate.wdb Specifies simulation waveform database file
xsim.simulate.saif Specifies SAIF file name
xsim.simulate.saif_scope Specifies design hierarchy instance name for which power estimation is desired.
xsim.simulate.saif_all_signals Logs all object signals for the design under test for SAIF file generation
xsim.simulate.xsim.more_option More Vivado simulator simulation options
Appendix A: Compilation, Elaboration, Simulation, Netlist, and Advanced Options
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 176
Table 31: Vivado Simulator Simulation Options (cont'd)
Option Description
xsim.simulate.custom_tcl Specify the name of a custom tcl file which will be the source during simulation in
place of a regular Tcl file generated by Vivado
xsim.simulate.add_positional Add positional parameter to XSIM for passing command line argument
xsim.simulate.no_quit Do not quit simulation
Questa Advanced Simulator Simulation Options
Table 32: Questa Advanced Simulator Simulation Options
Option Description
questasim.simulate.runtime Specify simulation run time
questasim.simulate.tcl.post TCL file containing set of commands that you want to invoke at end of
simulation.
questasim.simulate.log_all_signals Log all signals
questasim.simulate.custom_do Specify the name of custom do file
questasim.simulate.custom_udo Specify the name of custom user do file
questa.simulate.ieee_warning Suppresses IEEE warnings
questasim.simulate.sdf_delay Specify the delay type for sdf annotation
questasim.simulate.saif Specify SAIF file
questasim.simulate.saif_scope Specify design hierarchy instance name for which power estimation is
desired
questasim.simulate.vsim.more_option More VSIM simulation options
questa.simulate.custom_wave_do Name of the custom wave.do file which is used in place of a regular Vivado
generated wave.do file
ModelSim Simulator Simulation Options
Table 33: ModelSim Simulation Options
Option Description
modelsim.simulate.runtime Specify simulation run time
modelsim.simulate.tcl.post TCL file containing set of commands that you want to invoke at end of
simulation.
modelsim.simulate.log_all_signals Log all signals
modelsim.simulate.custom_do Specify the name of custom do file
modelsim.simulate.custom_udo Specify the name of custom user do file
modelsim.simulate.sdf_delay Specify the delay type for sdf annotation
modelsim.simulate.ieee_warning Suppresses IEEE warnings
modelsim.simulate.saif Specify SAIF file
modelsim.simulate.saif_scope Specify design hierarchy instance name for which power estimation is
desired
Appendix A: Compilation, Elaboration, Simulation, Netlist, and Advanced Options
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 177
Table 33: ModelSim Simulation Options (cont'd)
Option Description
modelsim.simulate.vsim.more_option More VSIM simulation options
modelsim.simulate.custom_wave_do Name of the custom wave.do file which is used in place of a regular Vivado
generated wave.do file
VCS Simulator Simulation Options
Table 34: VCS Simulation Options
Option Description
vcs.simulate.runtime Specify simulation run time
vcs.simulate.tcl.post TCL file containing set of commands that you want to invoke at end of simulation.
vcs.simulate.log_all_signals Log all signals
vcs.simulate.saif SAIF file name
vcs.simulate.saif_scope Specify design hierarchy instance name for which power estimation is desired
vcs.simulate.vcs.more_option More VCS simulation options
Xcelium Simulator Simulation Options
Table 35: Xcelium Simulator Simulation Options
Option Description
xcelium.simulate.tcl.post TCL file containing set of commands that you want to invoke at end of
simulation
xcelium.simulate.runtime Specify simulation run time
xcelium.simulate.log_all_signals Log all signals
xcelium.simulate.update Check if unit is up-to-date before writing
xcelium.simulate.ieee_warnings Suppress IEEE warnings
xcelium.simulate.saif_scope SAIF file name
xcelium.simulate.saif Specify design hierarchy instance name for which power estimation is
desired
xcelium.simulate.xmsim.more_options More XMSIM simulation options
Netlist Options
The Netlist tab provides access to netlist conguraon opons related to SDF annotaon of the
Verilog netlist and the process corner captured by SDF delays. These opons are stored as
properes on the simulaon leset and are used while wring the netlist for simulaon.
Appendix A: Compilation, Elaboration, Simulation, Netlist, and Advanced Options
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 178
Vivado Simulator Netlist Options
Table 36: Vivado Simulator Netlist Options
Option Description
-sdf_anno
A check box is available to select the -sdf_anno option. This option is enabled by default
-process_corner
You can specify the -process_corner as fast or slow
Note: The Netlist Opons of all the third-party simulators (Questa Advanced Simulator, ModelSim
Simulator, VCS and Xcelium Simulators) are similar to the opons of Vivado simulator Netlist Opons.
Advanced Simulation Options
Advanced tab contains two opons.
Enable incremental compilaon opon: This opon enables the incremental compilaon and
preserves the simulaon les during successive run.
Include all design sources for simulaon opon: By default, this opon is enabled. Selecng
this opon ensures that all the les from design sources along with the les from the current
simulaon set will be used for simulaon. Even if you change the design sources, the same
changes will be updated when you launch behavioral simulaon.
IMPORTANT! This is an advanced user feature. Unchecking the box could produce unexpected results.
The Include all design sources for simulaon check box is selected by default. As long as the check box
is selected, the simulaon set includes Out-of-Context (OOC) IP, IP Integrator les, and DCP.
Unchecking the box gives you the exibility to include only the les you want to simulate, but, as
stated above, you might experience unexpected results.
Note: The Advanced Simulaon Opons are the same for all simulators.
Appendix A: Compilation, Elaboration, Simulation, Netlist, and Advanced Options
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 179
Appendix B
SystemVerilog Support in Vivado
Simulator
The Vivado simulator supports the subset of SystemVerilog. The synthesizable set of
SystemVerilog is listed in the following table. The supported test bench features are listed in
Table 38: Supported Dynamic Type Constructs.
Targeting SystemVerilog for a Specific File
By default, the Vivado IDE compiles .v les with the Verilog 2001 syntax and .sv les with the
SystemVerilog syntax.
To target SystemVerilog for a specic .v le in the Vivado IDE:
1. Right-click the le and select Set le type as shown in the gure below.
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 180
2. In the Set Type dialog box, shown in the gure below, change the le type from Verilog to
SystemVerilog and click OK.
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 181
Alternavely, you can use the following command in the Tcl Console:
set_property file_type SystemVerilog [get_files <filename>.v]
Running SystemVerilog in Standalone or prj Mode
Standalone Mode
A new -sv ag has been introduced to xvlog, so if you want to read any SystemVerilog le, you
can use following command:
xvlog -sv <Design file list>
xvlog -sv -work <LibraryName> <Design File List>
xvlog -sv -f <FileName> [Where FileName contain path of test cases]
prj Mode
If you want to run the Vivado simulator in the prj-based ow, use sv as the le type, as you
would verilog or vhdl.
xvlog -prj <prj File>
xelab -prj <prj File> <topModuleName> <other options>
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 182
Where the entry in prj le appears as follows:
verilog library1 <FileName>
sv library1 <FileName> [File parsed in SystemVerilog mode]
vhdl library2 <FileName>
sv library3 <FileName> [File parsed in SystemVerilog mode]
Table 37: Synthesizable Set of SystemVerilog 1800-2012
Primary construct Secondary construct LRM section Status
Data type 6
Singular and aggregate types 6.4 Supported
Nets and variables 6.5 Supported
Variable declarations 6.8 Supported
Vector declarations 6.9 Supported
2-state (two-value) and 4-state (four-value)
data types
6.11.2 Supported
Signed and unsigned integer types 6.11.3 Supported
Real, shortreal and realtime data types 6.12 Supported
User-defined types 6.18 Supported
Enumerations 6.19 Supported
Defining new data types as enumerated
types
6.19.1 Supported
Enumerated type ranges 6.19.2 Supported
Type checking 6.19.3 Supported
Enumerated types in numerical
expressions
6.19.4 Supported
Enumerated type methods 6.19.5 Supported
Type parameters 6.20.3 Supported
Const constants 6.20.6 Supported
Type operator 6.23 Supported
Cast operator 6.24.1 Supported
$cast dynamic casting 6.24.2 Supported
Bitstream casting 6.24.3 Supported
Aggregate data types 7
Structures 7.2 Supported
Packed/Unpacked structures 7.2.1 Supported
Assigning to structures 7.2.2 Supported
Unions 7.3 Supported
Packed/Unpacked unions 7.3.1 Supported
Tagged unions 7.3.2 Not Supported
Packed arrays 7.4.1 Supported
Unpacked arrays 7.4.2 Supported
Operations on arrays 7.4.3 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 183
Table 37: Synthesizable Set of SystemVerilog 1800-2012 (cont'd)
Primary construct Secondary construct LRM section Status
Multidimensional arrays 7.4.5 Supported
Indexing and slicing of arrays 7.4.6 Supported
Array assignments 7.6 Supported
Arrays as arguments to subroutines 7.7 Supported
Array querying functions 7.11 Supported
Array manipulation methods 7.12 Supported
Processes 9
Combinational logic always_comb
procedure
9.2.2 Supported
Implicit always_comb sensitivities 9.2.2.1 Supported
Latched logic always_latch procedure 9.2.2.3 Supported
Sequential logic always_ff procedure 9.2.2.4 Supported
Sequential blocks 9.3.1 Supported
Parallel blocks 9.3.2 Supported
Procedural timing controls 9.4 Supported
Conditional event controls 9.4.2.3 Supported
Sequence events 9.4.2.4 Not Supported
Assignment statement 10
The continuous assignment statement 10.3.2 Supported
Variable declaration assignment (variable
initialization)
10.5 Supported
Assignment-like contexts 10.8 Supported
Array assignment patterns 10.9.1 Supported
Structure assignment patterns 10.9.2 Supported
Unpacked array concatenation 10.10 Supported
Net aliasing 10.11 Not Supported
Operators and expressions 11
Constant expressions 11.2.1 Supported
Aggregate expressions 11.2.2 Supported
Operators with real operands 11.3.1 Supported
Operations on logic (4-state) and bit (2-
state) types
11.3.4 Supported
Assignment within an expression 11.3.6 Supported
Assignment operators 11.4.1 Supported
Increment and decrement operators 11.4.2 Supported
Arithmetic expressions with unsigned and
signed types
11.4.3.1 Supported
Wildcard equality operators 11.4.6 Supported
Concatenation operators 11.4.12 Supported
Set membership operator 11.4.13 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 184
Table 37: Synthesizable Set of SystemVerilog 1800-2012 (cont'd)
Primary construct Secondary construct LRM section Status
Concatenation of stream_expressions 11.4.14.1 Supported
Re-ordering of the generic stream 11.4.14.2 Supported
Streaming concatenation as an assignment
target (unpack)
11.4.14.3 Supported
Streaming dynamically sized data 11.4.14.4 Supported
Procedural programming
statement
12
unique-if, unique0-if and priority-
if
12.4.2 Supported
Violation reports generated by unique-if,
unique0-if, and priority-if
constructs
12.4.2.1 Supported
If statement violation reports and multiple
processes
12.4.2.2 Supported
unique-case, unique0-case, and
priority-case
12.5.3 Supported
Violation reports generated by unique-
case, unique0-case, and priority-
case construct
12.5.3.1 Supported
Case statement violation reports and
multiple processes
12.5.3.2 Supported
Set membership case statement 12.5.4 Supported
Pattern matching conditional statements 12.6 Not Supported
Loop statements 12.7 Supported
Jump statement 12.8 Supported
Tasks 13.3
Static and Automatic task 13.3.1 Supported
Tasks memory usage and concurrent
activation
13.3.2 Supported
Function 13.4
Return values and void functions 13.4.1 Supported
Static and Automatic function 13.4.2 Supported
Constant function 13.4.3 Supported
Background process spawned by function
call
13.4.4 Supported
Subroutine calls and
argument passing
13.5
Pass by value 13.5.1 Supported
Pass by reference 13.5.2 Supported
Default argument value 13.5.3 Supported
Argument binding by name 13.5.4 Supported
Optional argument list 13.5.5 Supported
Import and Export function 13.6 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 185
Table 37: Synthesizable Set of SystemVerilog 1800-2012 (cont'd)
Primary construct Secondary construct LRM section Status
Task and function name 13.7 Supported
Utility system tasks and
system functions (only
synthesizable set)
20 Supported
I/O system tasks and
system functions (only
synthesizable set)
21 Supported
Compiler directives 22 Supported
Modules and hierarchy 23
Default port values 23.2.2.4 Supported
Top-level modules and $root 23.3.1 Supported
Module instantiation syntax 23.3.2 Supported
Nested modules 23.4 Supported
Extern modules 23.5 Supported
Hierarchical names 23.6 Supported
Member selects and hierarchical names 23.7 Supported
Upwards name referencing 23.8 Supported
Overriding module parameters 23.10 Supported
Binding auxiliary code to scopes or
instances
23.11 Not Supported
Interfaces 25
Interface syntax 25.3 Supported
Nested interface 25.3 Supported
Ports in interfaces 25.4 Supported
Example of named port bundle 25.5.1 Supported
Example of connecting port bundle 25.5.2 Supported
Example of connecting port bundle to
generic interface
25.5.3 Supported
Modport expressions 25.5.4 Supported
Clocking blocks and modports 25.5.5 Supported
Interfaces and specify blocks 25.6 Supported
Example of using tasks in interface 25.7.1 Supported
Example of using tasks in modports 25.7.2 Supported
Example of exporting tasks and functions 25.7.3 Supported
Example of multiple task exports 25.7.4 Supported
Parameterized interfaces 25.8 Supported
Virtual interfaces 25.9 Supported
Packages 26
Package declarations 26.2 Supported
Referencing data in packages 26.3 Supported
Using packages in module headers 26.4 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 186
Table 37: Synthesizable Set of SystemVerilog 1800-2012 (cont'd)
Primary construct Secondary construct LRM section Status
Exporting imported names from packages 26.6 Supported
The std built-in package 26.7 Supported
Generate constructs 27 Supported
Testbench Feature
In Vivado simulator, support for some of the commonly used testbench features have been
added, as shown in the following table:
Table 38: Supported Dynamic Type Constructs
Primary Construct Secondary Construct LRM Section Status
String data type 6.16 Supported
String operators (table 6-9 of IEEE
1800-2012)
6.16 Supported
Len() 6.16.1 Supported
Putc() 6.16.2 Supported
Getc() 6.16.3 Supported
Toupper() 6.16.4 Supported
Tolower() 6.16.5 Supported
Compare 6.16.6 Supported
Icompare() 6.16.7 Supported
Substr() 6.16.8 Supported
Atoi(), atohex(), atooct(), atobin() 6.16.9 Supported
Atoreal() 6.16.10 Supported
Itoa() 6.16.11 Supported
Hextoa() 6.16.12 Supported
Octtoa() 6.16.13 Supported
Bintoa() 6.16.14 Supported
Realtoa() 6.16.15 Supported
Dynamic Array 7.5 Supported
Dynamic array new 7.5.1 Supported
Size 7.5.2 Supported
Delete 7.5.3 Supported
Associative Array 7.8 Supported
Wildcard index 7.8.1 Supported
String index 7.8.2 Supported
Class index 7.8.3 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 187
Table 38: Supported Dynamic Type Constructs (cont'd)
Primary Construct Secondary Construct LRM Section Status
Integral index 7.8.4 Supported
Other user-defined types 7.8.5 Supported
Accessing invalid index 7.8.6 Supported
Associative array methods 7.9 Supported
Num() and Size() 7.9.1 Supported
Delete() 7.9.2 Supported
Exists() 7.9.3 Supported
First() 7.9.4 Supported
Last() 7.9.5 Supported
Next() 7.9.6 Supported
Prev() 7.9.7 Supported
Arguments to traversal Method 7.9.8 Supported
Associative array assignment 7.9.9 Supported
Associative array arguments 7.9.10 Supported
Associative Array literals 7.9.11 Supported
Queue 7.10 Supported
Queue operators 7.10.1 Supported
Queue methods 7.10.2 Supported
Size() 7.10.2.1 Supported
Insert() 7.10.2.2 Supported
Delete() 7.10.2.3 Supported
Pop_front() 7.10.2.4 Supported
Pop_back() 7.10.2.5 Supported
Push_front() 7.10.2.6 Supported
Push_back() 7.10.2.7 Supported
Persistence of references to
elements of a queue
7.10.3 Supported
Updating a queue using
assignment and unpacked array
concatenation
7.10.4 Supported
Bounded queues 7.10.5 Supported
Class 8 Supported
Class General 8.1 Supported
Overviews 8.2 Supported
Syntax 8.3 Supported
Objects(Class instance) 8.4 Supported
Object properties and object
parameter data
8.5 Supported
Object methods 8.6 Supported
Constructors 8.7 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 188
Table 38: Supported Dynamic Type Constructs (cont'd)
Primary Construct Secondary Construct LRM Section Status
Static class properties 8.8 Supported
Static methods 8.9 Supported
This 8.10 Supported
Assignment, renaming, and
copying
8.11 Supported
Inheritance and subclasses 8.12 Supported
Overridden members 8.13 Supported
Super 8.14 Supported
Casting 8.15 Supported
Chaining constructors 8.16 Supported
Data hiding and encapsulation 8.17 Supported
Constant class properties 8.18 Supported
Virtual methods 8.19 Supported
Abstract classes and pure virtual
methods
8.20 Supported
Polymorphism: dynamic method
lookup
8.21 Supported
Class scope resolution operator :: 8.22 Supported
Out-of-block declarations 8.23 Supported
Parameterized classes 8.24 Supported
Class resolution operator for
parameterized classes
8.24.1 Supported
Typedef class 8.25 Supported
Interface classes 8.26 Supported
Multiple inheritance of Interface
classes
8.26.6 Supported
Memory management 8.27 Supported
Classes and structures 8.28 Supported
Processes 9 Supported
Parallel Process - Fork Join_Any
and Fork Join_None
9.3 Supported
Wait fork 9.6.1 Supported
Disable Fork 9.6.3 Supported
Fine grain process control 9.7 Supported
Clocking Block 14 Supported
General 14.1 Supported
Overview 14.2 Supported
Clocking block declaration 14.3 Supported
Input and output Skew 14.4 Supported
Hierarchical Expressions 14.5 Not Supported
Signals in multiple clocking block 14.6 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 189
Table 38: Supported Dynamic Type Constructs (cont'd)
Primary Construct Secondary Construct LRM Section Status
Clocking block scope and lifetime 14.7 Supported
Multiple clocking block example 14.8 Supported
Interface and clocking block 14.9 Supported
Clocking block event 14.10 Supported
Cycle Delay 14.11 Supported
Default clocking 14.12 Supported
Input Sampling 14.13 Supported
Global clocking 14.14 Not Supported
Synchronous events 14.15 Supported
Synchronous drives 14.16 Supported
Drives and nonblocking
assignments
14.16.1 Supported
Driving clocking output signals 14.16.2 Supported
Semaphore 15.3 Supported
Semaphore method new() 15.3.1 Supported
Semaphore method put() 15.3.2 Supported
Semaphore method get() 15.3.3 Supported
Semaphore method try_get() 15.3.4 Supported
Mailbox 15.4 Supported
Mailbox method new() 15.4.1 Supported
Mailbox method num() 15.4.2 Supported
Mailbox method put() 15.4.3 Supported
Mailbox method try_put() 15.4.4 Supported
Mailbox method get() 15.4.5 Supported
Mailbox method try_get() 15.4.6 Supported
Mailbox method peek() 15.4.7 Supported
Mailbox method try_peek() 15.4.8 Supported
Parameterized mailbox 15.4.9 Supported
Named Event 15.5 Supported
Triggering an event 15.5.1 Supported
Waiting on event 15.5.2 Supported
Persistent trigger 15.5.3 Not Supported
Event Sequence 15.5.4 Not Supported
Operation on named event
variable
15.5.5 Supported
Merging Events 15.5.5.1 Supported
Reclaiming event 15.5.5.2 Supported
Event comparison 15.5.5.3 Supported
Assertion 16 Supported
General 16.1 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 190
Table 38: Supported Dynamic Type Constructs (cont'd)
Primary Construct Secondary Construct LRM Section Status
Overview 16.2 Supported
Assert 16.2 Supported
Assume 16.2 Supported
Cover 16.2 Not Supported
Restrict 16.2 Not Supported
Immediate assertion 16.3 Supported
Deferred assertion 16.4 Not Supported
Concurrent assertion overview 16.5 Supported
Sampling 16.5.1 Supported
Assertion clock 16.5.2 Supported
Boolean expression 16.6 Supported
Sequence 16.7 Supported
Declaring sequence 16.8 Supported
Typed formal argument in
sequence declarations
16.8.1 Supported
Local variable formal arguments
in sequence declarations
16.8.2 Supported
Sequence operations 16.9 Supported
Operator precedence 16.9.1 Supported
Repetition in sequences 16.9.2 Supported
Sampled value functions 16.9.3 Supported
Global clocking past and future
sampled value functions
16.9.4 Not Supported
AND operation 16.9.5 Supported
Intersection (AND with length
restriction)
16.9.6 Supported
OR operation 16.9.7 Supported
First_match operation 16.9.8 Supported
Conditions over sequences 16.9.9 Supported
Sequence contained within
another sequence
16.9.10 Supported
Composing sequences from
simpler subsequences
16.9.11 Supported
Local variables 16.10 Supported
Calling subroutines on match of a
sequence
16.11 Supported
Declaring properties 16.12 Supported
Sequence property 16.12.1 Supported
Negation property 16.12.2 Supported
Disjunction property 16.12.3 Supported
Conjunction property 16.12.4 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 191
Table 38: Supported Dynamic Type Constructs (cont'd)
Primary Construct Secondary Construct LRM Section Status
If-else property 16.12.5 Supported
Implication 16.12.6 Supported
Implies and iff properties 16.12.7 Supported
Property instantiation 16.12.8 Supported
Followed-by property 16.12.9 Not Supported
Next time property 16.12.10 Not Supported
Always property 16.12.11 Not Supported
Until property 16.12.12 Not Supported
Eventually property 16.12.13 Not Supported
Abort properties 16.12.14 Not Supported
Weak and strong operators 16.12.15 Not Supported
Case 16.12.16 Not Supported
Recursive properties 16.12.17 Not Supported
Typed formal arguments in
property declarations
16.12.18 Supported
Local variable formal arguments
in property declarations
16.12.19 Supported
Property examples 16.12.20 Supported
Finite-length versus infinite-length
behavior
16.12.21 Supported
Nondegeneracy 16.12.22 Supported
Multiclock support 16.13 Not Supported
Concurrent assertions 16.14 Supported
Assert statement 16.14.1 Supported
Assume statement 16.14.2 Supported
Cover statement 16.14.3 Not Supported
Restrict statement 16.14.4 Not Supported
Using concurrent assertion
statements outside procedural
code
16.14.5 Supported
Embedding concurrent assertions
in procedural code
16.14.6 Not Supported
Inferred value functions 16.14.7 Not Supported
Nonvacuous evaluations 16.14.8 Not Supported
Disable iff resolution 16.15 Supported
Clock resolution 16.16 Supported
Semantic leading clocks for
multiclocked sequence and
properties
16.16.1 Supported
Expect statement 16.17 Not Supported
Clocking blocks and concurrent
assertions
16.18 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 192
Table 38: Supported Dynamic Type Constructs (cont'd)
Primary Construct Secondary Construct LRM Section Status
Random Constraint 18 Supported
Concepts and Usage 18.3 Supported
Random Variable 18.4 Supported
Rand modifier 18.4.1 Supported
Randc modifier 18.4.2 Supported
Constraint block 18.5 Supported
External constraint block 18.5.1 Supported
Constraint inheritance 18.5.2 Supported
Set membership 18.5.3 Supported
Distribution 18.5.4 Supported
Implication 18.5.6 Supported
If-else constraint 18.5.7 Supported
Iterative constraint 18.5.8 Supported
foreach iterative constraint 18.5.8.1 Supported
Array reduction iterative
constraint
18.5.8.2 Supported
Global constraint 18.5.9 Supported
Variable Ordering 18.5.10 Supported
Static constraint block 18.5.11 Supported
Function in constraint 18.5.12 Supported
Constraint Guards 18.5.13 Supported
Soft constraint 18.5.14 Supported
Method Randomize 18.6.1 Supported
Pre_randomize and
post_randomize
18.6.2 Supported
Behavior of randomization
method
18.6.3 Supported
In-line constraints 18.7 Supported
Local scope resolution 18.7.1 Supported
Disabling random variable with
rand_mode
18.8 Supported
Controlling constraints with
constraint_mode
18.9 Supported
Dynamic constraint modification 18.10 Supported
In-line random variable control 18.11 Supported
In-line constraint checker 18.11.1 Supported
Randomize of a scope variable
std::randomize
18.12 Supported
Adding constraint to scope
variables std::randomize with
18.12.1 Supported
Random number system
functions and method
18.13 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 193
Table 38: Supported Dynamic Type Constructs (cont'd)
Primary Construct Secondary Construct LRM Section Status
$urandom 18.13.1 Supported
$urandom_range 18.13.2 Supported
srandom 18.13.3 Supported
Get_randstate 18.13.4 Supported
Set_randstate 18.13.5 Supported
Random stability 18.14 Supported
Manually seeding randomization 18.15 Supported
Randcase 18.16 Supported
Randsequence 18.17 Not Supported
Programs 24 Supported
The Program construct 24.3 Supported
Scheduling semantic of code in
program construct
24.3.1 Supported
Program port connection 24.3.2 Supported
Eliminating test bench race 24.4 Supported
Blocking task in cycle/event mode 24.5 Supported
Anonymous Programs 24.6 Not Supported
Program control task 24.7 Supported
Functional Coverage 19 Supported
General 19.1 Supported
Overview 19.2 Supported
Defining coverage model:
covergroup
19.3 Supported
Using covergroup in classes 19.4 Supported
Defining coverage points 19.5 Supported
Specifying bins for values 19.5.1 Supported
Coverpoint bin with covergroup
expressions
19.5.1.1 Supported
Coverpoint bin set covergroup
expressions
19.5.1.2 Not supported
Specifying bins for transitions 19.5.2 Supported
Automatic bin creation for
coverage points
19.5.3 Supported
Wildcard specification of coverage
point bins
19.5.4 Supported
Excluding coverage point values
or transitions
19.5.5 Supported
Specifying Illegal coverage point
values or transitions
19.5.6 Supported
Value resolution 19.5.7 Supported
Defining cross coverage 19.6 Supported
Defining cross coverage bins 19.6.1 Supported
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 194
Table 38: Supported Dynamic Type Constructs (cont'd)
Primary Construct Secondary Construct LRM Section Status
Example of user-defined cross
coverage and select expressions
19.6.1.1 Supported
Cross bin with covergroup
expressions
19.6.1.2 Supported
Cross bin automatically defined
types
19.6.1.3 Supported
Cross bin set expression 19.6.1.4 Supported
Excluding cross products 19.6.2 Supported
Specifying illegal cross products 19.6.3 Supported
Specifying coverage options 19.7 Supported
Covergroup type options 19.7.1 Supported
Predefined coverage methods 19.8 Supported
Overriding the built-in sample
method
19.8.1 Supported
Predefined coverage system tasks
and system functions
19.9 Supported
Organization of option and
type_option members
19.10 Supported
Note: Sensivity on dynamic types such as Queue, Dynamic Array, Associave Array, and Class are not
supported, therefore, block waing on dynamic type update may not work correctly. For example:
module top();
int c[$];
event e1;
initial
begin
c[0] = 10;
for(int i = 0; i <= 10; i++)
begin
c = {i, c};
-> e1;
#5;
end
end
always@(*) $display($time, " trying to read sensitivity on dynamic type :
%d", c[0]);
// this won't work as sensitivity on dynamic type is not supported
always @(e1) $display($time, " coming from event sensitivity : %d",
c[0]); // this we
can do as WA
always_comb if(c.size() > 0) $display($time, " Coming from size
sensitivity : %d",
c[0]); // sensitivity on size works
Appendix B: SystemVerilog Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 195
Appendix C
Universal Verification Methodology
Support
Vivado
®
integrated design environment supports universal vericaon methodology (UVM) in
Vivado simulator (XSim). The UVM version 1.2 library is precompiled and is available with Vivado.
If you are running your design through Vivado, you need not set anything. But if you are running
standalone Vivado simulator, then you need to pass -L uvm to xvlog and xelab command.
By default, Vivado simulator supports UVM version 1.2. If you want to use UVM version 1.1, you
need to pass -uvm_version 1.1 to xvlog and xelab command. Set the following properes
if you are using it through the Vivado integrated design environment:
set_property -name {xsim.compile.xvlog.more_options} -value {-uvm_version
1.1} -objects [get_filesets sim_1]
set_property -name {xsim.elaborate.xelab.more_options} -value {-uvm_version
1.1} -objects [get_filesets sim_1]
You can also set these properes from Vivado GUI using Compilaon and Elaboraon tab in
simulaon sengs. For more informaon, see Using Simulaon Sengs.
Appendix C: Universal Verification Methodology Support
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 196
Appendix D
VHDL 2008 Support in Vivado
Simulator
Introduction
The Vivado
®
simulator supports the subset of VHDL 2008 (IEEE 1076-2008). The complete list
is given in Supported features of VHDL 2008 (IEEE1076-2008).
Compiling and Simulating
The Vivado simulator executable xvhdl is used to convert a VHDL design unit into parser dump
(.vdb). By default, Vivado simulator uses mixed 93 and 2008 standard (STD) and IEEE packages
to freely allow mixing of 93 and 2008 features. If you want to force only the VHDL-93 standard
(STD) and IEEE package, pass -93_mode to xvhdl. To compile a le only with VHDL 2008 mode,
you need to pass -2008 switch to xvhdl.
For example, to compile a design called top.vhdl in VHDL-2008, following command line can be
used:
xvhdl -2008 -work mywork top.vhdl
The Vivado simulator executable xelab is used to elaborate a design and produce an executable
image for simulaon.
xelab can do either of the following:
Elaborate on parser dumps produced by xvhdl
Directly use vhdl source les.
No switch is needed to elaborate on parser dumps produced by xvhdl. You can pass -vhdl2008
to xelab to directly use vhdl source les.
Appendix D: VHDL 2008 Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 197
Example 1:
xelab top -s mysim; xsim mysim -R
Example 2:
xelab -vhdl2008 top.vhdl top -s mysim; xsim mysim -R
Instead of specifying VHDL les in the command line for xvhdl and xelab, a .prj le can be
used. If you have two les for a design called top.vhdl (2008 mode) and bot.vhdl (93 mode),
you can create a project le named example.prj as follows:
vhdl xil_defaultlib bot.vhdl
vhdl2008 xil_defaultlib top.vhdl
In the project le, each line starts with the language type of the le, followed by the library name
such as xil_defaultlib and one or more le names with a space separator. For VHDL 93,
one should use vhdl as the language type. For VHDL 2008, use vhdl2008 instead.
A .prj le can be used as shown in the example below:
xelab -prj example.prj xil_defaultlib.top -s mysim; xsim mysim -R
Alternavely, to mix VHDL 93 and VHDL 2008 design units, compile the les separately with a
proper language mode specied to xvhdl. Then, elaborate on top(s) of the design. For example,
if we have a VHDL 93 module called bot in le bot.vhdl, and a VHDL-2008 module called top
in le top.vhdl, you can compile them as shown in the example below:
xvhdl bot.vhdl
xvhdl -2008 top.vhdl
xelab -debug typical top -s mysim
Once the executable is produced by xelab, you can run the simulaon as usual.
Example 1:
xsim mysim -gui
Example 2:
xsim mysim -R
Appendix D: VHDL 2008 Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 198
Fixed and Floating Point Packages
Fixed and oang point packages used by the Vivado simulator are the new enhanced IEEE
standard packages introduced in VHDL-2008. If you are using the VHDL-93 standard xed or
oang package, that may work in Vivado synthesis, however you must edit your VHDL source
le for simulaon.
For example, if you are using the following syntax for the xed package in Vivado synthesis:
library ieee;
use ieee.fixed_pkg.all;
Change this to the following syntax in VHDL-2008 for use in the Vivado simulator:
library ieee_proposed;
use ieee_proposed.fixed_pkg.all;
See this link in the Vivado Design Suite User Guide: Synthesis (UG901) for more informaon about
xed and oang packages in Vivado Synthesis.
Similar changes will apply for oang package too.
Supported Features
Following are the supported features of VHDL 2008 (IEEE1076-2008):
Matching relaonal operators.
Maximum and minimum operators.
Shi operators (rol, ror, sll, srl, sla, and sra).
Unary logical reducon operators.
Mixing array and scalar logical operators.
If-else-if and case generate.
Sequenal assignments.
Case? Statements.
Select? Statements.
Unconstrained element types.
boolean_vector and integer_vector array types.
Reading output ports.
Expressions in port maps.
Appendix D: VHDL 2008 Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 199
Process (all) statement.
Referencing generics in generic lists.
Generic types in enes.
Relaxed return rules for funcon return values.
Extensions to globally stac and locally stac expressions.
Stac ranges and integer expressions in range bounds.
Block comments.
Context declaraon.
Array slices in aggregate.
Protected types.
External name to signal.
Note: For detailed informaon about features, see Supported VHDL-2008 Features secon in Vivado
Design Suite User Guide: Synthesis (UG901).
Appendix D: VHDL 2008 Support in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 200
Appendix E
Direct Programming Interface (DPI)
in Vivado Simulator
Introduction
You can use the SystemVerilog Direct Programming Interface (DPI) to bind C code to
SystemVerilog code. Using DPI, SystemVerilog code can call a C funcon, which in turn can call
back a SystemVerilog task or funcon. Vivado
®
simulator supports all the constructs as DPI task/
funcon, as described below.
Compiling C Code
A new compiler executable, xsc, is provided to convert C code into an object code le and to
link mulple object code les into a shared library (.a on Windows and .so on Linux). The xsc
compiler is available in the <Vivado installation>/bin directory. You can use -sv_lib to
pass the shared library containing your C code to the Vivado simulator/elaborator executable.
The xsc compiler works in the same way as a C compiler, such as gcc. The xsc compiler:
Calls the LLVM clang compiler to convert C code into object code
Calls the GNU linker to create a shared library (.a on Windows and .so on Linux) from one or
more object les corresponding to the C les
The shared library generated by the xsc compiler is linked with the Vivado simulator kernel using
one or more newly added switches in xelab, as described below. The simulaon snapshot created
by xelab thus has ability to connect the compiled C code with compiled SystemVerilog code and
eect communicaon between C and SystemVerilog.
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 201
xsc Compiler
The xsc compiler helps you to create a shared library (.a on Windows or .so on Linux) from one
or more C les. Use xelab to bind the shared library generated by xsc into the rest of your design.
You can create a shared library using the following processes:
One-step process: Pass all C les to xsc without using the -compile or -shared/
shared_systemc/static switch.
Two-step process:
xsc -compile <C files>
xsc --shared or -shared_systemc or -static <object files>
Usage
xsc [options] <files...>
Switches
You can use a double dash (--) or a single dash (-) for switches.
Table 39: XSC Compiler Switches
Switch Description
-compile [c]
Generate the object files only from the source C files. The link stage is not
run.
-f [ -file ] <arg>
Read additional options from the specified file.
-h [ -help ]
Print this help message.
-i [ -input_file ] <arg>
List of input files (one file per switch) for compiling or linking.
-mt <arg> (=auto)
Specifies the number of sub-compilation jobs that can be run in parallel.
Choices are:
auto: automatic
n: where n is an integer greater than 1
off: turn off multi-threading
Default: auto
-o [ -output ] <arg>
Specify the name of output shared library. Works with --shared, --
shared_systemc, --exe options only. Default for shared library is
<current_directory>/xsim.dir/work/xsc/dpi.so.
-work <arg>
Specify the work directory in which to place the outputs (object files).
Default: <current_directory>/xsim.dir/xsc
-v [ -verbose ] <arg>
Specify verbosity level for printing messages.
Allowed values are: 0, 1
Default: 0
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 202
Table 39: XSC Compiler Switches (cont'd)
Switch Description
-gcc_compile_options <arg>
Supply an additional option to the compiler. You can use multiple -
gcc_compile_options switches.
-gcc_link_options <arg>
Supply an additional option to the linker. You can use multiple -
gcc_link_options switches.
-shared
Run only the linking stage to generate the shared library (.so) from the
object files.
-gcc_version
Print version of the C compiler used internally.
-gcc_path
Print path of the C compiler used internally.
-lib <arg>
Specify the logical library directories that will be read. Default is
<current_directory>/xsim.dir/xs.
-cppversion <arg>
Set the CPP version. Currently CPP 11 and 14 are supported. Default is 11.
--shared_systemc
Run only the linking stage to generate the shared library (.dll) for SystemC
from the object files.
--static
Run only the linking stage to generate a static library (.a) for SystemC from
the object files.
--exe
Create executable for standalone SystemC.
--version
Print version of the Vivado Simulator xsc being used.
--debug
Debug SystemC modules. This option is relevant only when used together
with -exe option, otherwise is ignored.
--print_gcc_version
Print version of the C compiler used internally
Examples
xsc function1.c function2.c
xelab -svlog file.sv -sv_lib dpi
xsc -compile function1.c function2.c -work abc
xsc -shared abc/function1.lnx64.o abc/function2.lnx64.o -work abc
Note: By default, Linux uses the LD_LIBRARY_PATH for searching the DPI libraries. Hence, provide -
dpi_absolute ag to xelab on Linux if library name start with lib*.
Note: You can use -additional_option to the compiler to pass extra switch.
Example:
xsc t1.c --additional_option "-I<path>"
Example to pass mulple path:
xsc t1.c --additional_option "-I<path>" --additional_option "-I<path>"
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 203
Binding Compiled C Code to SystemVerilog
Using xelab
The DPI-related switches for xelab that bind the compiled C code to SystemVerilog are as
follows:
Table 40: DPI-Related Switches for xelab
Switch Description
-sv_root arg
Root directory relative to which a DPI shared library should be searched. (Default:
<current_directory>/xsim.dir/xsc)
-sv_lib arg
Name of the DPI shared library without the file extension defining C function imported in
SystemVerilog.
-sv_liblist arg
Bootstrap file pointing to DPI shared libraries.
-dpiheader arg
Generate a DPI C header file containing C declaration of imported and exported functions.
-dpi_absolute Use absolute paths instead of LD_LIBRARY_PATH on Linux for DPI libraries that are formatted as
lib<libname>.so.
-dpi_stacksize arg User defined stack size for DPI tasks.
For more informaon on r-sv_liblist arg, refer to the IEEE Standard for SystemVerilog—
Unied Hardware Design, Specicaon, and Vericaon Language, Appendix J.4.1, page 1228.
Data Types Allowed on the Boundary of C and
SystemVerilog
The IEEE Standard for SystemVerilog allows only subsets of C and SystemVerilog data types on
the C and SystemVerilog boundary. Provided below are (1) details on data types supported in
Vivado simulator and (2) descripons of mapping between the C and SystemVerilog data types.
Supported Data Types
The following table describes data types allowed on the boundary of C and SystemVerilog, along
with mapping of data types from SystemVerilog to C and vice versa.
Table 41:
Data Types Allowed on the C-SystemVerilog Boundary
SystemVerilog C Supported Comments
byte char
Yes None
shortint short int
Yes None
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 204
Table 41: Data Types Allowed on the C-SystemVerilog Boundary (cont'd)
SystemVerilog C Supported Comments
int int
Yes None
longint long long
Yes None
real double
Yes None
shortreal float
Yes None
chandle void *
Yes None
string const char*
Yes None
bit unsigned char
Yes sv_0, sv_1
Available on C side using svdpi.h
logic, reg
unsigned char
Yes sv_0, sv_1, sv_z, sv_x:
Array (packed) of bits
svBitVecVal
Yes Defined in svdpi.h
Array (packed) of logic/reg
svLogicVecVal
Yes Defined in svdpi.h
enum
Underlying enum type Yes None
Packed struct, union Passed as array Yes None
Unpacked arrays of bit, logic Passed as array Yes C can call SystemVerilog
Unpacked struct Passed as struct Yes None
Unpacked union Passed as struct No None
Open arrays
svOpenArrayHandle
Yes None
To generate a C header le that provides details on how SystemVerilog data types are mapped to
C data types: pass the parameter -dpiheader <file name> to xelab. Addional details on
data type mapping are available in the The IEEE Standard for SystemVerilog.
Mapping for User-Defined Types
Enum
You can dene an enumerated type (enum) for conversion to the equivalent SystemVerilog types,
svLogicVecVal or svBitVecVal, depending on the base type of enum. For enumerated
arrays, equivalent SystemVerilog arrays are created.
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 205
Examples
SystemVerilog types::
typedef enum reg [3:0] { a = 0, b = 1, c} eType;
eType e;
eType e1[4:3];
typedef enum bit { a = 0, b = 1} eTypeBit;
eTypeBit e3;
eTypeBit e4[3:1] ;
C types:
svLogicVecVal e[SV_PACKED_DATA_NELEMS(4)];
svLogicVecVal e1[2][SV_PACKED_DATA_NELEMS(4)];
svBit e3;
svBit e4[3];
TIP: The C argument types depend on the base type of the
enum
and the direcon.
Packed Struct/Union
When using a packed struct or union type, an equivalent SystemVerilog type, svLogicVecVal
or svBitVecVal, is created on the DPI C side.
Examples
SystemVerilog type:
typedef struct packed {
int i;
bit b;
reg [3:0]r;
logic [2:0] [4:8][9:1] l;
} sType;
sType c_obj;
sType [3:2] c_obj1[5];
C type:
svLogicVecVal c_obj[SV_PACKED_DATA_NELEMS(172)];
svLogicVecVal c_obj1[5][SV_PACKED_DATA_NELEMS(344)];
Arrays, both packed and unpacked, are represented as arrays of svLogicVecVal or
svBitVecVal.
Unpacked Struct
An equivalent unpacked type is created on the C side, in which all the members are converted to
the equivalent C representaon.
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 206
Examples
SystemVerilog type:
typedef struct {
int i;
bit b;
reg r[3:0];
logic [2:0] l[4:8][9:1];
} sType;
C type:
typedef struct {
int i;
svBit b;
svLogic r[4];
svLogicVecVal l[5][9][SV_PACKED_DATA_NELEMS(3)];
} sType;
Support for svdpi.h Functions
The svdpi.h header le is provided in this directory: <vivado installation>/data/
xsim/include.
The following svdpi.h funcons are supported:
svBit svGetBitselBit(const svBitVecVal* s, int i);
svLogic svGetBitselLogic(const svLogicVecVal* s, int i);
void svPutBitselBit(svBitVecVal* d, int i, svBit s);
void svPutBitselLogic(svLogicVecVal* d, int i, svLogic s);
void svGetPartselBit(svBitVecVal* d, const svBitVecVal* s, int i, int w);
void svGetPartselLogic(svLogicVecVal* d, const svLogicVecVal* s, int i, int
w);
void svPutPartselBit(svBitVecVal* d, const svBitVecVal s, int i, int w);
void svPutPartselLogic(svLogicVecVal* d, const svLogicVecVal s, int i, int
w);
const char* svDpiVersion();
svScope svGetScope();
svScope svSetScope(const svScope scope);
const char* svGetNameFromScope(const svScope);
int svPutUserData(const svScope scope, void*userKey, void* userData);
void* svGetUserData(const svScope scope, void* userKey);
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 207
Open Arrays in DPI
When declaring an import funcon in SystemVerilog, you may specify formal argument as open
arrays. By specifying certain dimension(s) of formal array arguments as blank (open), it will allow
passing actual arguments of dierent size, which facilitates more general C code. At C side, the
open arrays are represented as SVOpenArrayHandle. By passing this handle to provided
funcons, you may query the informaon of open array, e.g. the size of opened dimension, and
access the actual data.
Declaration
Open arrays may only appear in import funcon/task declaraon in SystemVerilog code. By
leaving the dimension(s) open, you must specify an open array and the size of blank dimension
will be determined with respect to actual argument.
Examples
SystemVerilog funcon declaraon:
import "DPI-C" function int myFunction1(input bit[] v);
import "DPI-C" function void myFunction2(input int v1[], input int v2[],
output int
v3[]);
At C side, the open array(s) may only be accessed by the handle and provided APIs:
int myFunction1(const SVOpenArrayHandle v);
void myFunction2(const SVOpenArrayHandle v1, const SVOpenArrayHandle v2,
const
SVOpenArrayHandle v3);
svdpi.h Support
The following open array related funcons are supported in svdpi.h:
int svLeft(const svOpenArrayHandle h, int d);
int svRight(const svOpenArrayHandle h, int d);
int svLow(const svOpenArrayHandle h, int d);
int svHigh(const svOpenArrayHandle h, int d);
int svIncrement(const svOpenArrayHandle h, int d);
int svSize(const svOpenArrayHandle h, int d);
int svDimensions(const svOpenArrayHandle h);
void *svGetArrayPtr(const svOpenArrayHandle);
int svSizeOfArray(const svOpenArrayHandle);
void *svGetArrElemPtr(const svOpenArrayHandle, int indx1, ...);
void *svGetArrElemPtr1(const svOpenArrayHandle, int indx1);
void *svGetArrElemPtr2(const svOpenArrayHandle, int indx1, int indx2);
void *svGetArrElemPtr3(const svOpenArrayHandle, int indx1, int indx2,
int indx3);
void svPutBitArrElemVecVal(const svOpenArrayHandle d, const svBitVecVal* s,
int indx1, ...);
void svPutBitArrElem1VecVal(const svOpenArrayHandle d, const svBitVecVal* s,
int indx1);
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 208
void svPutBitArrElem2VecVal(const svOpenArrayHandle d, const svBitVecVal* s,
int indx1, int indx2);
void svPutBitArrElem3VecVal(const svOpenArrayHandle d, const svBitVecVal* s,
int indx1, int indx2, int indx3);
void svPutLogicArrElemVecVal(const svOpenArrayHandle d, const svLogicVecVal*
s, int indx1, ...);
void svPutLogicArrElem1VecVal(const svOpenArrayHandle d, const
svLogicVecVal*
s, int indx1);
void svPutLogicArrElem2VecVal(const svOpenArrayHandle d, const
svLogicVecVal*
s, int indx1, int indx2);
void svPutLogicArrElem3VecVal(const svOpenArrayHandle d, const
svLogicVecVal*
s, int indx1, int indx2, int indx3);
void svGetBitArrElemVecVal(svBitVecVal* d, const svOpenArrayHandle s,
int indx1, ...);
void svGetBitArrElem1VecVal(svBitVecVal* d, const svOpenArrayHandle s,
int indx1);
void svGetBitArrElem2VecVal(svBitVecVal* d, const svOpenArrayHandle s,
int indx1, int indx2);
void svGetBitArrElem3VecVal(svBitVecVal* d, const svOpenArrayHandle s,
int indx1, int indx2, int indx3);
void svGetLogicArrElemVecVal(svLogicVecVal* d, const svOpenArrayHandle s,
int indx1, ...);
void svGetLogicArrElem1VecVal(svLogicVecVal* d, const svOpenArrayHandle s,
int
indx1);
void svGetLogicArrElem2VecVal(svLogicVecVal* d, const svOpenArrayHandle s,
int indx1, int indx2);
void svGetLogicArrElem3VecVal(svLogicVecVal* d, const svOpenArrayHandle s,
int indx1, int indx2, int indx3);
svBit svGetBitArrElem(const svOpenArrayHandle s, int indx1, ...);
svBit svGetBitArrElem1(const svOpenArrayHandle s, int indx1);
svBit svGetBitArrElem2(const svOpenArrayHandle s, int indx1, int indx2);
svBit svGetBitArrElem3(const svOpenArrayHandle s, int indx1, int indx2, int
indx3);
svLogic svGetLogicArrElem(const svOpenArrayHandle s, int indx1, ...);
svLogic svGetLogicArrElem1(const svOpenArrayHandle s, int indx1);
svLogic svGetLogicArrElem2(const svOpenArrayHandle s, int indx1, int indx2);
svLogic svGetLogicArrElem3(const svOpenArrayHandle s, int indx1, int indx2,
int
indx3);
void svPutLogicArrElem(const svOpenArrayHandle d, svLogic value, int
indx1, ...);
void svPutLogicArrElem1(const svOpenArrayHandle d, svLogic value, int
indx1);
void svPutLogicArrElem2(const svOpenArrayHandle d, svLogic value, int
indx1, int
indx2);
void svPutLogicArrElem3(const svOpenArrayHandle d, svLogic value, int indx1,
int indx2, int indx3);
void svPutBitArrElem(const svOpenArrayHandle d, svBit value, int
indx1, ...);
void svPutBitArrElem1(const svOpenArrayHandle d, svBit value, int indx1);
void svPutBitArrElem2(const svOpenArrayHandle d, svBit value, int indx1,
int indx2);
void svPutBitArrElem3(const svOpenArrayHandle d, svBit value, int indx1,
int indx2, int indx3);
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 209
Usage Example - SystemVerilog code
module m();
import "DPI-C" function void myFunction1(input int v[]);
int arr[4];
int dynArr[];
initial begin
arr = '{4, 5, 6, 7};
myFunction1(arr);
dynArr = new[6];
dynArr = '{8, 9, 10, 11, 12, 13};
myFunction1(dynArr);
end
endmodule
C code:
#include "svdpi.h"
void myFunction1(const svOpenArrayHandle v)
{
int l1 = svLow(v, 1);
int h1 = svHigh(v, 1);
for(int i = l1; i<= h1; i++) {
printf("\t%d", *((char*)svGetArrElemPtr1(v, i)));
}
printf("\n");
}
Examples
Note: All the examples below print PASSED for a successful run.
Examples include:
Import Example Using -sv_lib, -sv_liblist, and -sv_root: A funcon import example that
illustrates dierent ways to use the -sv_lib, -sv_liblist and -sv_root opons.
Funcon with Output: A funcon that has output arguments.
Simple Import-Export Flow (Illustrates xelab -dpiheader Flow): Shows a simple import>export
ow (illustrates xelab -dpiheader <filename> ow).
Import Example Using -sv_lib, -sv_liblist, and -sv_root
Code
Assume that there are:
Two les each containing a C funcon
A SystemVerilog le that uses the following funcons:
funcon1.c
funcon2.c
le.sv
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 210
function1.c
#include "svdpi.h"
DPI_DLLESPEC
int myFunction1()
{
return 5;
}
function2.c
#include <svdpi.h>
DPI_DLLESPEC
int myFunction2()
{
return 10;
}
file.sv
module m();
import "DPI-C" pure function int myFunction1 ();
import "DPI-C" pure function int myFunction2 ();
integer i, j;
initial
begin
#1;
i = myFunction1();
j = myFunction2();
$display(i, j);
if( i == 5 && j == 10)
$display("PASSED");
else
$display("FAILED");
end
endmodule
Usage
Methods for compiling and linking the C les into the Vivado simulator are described below.
Single-step flow (simplest flow)
xsc function1.c function2.c
xelab -svlog file.sv -sv_lib dpi
Flow descripon:
The xsc compiler compiles and links the C code to create the shared library xsim.dir/xsc/
dpi.so, and xelab references the shared library through the switch -sv_lib.
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 211
Two-step flow
xsc -compile function1.c function2.c -work abc
xsc -shared/-shared_systemc abc/function1.lnx64.o abc/function2.lnx64.o -
work abc
xelab -svlog file.sv -sv_root abc -sv_lib dpi -R
Flow descripon:
Compile the two C les into corresponding object code in the work directory abc.
Link these two les together to create the shared library dpi.so.
Make sure that this library is picked up from the work library abc via the -sv_root switch.
TIP:
-sv_root
species where to look for the shared library specied through the switch
-sv_lib
.
On Linux, if
-sv_root
is not specied and the DPI library is named with the prex
lib
and the
sux
.so
, then use the LD_LIBRARY_PATH environment variable for the locaon of shared library.
Two-step flow (same as above with few extra options)
xsc -compile function1.c function2.c -work "abc" -v 1
xsc -shared/-shared_systemc "abc/function1.lnx64.o" "abc/function2.lnx64.o"
-work "abc" -o final -v 1
xelab -svlog file.sv -sv_root "abc" -sv_lib final -R
Flow descripon:
If you want to do your own compilaon and linking, you can use the -verbose switch to see the
path and the opons with which the compiler was invoked. You can then tailor those to suit your
needs. In the example above, a disnct shared library final is created. This example also
demonstrates how spaces in le path work.
Function with Output
Code
file.sv
/*- - - -*/
package pack1;
import "DPI-C" function int myFunction1(input int v, output int o);
import "DPI-C" function void myFunction2 (input int v1, input int v2,
output int o);
endpackage
/*-- ---*/
module m();
int i, j;
int o1 ,o2, o3;
initial
begin
#1;
j = 10;
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 212
o3 =pack1:: myFunction1(j, o1);//should be 10/2 = 5
pack1::myFunction2(j, 2+3, o2); // 5 += 10 + 2+3
$display(o1, o2);
if( o1 == 5 && o2 == 15)
$display("PASSED");
else
$display("FAILED");
end
endmodule
function.c
#include "svdpi.h"
DPI_DLLESPEC
int myFunction1(int j, int* o)
{
*o = j /2;
return 0;
}
DPI_DLLESPEC
void myFunction2(int i, int j, int* o)
{
*o = i+j;
return;
}
run.ksh
xsc function.c
xelab -vlog file.sv -sv -sv_lib dpi -R
Simple Import-Export Flow (Illustrates xelab -
dpiheader Flow)
In this ow:
1. Run xelab with the -dpiheader switch to create the header le, file.h.
2. Your code in file.c then includes the xelab-generated header le (file.h), which is listed
at the end.
3. Compile the code in file.c and test.sv as before to generate the simulaon executable.
file.c
#include "file.h"
/* NOTE: This file is generated by xelab -dpiheader <filename> flow */
int cfunc (int a, int b) {
//Call the function exported from SV.
return c_exported_func (a,b);
}
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 213
test.sv
module m();
export "DPI-C" c_exported_func = function func;
import "DPI-C" pure function int cfunc (input int a ,b);
/*This function can be called from both SV or C side. */
function int func(input int x, y);
begin
func = x + y;
end
endfunction
int z;
initial
begin
#5;
z = cfunc(2, 3);
if(z == 5)
$display("PASSED");
else
$display("FAILED");
end
endmodule
run.ksh
xelab -dpiheader file.h -svlog test.sv
xsc file.c
xelab -svlog test.sv -sv_lib dpi -R
file.h
/**********************************************************************/
/* ____ ____ */
/* / /\/ / */
/* /___/ \ / */
/* \ \ \/ */
/* \ \ Copyright (c) 2003-2013 Xilinx, Inc. */
/* / / All Right Reserved. */
/* /---/ /\ */
/* \ \ / \ */
/* \___\/\___\ */
/**********************************************************************/
/* NOTE: DO NOT EDIT. AUTOMATICALLY GENERATED FILE. CHANGES WILL BE LOST. */
#ifndef DPI_H
#define DPI_H
#ifdef __cplusplus
#define DPI_LINKER_DECL extern "C"
#else
#define DPI_LINKER_DECL
#endif
#include "svdpi.h"
/* Exported (from SV) function */
DPI_LINKER_DECL DPI_DLLISPEC
int c_exported_func(
int x, int y);
/* Imported (by SV) function */
DPI_LINKER_DECL DPI_DLLESPEC
int cfunc(
int a, int b);
#endif
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 214
DPI Examples Shipped with the Vivado Design
Suite
There are two examples shipped with the Vivado Design Suite that can help you understand how
to use DPI in Vivado simulator. Locate these in your installaon directory, <vivado
installation dir>/examples/xsim/systemverilog/dpi. Each includes a README le
that can help you get started. The examples include:
simple_import: simple import of pure funcon
simple_export: simple export of pure funcon
TIP: When the return value of a funcon is computed solely on the value of its inputs, it is called a
"pure funcon."
Appendix E: Direct Programming Interface (DPI) in Vivado Simulator
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 215
Appendix F
SystemC Support in Vivado IDE
Vivado
®
Design Suite provides simulaon models as a set of les and libraries. Simulaon
libraries contain the device and IP behavioral and ming models. The compiled libraries can be
used by mulple design projects. You must compile these les prior to design simulaon through
a ulity called compile_simlib to compile the simulaon models for the target simulator. This
ulity can be invoked from the Vivado IDE or by execung it from the Tcl console.
For SystemC simulaon vericaon, simulaon models are provided in C/C++/SystemC. Vivado
Design Suite provides two sets of simulaon models:
Protected models
Unprotected models
Note: With Vivado simulator, there is no need to compile the simulaon libraries. Libraries must generally
be compiled or recompiled with a new soware release to update simulaon models and to support a new
version of simulator and GCC.
Selecting Simulation Model Type
To speed up the simulaon run me, Xilinx provides transacon level simulaon models (tlm) for
certain IPs like Control, Interfaces and Processing System, SmartConnect, NoC, and AIE. You can
select one of the supported simulaon models for your IP by using either project property
(PREFERRED_SIM_MODEL) or an IP property (SELECTED_SIM_MODEL). Following are the
supported simulaon models properes:
ALLOWED_SIM_MODELS: This is a read only property. It describes dierent simulaon
model types such as rtl, tlm, tlm_dpi, dpi which are available for a parcular IP.
SELECTED_SIM_MODEL: This is an IP level seng which allows you to select and set one of
the simulaon model from the ALLOWED_SIM_MODELS.
PREFFERED_SIM_MODEL: This is a project level seng which allows you to set the default
simulaon model for the project. This is common across all IPs present in your project.
Appendix F: SystemC Support in Vivado IDE
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 216
Using SELECTED_SIM_MODEL IP Property
Perform the following steps to change the simulaon model of your IP using
SELECTED_SIM_MODEL:
1. In the Flow Navigator, click Open Block Design to open a block design.
2. Select the desired IP from the block design.
3. Right-click and click Block Properes opon.
Appendix F: SystemC Support in Vivado IDE
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 217
4. Change the SELECTED_SIM_MODEL opon from Block Properes window of your IP, for
example from rtl to tlm.
Appendix F: SystemC Support in Vivado IDE
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 218
The following Tcl command is an equivalent to change the SELECTED_SIM_MODEL:
set_property SELECTED_SIM_MODEL tlm [get_bd_cells /NOC_INST_0]
Using PREFERRED_SIM_MODEL Project Property
Perform the following steps to change the simulaon model of your IP using
PREFERRED_SIM_MODEL:
1. Click IP opon in the Sengs dialog box.
2. Select tlm from Select preferred simulaon model of IP drop-down menu.
Appendix F: SystemC Support in Vivado IDE
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 219
The following Tcl command is an equivalent to change the PREFERRED_SIM_MODEL:
set_property preferred_sim_model tlm [current_project]
Note: Seng PREFFERED_SIM_MODEL to tlm sets all IPs SELECTED_SIM_MODEL to tlm except IPs
which does not support tlm.
Protected Models
The protected models are pre-compiled and released in the form of a shared library that is built
for the respecve simulator. This shared library is packaged as part of the Vivado
®
install and
based on the design conguraon these models are bonded during elaboraon. The following
two protected models are delivered as part of Vivado install:
AI Engine
Network on chip (NoC)
These models are in the form of shared library present in the following installaon path:
<Vivado-install-path>/data/simmodels/<simulator>/<simulator_version>/
<os_type>/<gcc_version>/systemc/protected
Vivado simulator: <Vivado-install-path>/data/simmodels/xsim/2022.1/
lnx64/6.2.0/systemc/protected
Xcelium simulator: <Vivado-install-path>/data/simmodels/xcelium/
21.009.002/lnx64/9.3.0/systemc/protected
Appendix F: SystemC Support in Vivado IDE
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 220
Questa Advanced Simulator: <Vivado-install-path>/data/simmodels/questa/
2021.3/lnx64/7.4.0/systemc/protected
VCS Simulator: <Vivado-install-path>/data/simmodels/vcs/S-2021.09/
lnx64/9.2.0/systemc/protected/
Unprotected Models
The unprotected models are released as a source code in the install. You need to compile the
model for the target simulator using the compile_simlib ulity. For Vivado
®
simulator, these
unprotected models are pre-compiled in the standard <Vivado-install-path>/data/xsim
folder where other libraries are compiled. For third party simulators, these models must be
compiled using compile_simlib. The following un-protected models are delivered as part of
Vivado installaon:
aie_xtlm
axi_tg_sc
axis_dwidth_converter_sc
axis_switch_sc
common_cpp
common_rpc
debug_tcp_server
emu_perf_common
noc_sc
pl_fileio
remote_port_c
remote_port_sc
rwd_tlmmodel
sim_ddr
sim_qdma_cpp
sim_qdma_sc
sim_xdma_cpp
sim_xdma_sc
tlm_ext
xtlm
Appendix F: SystemC Support in Vivado IDE
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 221
xtlm_ap_ctrl
xtlm_ipc
xtlm_simple_interconnect
xtlm_trace_model
These simulaon model sources are present in the following installaon path:
<Vivado-install-path>/data/systemc/
The following IP support SystemC simulaon:
processing_system7_v5_5_6
versal_cips_v3_2_0
zynq_ultra_ps_e_v3_2_6
zynq_ultra_ps_e_v3_3_8
Note: GCC version to compile these models should be supported version as menoned in this user guide.
SystemC Simulation Using Vivado
Running SystemC simulaon design needs:
Creang design sources
Compiling simulaon models using compile_simlib
Specify tool/design sengs needed
c/c++/SystemC sources can be compiled using GCC. Each simulator supports dierent versions
of GCC. If design contains Xilinx provided SystemC models, GCC version used should be the
supported version. Design needs to be re-compiled if GCC version changes.
Simulators Supported for SystemC Simulation
Following are the simulators supported for SystemC simulaon in the Vivado
®
Design Suite:
Table 42: Simulators Supported for SystemC Simulation
Simulator Version
Compatible GCC
Version
SystemC Compiler
Vivado
®
simulator 2022.1 6.2.0 XSC
Siemens EDA Questa Advanced
simulator
2021.3 7.4.0 SCCOM
Appendix F: SystemC Support in Vivado IDE
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 222
Table 42: Simulators Supported for SystemC Simulation (cont'd)
Simulator Version
Compatible GCC
Version
SystemC Compiler
Cadence Xcelium Parallel simulator 21.09.002 9.3 XMSC
VCS S-2021.09 9.2.0 SYSCAN
Riviera 2021.04 9.3 CCOMP
Simulator Settings for Third-Party Tools
Table 43: Simulator Settings for Third Party Tools
Simulator Linux
Questa
setenv MODEL_TECH <tool installation path>
setenv LM_LICENSE_FILE <license file>
setenv PATH ${MODEL_TECH}/bin:$PATH
Xcelium
setenv CDS_INST_DIR <xcelium_install_dir>
setenv LD_LIBRARY_PATH $CDS_INST_DIR/tools/xcelium/
lib:$LD_LIBRARY_PATH
setenv PATH $CDS_INST_DIR/tools/xcelium/
bin:$CDS_INST_DIR/tools/bin:$PATH
setenv CDS_LICENSE_DIR <tool_license>
VCS
setenv VCS_HOME <tool_install_path>
setenv SYSTEMC_HOME $VCS_HOME/linux64/lib
setenv LM_LICENSE_FILE <license file>
setenv VG_GNU_PACKAGE /tools/installs/synopsys/vg_gnu/
2020.12/linux
setenv PATH ${VCS_HOME}/bin:${PATH}
source $VG_GNU_PACKAGE/source_me[.sh|.csh]
Riviera
source <tool_install_dir>/etc/setenv
source <tool_install_dir>etc/setgcc
export ALDEC_LICENSE_FILE=<tool_license>
Note: By default, GCC path is auto determined from the tool installaon locaon for Questa and Xcelium.
GCC Path Settings
The following table describes GCC executable path sengs for compile_simlib and
launch_simulation:
Table 44:
GCC Path Settings
Command Settings
compile_simlib
Specify the GCC compiler install path using -gcc_exec_path switch.
If not, set the environment variable GCC_SIM_EXE_PATH <gcc_install_dir>.
Appendix F: SystemC Support in Vivado IDE
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 223
Table 44: GCC Path Settings (cont'd)
Command Settings
launch_simulation
Specify the GCC compiler install path using -gcc_install_path switch.
If not, set the property using set_property
simulator.<name>_gcc_install_dir <gcc_path> [current_project]
If not, set the environment variable GCC_SIM_EXE_PATH <gcc_install_dir>.
Note: If these recommended sengs are not found, Vivado would pick install path from PATH env variable.
Also, it is always recommended to use tool nave SystemC compilers.
Running SystemC Simulation Using Vivado
Simulator
For step-by-step demonstraon on how to run Vivado
®
simulaon, see Vivado Design Suite User
Guide: Release Notes, Installaon, and Licensing (UG973).
Note: If you are using the Vivado simulator, be sure to specify all appropriate project sengs for your
design before running simulaon.
Appendix F: SystemC Support in Vivado IDE
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 224
Appendix G
Automated Testbench Generation
for Sub-Design
From 2021.2 onwards, new methodology is introduced in Vivado simulator (XSim) to create a
realisc funconal testbench for a language independent sub-design unit. This methodology
currently works for Verilog/VHDL/System Verilog and mixed design of these language. To use
this methodology, two new Tcl commands are introduced. Usage of this new methodology with a
real design is explained in subsequent secons.
generate_vcd_ports
The generate_vcd_port command opens a VCD le handle for wring port acvity of the
given instance. This VCD le is read by create_testbench Tcl command to read port acvity
for wring the smuli source. The instance can be selected from the scope window in the Vivado
simulator IDE or by specifying the hierarchical path to the instance when execung this
command from Tcl console. The command creates dummports.vcd le that gets populated
when running simulaon for the selected instance scope.
Note: The Vivado simulator must be acve to generate this le for the selected instance.
If running this command from Vivado IDE, then the dumpports.vcd le is created in the
simulaon run directory. If running this command from Vivado simulator standalone GUI, then
the dumpports.vcd le is created in vcd2tb sub-directory of the current directory. Following
are the generate_vcd_port opons:
-scope <arg> (required): Specify the instance scope hierarchy name.
-quiet (oponal): Execute the command quietly, returning no messages from the command.
The command also returns TCL_OK regardless of any errors encountered during execuon.
Note: Any errors encountered on the command-line while launching the command are returned. Only
errors occurring inside the command are trapped.
-verbose (oponal): Temporarily override any message limits and return all messages from this
command.
Note: Message limits can be dened with the set_msg_config command.
Appendix G: Automated Testbench Generation for Sub-Design
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 225
Following example command creates a VCD le for /top/DUT/fifo/buf_1 instance of type
buf module, record waveform acvity for 2000ns, and close the VCD le handle:
generate_vcd_ports {/top/DUT/fifo/buf_1}
run 2000ns
close_vcd -ports
create_testbench
Create testbench for a design unit instance. This command creates a funconal system verilog
based testbench for the scoped hierarchical instance. The testbench contains port/signal
specicaon, parameter declaraon, smuli vector include le, and module instanaon of the
selected instance as design under test (DUT). This command allows you to add the testbench to
an exisng or a new simulaon leset from which the simulaon can be launched.
Note: The generated testbench is simulator independent.
Table 45: create_testbench Command Options
Option Description
-name <arg> Specify the name of the testbench module name. Default name is testbench.
-add_to_simset <arg> Specify simulation fileset name to which the testbench needs to be added. If this
switch is not specified, then the command adds testbench to the current active
simulation fileset.
-set_as_top Set the generated testbench module at the top in the simulation fileset where the
testbench is added.
-mode <arg> Specifies simulation mode. Allowed values are behavioral, post-synthesis, or post-
implementation. Default is behavioral.
-type <arg> Specifies simulation type. Allowed values are functional or timing (not applicable
for behavioral mode).
-force Overwrite existing testbench file.
-quiet Execute the command quietly, returning no messages from the command. The
command also returns TCL_OK regardless of any errors encountered during
execution.
Note: Any errors encountered on the command-line while launching the command
are returned. Only errors occurring inside the command are trapped.
-verbose Temporarily override any message limits and return all messages from this
command.
Note: Message limits can be defined with the set_msg_config command.
Notes:
1. All the arguments are optional as default value is set as explained for each flag.
Appendix G: Automated Testbench Generation for Sub-Design
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 226
The following example command creates a testbench for fo module and adds it to the
sub_design_fifo simulaon leset:
create_testbench -name fifo -add_to_simset sub_design_fifo
The following example command generates VCD le for /top/DUT/fifo/buf_1 instance of
type buf module, record the waveform acvity in the VCD le for 2000ns, create a testbench
with module named tb, add the testbench to the test_buffer simulaon leset and set tb as
top module in this leset:
generate_vcd_ports {/top/DUT/fifo/buf_1}
run 2000ns
close_vcd -ports
create_testbench -name tb -add_to_simset test_buffer -set_as_top
Using Automated Testbench Generation on
Example Design
For demo purpose, let us use the BFT example design shipped with Vivado IDE.
1. Open the BFT example design in Vivado IDE.
2. Call launch_simulation with Vivado as the selected simulator. You should see the ports
shown in the following waveform.
3. Select the desired scope for which you want to generate testbench as shown in the following
gure:
Appendix G: Automated Testbench Generation for Sub-Design
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 227
4. Right-click the selected scope and select Generate VCD Port.
Appendix G: Automated Testbench Generation for Sub-Design
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 228
5. Delete all exisng signals on the waveform and select Add to Wave Window for the selected
scope.
Note: Step 5 will be used to demonstrate that the generated testbench is driving the design unit
correctly.
6. Use restart, run 2000 ns and close_vcd -ports commands on Tcl console to dump
the signal acvity. This logs the signal from me 0 to 2000 ns on the waveform as shown in
the following gure:
7. Use create_testbench -name demo_tb -add_to_simset demo_simset -
set_as_top command on Tcl console to generate testbench. This creates your testbench
with the module name demo_tb and creates a demo_simset with this testbench as top
module.
Appendix G: Automated Testbench Generation for Sub-Design
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 229
8. Use launch_simulation command to run simulaon with the newly generated testbench.
9. Compare the input/output of the waveform with waveform of your original design, noce
that the input/output are same.
This is how you can create testbench for your sub-design and use the generated testbench
independently with any standard simulator.
Appendix G: Automated Testbench Generation for Sub-Design
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 230
Appendix H
Handling Special Cases
Using Global Reset and 3-State
Xilinx devices have dedicated roung and circuitry that connect to every register in the device.
Global Set and Reset Net
During conguraon, the dedicated Global Set/Reset (GSR) signal is asserted. The GSR signal is
deasserted upon compleon of device conguraon. All the ip-ops and latches receive this
reset, and are set or reset depending on how the registers are dened.
Although you can access the GSR net aer conguraon, avoid use of the GSR circuitry in place
of a manual reset. This is because the FPGA devices oer high-speed backbone roung for high
fanout signals such as a system reset. This backbone route is faster than the dedicated GSR
circuitry, and is easier to analyze than the dedicated global roung that transports the GSR signal.
In post-synthesis and post-implementaon simulaons, the GSR signal is automacally asserted
for the rst 100 ns to simulate the reset that occurs aer conguraon.
A GSR pulse can oponally be supplied in pre-synthesis funconal simulaons, but is not
necessary if the design has a local reset that resets all registers.
TIP:
When you create a test bench, remember that the GSR pulse occurs automacally in the post-
synthesis and post-implementaon simulaon. This holds all registers in reset for the rst 100 ns of the
simulaon.
Note
: If a design uses ICAP primive, GSR will last for 1.281 us at that me.
Global 3-State Net
In addion to the dedicated global GSR, output buers are set to a high impedance state during
conguraon mode with the dedicated Global 3-state (GTS) net. All general-purpose outputs are
aected whether they are regular, 3-state, or bidireconal outputs during normal operaon. This
ensures that the outputs do not erroneously drive other devices as the FPGA is congured.
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 231
In simulaon, the GTS signal is usually not driven. The circuitry for driving GTS is available in the
post-synthesis and post-implementaon simulaons and can be oponally added for the pre-
synthesis funconal simulaon, but the GTS pulse width is set to 0 by default.
Using Global 3-State and Global Set and Reset
Signals
The following gure shows how Global 3-State (GTS) and Global Set/Reset (GSR) signals are used
in an FPGA.
Figure 53: Built-in FPGA Initialization Circuitry Diagram
X8352
User
Programmable
Latch/Register
Global Tri-State
(GTS)
User Output
I/O
Pad
Output Buffer
Input Buffer
User Input
User Tri-State
Enable
General Purpose
I/Os Used for
Initialization
GTS
GSR
User
Async.
Reset
Global
Set/Reset
(GSR)
Initialization
Controller
User
Programmable
Logic
Resources
Q
D
CLR
C
CE
Global Set and Reset and Global 3-State Signals in
Verilog
The GSR and GTS signals are dened in the <Vivado_Install_Dir>/data/verilog/src/
glbl.v module.
In most cases, GSR and GTS need not be dened in the test bench.
The glbl.v le declares the global GSR and GTS signals and automacally pulses GSR for 100
ns.
Global Set and Reset and Global 3-State Signals in
VHDL
The GSR and GTS signals are dened in the le: <Vivado_Install_Dir>/data/vhdl/src/
unisims/primitive/GLBL_VHD.vhd.
To use the GLBL_VHD component you must instanate it into the test bench.
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 232
The GLBL_VHD component declares the global GSR and GTS signals and automacally pulses
GSR for 100 ns.
The following code snippet shows an example of instanang the GLBL_VHD component in the
test bench and changing the asseron pulse width of the Reset on Conguraon (ROC) to 90 ns:
GLBL_VHD inst:GLBL_VHD generic map (ROC_WIDTH => 90000);
Delta Cycles and Race Conditions
This user guide describes event-based simulators. Event-based simulators can process mulple
events at a given simulaon me. While these events are being processed, the simulator cannot
advance the simulaon me. This event processing me is commonly referred to as delta cycles.
There can be mulple delta cycles in a given simulaon me step.
Simulaon me is advanced only when there are no more transacons to process for the current
simulaon me. For this reason, simulators can give unexpected results, depending on when the
events are scheduled within a me step. The following VHDL coding example shows how an
unexpected result can occur.
VHDL Coding Example With Unexpected Results
clk_b <= clk;
clk_prcs : process (clk)
begin
if (clk'event and clk='1') then
result <= data;
end if;
end process;
clk_b_prcs : process (clk_b)
begin
if (clk_b'event and clk_b='1') then
result1 <= result;
end if;
end process;
In this example, there are two synchronous processes:
clk_prcs
clk_b_prcs
The simulator performs the clk_b <= clk assignment before advancing the simulaon me.
As a result, events that should occur in two clock edges occur in one clock edge instead, causing
a race condion.
Recommended ways to introduce causality in simulators for such cases include:
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 233
Do not change clock and data at the same me. Insert a delay at every output.
Use the same clock.
Force a delta delay by using a temporary signal, as shown in the following example:
clk_b <= clk;
clk_prcs : process (clk)
begin
if (clk'event and clk='1') then
result <= data;
end if;
end process;
result_temp <= result;
clk_b_prcs : process (clk_b)
begin
if (clk_b'event and clk_b='1') then
result1 <= result_temp;
end if;
end process;
Most event-based simulators can display delta cycles. Use this to your advantage when
debugging simulaon issues.
Using the ASYNC_REG Constraint
The ASYNC_REG constraint:
Idenes asynchronous registers in the design
Disables X propagaon for those registers
The ASYNC_REG constraint can be aached to a register in the front-end design by using either:
An aribute in the HDL code
A constraint in the Xilinx Design Constraints (XDC)
The registers to which ASYNC_REG are aached retain the previous value during ming
simulaon, and do not output an X to simulaon. Use care; a new value might have been clocked
in as well.
The ASYNC_REG constraint is applicable to CLB and Input Output Block (IOB) registers and
latches only. For more informaon, see ASYNC_REG constraint at this link in the Vivado Design
Suite Properes Reference Guide (UG912).
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 234
If you cannot avoid clocking in asynchronous data, do so for IOB or CLB registers only. Clocking
in asynchronous signals to RAM, Shi Register LUT (SRL), or other synchronous elements has less
determinisc results; therefore, should be avoided. Xilinx highly recommends that you rst
properly synchronize any asynchronous signal in a register, latch, or FIFO before wring to a
RAM, Shi Register LUT (SRL), or any other synchronous element. For more informaon, see the
Vivado Design Suite User Guide: Using Constraints (UG903).
Disabling X Propagation for Synchronous Elements
When a ming violaon occurs during a ming simulaon, the default behavior of a latch,
register, RAM, or other synchronous elements is to output an X to the simulator. This occurs
because the actual output value is not known. The output of the register could:
Retain its previous value
Update to the new value
Go metastable, in which a denite value is not seled upon unl some me aer the clocking
of the synchronous element
Because this value cannot be determined, and accurate simulaon results cannot be guaranteed,
the element outputs an X to represent an unknown value. The X output remains unl the next
clock cycle in which the next clocked value updates the output if another violaon does not
occur.
The presence of an X output can signicantly aect simulaon. For example, an X generated by
one register can be propagated to others on subsequent clock cycles. This can cause large
porons of the design under test to become unknown.
To correct X-generaon:
On a synchronous path, analyze the path and x any ming problems associated with this or
other paths to ensure a properly operang circuit.
On an asynchronous path, if you cannot otherwise avoid ming violaons, disable the X
propagaon on synchronous elements during ming violaons by using the ASYNC_REG
property.
When X propagaon is disabled, the previous value is retained at the output of the register. In
the actual silicon, the register might have changed to the 'new' value. Disabling X propagaon
might yield simulaon results that do not match the silicon behavior.
CAUTION!
Exercise care when using this opon. Use it only if you cannot otherwise avoid ming
violaons.
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 235
Simulating Configuration Interfaces
This secon describes the simulaon of the following conguraon interfaces:
JTAG simulaon
SelectMAP simulaon
JTAG Simulation
BSCAN component simulaon is supported on all devices.
The simulaon supports the interacon of the JTAG ports and some of the JTAG operaon
commands. The JTAG interface, including interface to the scan chain, is not fully supported. To
simulate this interface:
1. Instanate the BSCANE2 component and connect it to the design.
2. Instanate the JTAG_SIME2 component into the test bench (not the design).
This becomes:
The interface to the external JTAG signals (such as TDI, TDO, and TCK)
The communicaon channel to the BSCAN component
The communicaon between the components takes place in the VPKG VHDL package le or the
glbl Verilog global module. Accordingly, no implicit connecons are necessary between the
specic JTAG_SIME2 component and the design, or the specic BSCANE2 symbol.
Smulus can be driven and viewed from the specic JTAG_SIME2 component within the test
bench to understand the operaon of the JTAG/BSCAN funcon. Instanaon templates for
both of these components are available in both the Vivado
®
Design Suite templates and the
specic-device libraries guides.
SelectMAP Simulation
The conguraon simulaon models (SIM_CONFIGE2 and SIM_CONFIGE3) with an
instanaon template allow supported conguraon interfaces to be simulated to ulmately
show the DONE pin going HIGH. This is a model of how the supported devices react to smulus
on the supported conguraon interface.
The following table lists the supported interfaces and devices.
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 236
Table 46: Supported Configuration Devices and Modes
Devices SelectMAP Serial SPI BPI
7 series and Zynq
®
-7000 SoC
Devices
Yes Yes No No
UltraScale Devices Yes Yes No No
UltraScale+™ Devices Yes Yes No No
The models handle control signal acvity as well as bit le downloading. Internal register sengs
such as the CRC, IDCODE, and status registers are included. You can monitor the Sync Word as it
enters the device and the start-up sequence as it progresses. The following gure illustrates how
the system should map from the hardware to the simulaon environment.
The conguraon process is specically outlined in the conguraon user guides for each device.
These guides contain informaon on the conguraon sequence, as well as the conguraon
interfaces.
Figure 54: Block Diagram of Model Interaction
Host Controller - Input Stimulus to Model
Configuration Simulation Model
IDCODE Parameter
Memory
Controller
Target FPGA
Bit File
User
Memory
SelectMAP
Control
Logic
CCLK
Data [0-n]
RDWR
PROG_B
INIT_B
CS
Mode Pins [2:0]
1 1 0
X10194
System Level Description
The conguraon models allow the conguraon interface control logic to be tested before the
hardware is available. It simulates the enre device, and is used at a system level for:
Applicaons using a processor to control the conguraon logic to ensure proper wiring,
control signal handling, and data input alignment.
Applicaons that control the data loading process with the CS (SelectMAP Chip Select) or CLK
signal to ensure proper data alignment.
Systems that need to perform a SelectMAP ABORT or Readback.
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 237
The config_test_bench.zip le has sample test benches that simulate a processor running
the SelectMAP logic. These test benches have control logic to emulate a processor controlling
the SelectMAP interface, and include features such as a full conguraon, ABORT, and Readback
of the IDCODE and status registers.
For the ZIP les associated with this model, see Xilinx Answer Record 53632.
The simulated host system must have a method for le delivery as well as control signal
management. These control systems should be designed as set forth in the device conguraon
user guides.
The conguraon models also demonstrate what is occurring inside the device during the
conguraon procedure when a BIT le is loaded into the device.
During the BIT le download, the model processes each command and changes registers sengs
that mirror the hardware changes.
You can monitor the CRC register as it acvely accumulates a CRC value. The model also shows
the Status Register bits being set as the device progresses through the dierent states of
conguraon.
Debugging with the Model
Each conguraon model provides an example of a correct conguraon. You can leverage this
example to assist in the debug procedure if you encounter device programming issues.
You can read the Status Register through JTAG using the Vivado Device Programmer tool. This
register contains informaon relang to the current status of the device and is a useful
debugging resource. If you encounter issues on the board, reading the Status Register in Vivado
Device Programmer is one of the rst debugging steps to take.
Aer the status register is read, you can map it to the simulaon to pinpoint the conguraon
stage of the device.
For example, the GHIGH bit is set HIGH aer the data load process completes successfully; if this
bit is not set, then the data loading operaon did not complete. You can also monitor the GTW,
GWE, and DONE signals set in BitGen that are released in the start-up sequence.
The conguraon models also allow for error injecon. The acve CRC logic detects any issue if
the data load is paused and started again with any problems. It also detects bit ips manually
inserted in the BIT le, and handles them just as the device would handle this error.
Feature Support
Each device-specic conguraon user guide outlines the supported methods of interacng with
each conguraon interface.The table below shows which features discussed in the conguraon
user guides are supported.
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 238
The SIM_CONFIGE2 model:
Does not support Readback of conguraon data.
Does not store conguraon data provided, although it does calculate a CRC value.
Can perform Readback on specic registers only to ensure that a valid command sequence
and signal handling is provided to the device.
Is not intended to allow Readback data les to be produced.
Table 47: Model-Supported Slave SelectMAP and Serial Features
Slave SelectMAP and Serial Features Supported
Master mode No
Daisy chain - slave parallel daisy chains No
SelectMAP data loading Yes
Continuous SelectMAP data loading Yes
Non-continuous SelectMAP data loading Yes
SelectMAP ABORT Yes
SelectMAP reconfiguration No
SelectMAP data ordering Yes
Reconfiguration and MultiBoot No
Configuration CRC—CRC checking during configuration Yes
Configuration CRC—post-configuration CRC No
Disabling Block RAM Collision Checks for
Simulation
Xilinx
®
block RAM memory is a true dual-port RAM where both ports can access any memory
locaon at any me. Be sure that the same address space is not accessed for reading and wring
at the same me. This causes a block RAM address collision. These are valid collisions, because
the data that is being read from the read port is not valid.
In the hardware, the value that is read might be the old data, the new data, or a combinaon of
the old data and the new data.
In simulaon, this is modeled by outpung X because the value read is unknown. For more
informaon on block RAM collisions, see the user guide for the device.
In certain applicaons, this situaon cannot be avoided or designed around. In these cases, the
block RAM can be congured not to look for these violaons. This is controlled by the generic
(VHDL) or parameter (Verilog) SIM_COLLISION_CHECK string in block RAM primives.
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 239
The following table shows the string opons you can use with SIM_COLLISION_CHECK to
control simulaon behavior in the event of a collision.
Table 48: SIM_COLLISION_CHECK Strings
String
Write Collision
Messages
Write Xs on the Output
ALL Yes Yes
WARNING_ONLY Yes No. Applies only at the time of collision. Subsequent reads of
the same address space could produce Xs on the output.
GENERATE_X_ONLY No Yes
None No No. Applies only at the time of collision. Subsequent reads of
the same address space could produce Xs on the output.
Apply the SIM_COLLISION_CHECK at an instance level so you can change the seng for each
block RAM instance.
Dumping the Switching Activity Interchange
Format File for Power Analysis
Vivado simulator: Power Analysis Using Vivado Simulator
Dumping SAIF for Power Analysis, and Dumping SAIF in VCS in Chapter 3: Simulang with
Third-Party Simulators
Skipping Compilation or Simulation
Skipping Compilation
You can run simulaon on an exisng snapshot and skip the compilaon (or recompilaon) of the
design by seng the SKIP_COMPILATION property on the simulaon leset:
set_property SKIP_COMPILATION 1 [get_filesets sim_1]
Note: Any change to design les aer the last compilaon is not reected in simulaon when you set this
property.
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 240
Skipping Simulation
To perform a semanc check on the design HDL les, by elaborang and compiling the
simulaon snapshot without running simulaon, you can set the SKIP_SIMULATION property on
the simulaon leset:
set_property SKIP_SIMULATION true [get_filesets sim_1]
IMPORTANT! If you elect to use one of the properes above, disable the Clean up simulaon les check
box in the simulaons sengs, or if you are running in batch/Tcl mode, call
launch_simulation
with
-noclean_dir
.
Appendix H: Handling Special Cases
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 241
Appendix I
Value Rules in Vivado Simulator Tcl
Commands
This appendix contains the value rules that apply to both the add_force and the set_value
Tcl commands.
String Value Interpretation
The interpretaon of the value string is determined by the declared type of the HDL object and
the -radix command line opon. The -radix always overrides the default radix determined by
the HDL object type.
For HDL objects of type logic, the value is a one-dimensional array of the logic type or
the value is a string of digits of the specied radix.
If the string species less bits than the type expects, the string is implicitly zero-extended
(not sign-extended) to match the length of the type.
If the string species more bits than the type expects, the extra bits on the MSB side must
be zero; otherwise the command generates a size mismatch error.
For example: The value 3F species 8 bits (4 per hex digit) with radix hex and a 6 bit logic
array, equivalent to binary 0011 1111. But, because the upper two bits of 3 are zero, the
value can be assigned to the HDL object. In contrast, the value 7F would generate an error,
because the upper two bits are not zero.
A scalar (not array or record) logic HDL object has an implicit length of 1 bit.
For a logic array declared as a [left:right] (Verilog) or a(left TO/DOWNTO
right), the le-most value bit (aer extension/truncaon) is assigned to a[left] and
the right-most value bit is assigned to a[right].
Vivado Design Suite Simulation Logic
The logic is not a concept dened in HDL but is a heurisc introduced by the Vivado
®
simulator.
Appendix I: Value Rules in Vivado Simulator Tcl Commands
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 242
A Verilog object is considered to be of logic type if it is of the implicit Verilog bit type, which
includes wire and reg objects, as well as integer and me.
A VHDL object is considered to be of logic type if the objects type is bit, std_logic, or
any enumeraon type whose enumerators are a subset of those of std_logic and include at
least 0 and 1, or type of the object is a one-dimensional array of such a type.
For HDL objects, which are of VHDL enumeraon type, the value can be one of the
enumerator literals, without single quotes if the enumerator is a character literal. Radix is
ignored.
For VHDL objects, of integral type, the value can be a signed decimal integer in the range of
the type. Radix is ignored.
For VHDL and Verilog oang point types the value can be a oang point value. Radix is
ignored.
For all other types of HDL objects, the Tcl command set does not support seng values.
Appendix I: Value Rules in Vivado Simulator Tcl Commands
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 243
Appendix J
Vivado Simulator Mixed Language
Support and Language Exceptions
The Vivado Integrated Design Environment (IDE) supports the following languages:
VHDL, see EEE Standard VHDL Language Reference Manual (IEEE-STD-1076-1993)
Verilog, see IEEE Standard Verilog Hardware Descripon Language (IEEE-STD-1364-2001)
SystemVerilog Synthesizable subset. See IEEE Standard for SystemVerilog--Unied Hardware
Design, Specicaon, and Vericaon Language (IEEE-STD-1800-2009)
IEEE P1735 encrypon, see Recommended Pracce for Encrypon and Management of
Electronic Design Intellectual Property (IP) (IEEE-STD-P1735)
This appendix lists the applicaon of Mixed Language in the Vivado simulator, and the excepons
to Verilog, SystemVerilog, and VHDL support.
Using Mixed Language Simulation
The Vivado simulator supports mixed language project les and mixed language simulaon. This
lets you include Verilog/SystemVerilog (SV) modules in a VHDL design, and vice versa.
Restrictions on Mixed Language in Simulation
A VHDL design can instanate Verilog/SystemVerilog (SV) modules and a Verilog/SV design
can instanate VHDL components. Component instanaon-based default binding is used for
binding a Verilog/SV module to a VHDL component. Any other kind of mixed use of VHDL
and Verilog, such as VHDL process calling a Verilog funcon, is not supported.
A subset of VHDL types, generics, and ports are allowed on the boundary to a Verilog/SV
module. Similarly, a subset of Verilog/SV types, parameters and ports are allowed on the
boundary to VHDL components. See Table 50: Supported VHDL and Verilog Data Types.
IMPORTANT!
Connecng whole VHDL record object to a Verilog object is unsupported; however,
VHDL record elements of a supported type can be connected to a compable Verilog port.
A Verilog/SV hierarchical reference cannot refer to a VHDL unit nor can a VHDL expanded or
selected name refer to a Verilog/SV unit.
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 244
Key Steps in a Mixed Language Simulation
1. Oponally, specify the search order for VHDL components or Verilog/SV modules in the
design libraries of a mixed language project.
2. Use xelab -L to specify the binding order of a VHDL component or a Verilog/SV module in
the design libraries of a mixed language project.
Note: The library search order specied by -L is used for binding Verilog modules to other Verilog
modules as well.
Mixed Language Binding and Searching
When you instanate a VHDL component in a Verilog/SV module or a Verilog/SV module in a
VHDL architecture, the xelab command:
First searches for a unit of the same language as that of the instanang design unit.
If a unit of the same language is not found, xelab searches for a cross-language design unit in
the libraries specied by the -L opon.
The search order is the same as the order of appearance of libraries on the xelab command line.
Note: When using the Vivado IDE, the library search order is specied automacally. No user intervenon
is necessary or possible.
Related Information
Verilog Search Order
Instantiating Mixed Language Components
In a mixed language design, you can instanate a Verilog/SV module in a VHDL architecture or a
VHDL component in a Verilog/SV module as described in the following subsecons.
To ensure that you are correctly matching port types, review the Port Mapping and Supported
Port Types.
Instantiating a Verilog Module in a VHDL Design Unit
1. Declare a VHDL component with the same name and in the same case as the Verilog module
that you want to instanate. For example:
COMPONENT MY_VHDL_UNIT PORT (
Q : out STD_ULOGIC;
D : in STD_ULOGIC;
C : in STD_ULOGIC );
END COMPONENT;
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 245
2. Use named or posional associaon to instanate the Verilog module. For example:
UUT : MY_VHDL_UNIT PORT MAP(
Q => O,
D => I,
C => CLK);
Instantiating a VHDL Component in a Verilog/SV Design Unit
To instanate a VHDL component in a Verilog/SV design unit, instanate the VHDL component
as if it were a Verilog/SV module.
For example:
module testbench ;
wire in, clk;
wire out;
FD FD1(
.Q(Q_OUT),
.C(CLK);
.D(A);
);
Port Mapping and Supported Port Types
The following table lists the supported port types.
Table 49: Supported Port Types
VHDL
1
Verilog/SV
2
IN INPUT
OUT OUTPUT
INOUT INOUT
Notes:
1. Buffer and linkage ports of VHDL are not supported.
2. Connection to bi-directional pass switches in Verilog are not supported. Unnamed Verilog ports are not allowed on
mixed design boundary.
The following table shows the supported VHDL and Verilog data types for ports on the mixed
language design boundary.
Table 50: Supported VHDL and Verilog Data Types
VHDL Port Verilog Port
bit
net
std_logic
net
bit_vector
vector net
signed
vector net
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 246
Table 50: Supported VHDL and Verilog Data Types (cont'd)
VHDL Port Verilog Port
unsigned
vector net
std_ulogic_vector
vector net
std_logic_vector
vector net
Note: Verilog output port of type reg is supported on the mixed language boundary. On the boundary, an
output reg port is treated as if it were an output net (wire) port. Any other type found on mixed language
boundary is considered an error.
Note: The Vivado simulator supports the record element as an actual in the port map of a Verilog module
that is instanated in the mixed domain. All those types that are supported as VHDL port (listed in Table
50: Supported VHDL and Verilog Data Types) are also supported as a record element.
Table 51: Supported SV and VHDL Data Types
SV Data type VHDL Data type
Int
bit_vector
std_logic_Vector
std_ulogic_vector
signed
unsigned
byte
bit_vector
std_logic_Vector
std_ulogic_vector
signed
unsigned
shortint
bit_vector
std_logic_Vector
std_ulogic_vector
signed
unsigned
longint
bit_vector
std_logic_Vector
std_ulogic_vector
signed
unsigned
integer
bit_vector
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 247
Table 51: Supported SV and VHDL Data Types (cont'd)
SV Data type VHDL Data type
std_logic_Vector
std_ulogic_vector
signed
unsigned
vector of bit(1D)
bit_vector
std_logic_Vector
std_ulogic_vector
signed
unsigned
vector of logic(1D)
bit_vector
std_logic_Vector
std_ulogic_vector
signed
unsigned
vector of reg(1D)
bit_vector
std_logic_Vector
std_ulogic_vector
signed
unsigned
logic/bit
bit
std_logic
std_ulogic
bit_vector
std_logic_Vector
std_ulogic_vector
signed
unsigned
Note: VHDL enty instanang Verilog Module having real port is supported.
Generics (Parameters) Mapping
The Vivado simulator supports the following VHDL generic types (and their Verilog/SV
equivalents):
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 248
integer
real
string
boolean
Note: Any other generic type found on mixed language boundary is considered an error.
VHDL and Verilog Values Mapping
The following table lists the Verilog states mappings to std_logic and bit.
Table 52: Verilog States Mapped to std_logic and bit
Verilog std_logic bit
Z Z 0
0 0 0
1 1 1
X X 0
Note: Verilog strength is ignored. There is no corresponding mapping to strength in VHDL.
The following table lists the VHDL type bit mapping to Verilog states.
Table 53: VHDL bit Mapping to Verilog States
bit Verilog
0 0
1 1
The folowing table lists the VHDL type std_logic mappings to Verilog states.
Table 54: VHDL std_logic Mapping to Verilog States
std_logic Verilog
U X
X X
0 0
1 1
Z Z
W X
L 0
H 1
- X
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 249
Because Verilog is case sensive, named associaons and the local port names that you use in
the component declaraon must match the case of the corresponding Verilog port names.
VHDL Language Support Exceptions
Certain language constructs are not supported by the Vivado simulator. The following table lists
the VHDL language support excepons.
Table 55: VHDL Language Support Exceptions
Supported VHDL Construct Exceptions
abstract_literal
Floating point expressed as based literals are not supported.
alias_declaration
Alias to non-objects are in general not supported;
particularly the following:
Alias of an alias
Alias declaration without subtype_indication
Signature on alias declarations
Operator symbol as alias_designator
Alias of an operator symbol
Character literals as alias designators
alias_designator
Operator_symbol as alias_designator
Character_literal as alias_designator
association_element
Globally, locally static range is acceptable for taking slice of
an actual in an association element.
attribute_name
Signature after prefix is not supported.
binding_indication
Binding_indication without use of entity_aspect is not
supported.
bit_string_literal
Empty bit_string_literal (" ") is not supported.
block_statement
Guard_expression is not supported; for example, guarded
blocks, guarded signals, guarded targets, and guarded
assignments are not supported.
choice
Aggregate used as choice in case statement is not
supported.
concurrent_assertion_statement
Postponed is not supported.
concurrent_signal_assignment_statement
Postponed is not supported.
concurrent_statement
Concurrent procedure call containing wait statement is not
supported.
conditional_signal_assignment
Keyword guarded as part of options is not supported as
there is no supported for guarded signal assignment.
configuration_declaration
Non locally static for generate index used in configuration is
not supported.
entity_class
Literals, unit, file, and group as entity class are not
supported.
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 250
Table 55: VHDL Language Support Exceptions (cont'd)
Supported VHDL Construct Exceptions
entity_class_entry
Optional <> intended for use with group templates is not
supported.
file_logical_name
Although file_logical_name is allowed to be any wild
expression evaluating to a string value, only string literal and
identifier is acceptable as file name.
function_call
Slicing, indexing, and selection of formals is not supported in
a named parameter association within a function_call.
instantiated_unit
Direct configuration instantiation is not supported.
mode
Linkage and Buffer ports are not supported completely.
options
Guarded is not supported.
primary
At places where primary is used, allocator is expanded there.
procedure_call
Slicing, indexing, and selection of formals is not supported in
a named parameter association within a procedure_call.
process_statement
Postponed processes are not supported.
selected_signal_assignment
The guarded keyword as part of options is not supported as
there is no support for guarded signal assignment.
signal_declaration
The signal_kind is not supported. The signal_kind is
used for declaring guarded signals, which are not supported.
subtype_indication
Resolved subtype of composites (arrays and records) is not
supported.
waveform
Unaffected is not supported.
waveform_element
Null waveform element is not supported as it only has
relevance in the context of guarded signals.
Verilog Language Support Exceptions
The following table lists the excepons to supported Verilog language support.
Table 56: Verilog Language Support Exceptions
Verilog Construct Exception
Compiler Directive Constructs
`unconnected_drive
not supported
`nounconnected_drive
not supported
Attributes
attribute_instance
not supported
attr_spec
not supported
attr_name
not supported
Primitive Gate and Switch Types
cmos_switchtype
not supported
mos_switchtype
not supported
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 251
Table 56: Verilog Language Support Exceptions (cont'd)
Verilog Construct Exception
pass_en_switchtype
not supported
Generated Instantiation
generated_instantiation
The module_or_generate_item alternative is not supported.
Production from IEEE standard (see IEEE Standard Verilog Hardware
Description Language (IEEE-STD-1364-2001) section 13.2 ):
generate_item_or_null ::=
generate_conditonal_statement |
generate_case_statement |
generate_loop_statement |
generate_block |
module_or_generate_item
Production supported by Simulator:
generate_item_or_null ::=
generate_conditional_statement|
generate_case_statement |
generate_loop_statement |
generate_blockgenerate_condition
genvar_assignment
Partially supported.
All generate blocks must be named.
Production from standard (see IEEE Standard Verilog Hardware
Description Language (IEEE-STD-1364-2001) section 13.2):
generate_block ::=
begin
[ : generate_block_identifier ]
{ generate_item }
end
Production supported by Simulator:
generate_block ::=
begin:
generate_block_identifier {
generate_item }
end
Source Text Constructs
Library Source Text
library_text
not supported
library_descriptions
not supported
library_declaration
not supported
include_statement
This refers to include statements within library map files (See IEEE
Standard Verilog Hardware Description Language (IEEE-STD-1364-2001)
section 13.2. This does not refer to the `include compiler directive.
System Timing Check Commands
$skew_timing_check
not supported
$timeskew_timing_check
not supported
$fullskew_timing_check
not supported
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 252
Table 56: Verilog Language Support Exceptions (cont'd)
Verilog Construct Exception
$nochange_timing_check
not supported
System Timing Check Command Argument
checktime_condition
not supported
PLA Modeling Tasks
$async$nand$array
not supported
$async$nor$array
not supported
$async$or$array
not supported
$sync$and$array
not supported
$sync$nand$array
not supported
$sync$nor$array
not supported
$sync$or$array
not supported
$async$and$plane
not supported
$async$nand$plane
not supported
$async$nor$plane
not supported
$async$or$plane
not supported
$sync$and$plane
not supported
$sync$nand$plane
not supported
$sync$nor$plane
not supported
$sync$or$plane
not supported
Value Change Dump (VCD) Files
$dumpportson
$dumpports
$dumpportsoff
$dumpportsflush
$dumpportslimit
$vcdplus
not supported
Appendix J: Vivado Simulator Mixed Language Support and Language Exceptions
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 253
Appendix K
Vivado Simulator Quick Reference
Guide
The following table provides a quick reference and examples for common Vivado
®
simulator
commands.
Parsing HDL Files
Vivado simulator supports three HDL file types: Verilog, SystemVerilog and VHDL. You can parse the supported files using
XVHDL and XVLOG commands.
Parsing VHDL files
xvhdl file1.vhd file2.vhd
xvhdl -work worklib file1.vhd file2.vhd
xvhdl -prj files.prj
Parsing Verilog
files
xvlog file1.v file2.v
xvlog -work worklib file1.v file2.v
xvlog -prj files.prj
Parsing
SystemVerilog
files
xvlog -sv file1.v file2.v
xvlog -work worklib -sv file1.v file2.v
xvlog -prj files.prj
For information about the PRJ file format, see Project File (.prj) Syntax.
Additional xvlog and xvhdl Options
xvlog and xvhdl
Key Options
See Table 15: xelab, xvhd, and xvlog Command Options for a complete list of command options.
The following are key options for xvlog and xvhdl:
Key Option Applies to:
xelab, xvhdl, and xvlog xsim
Command Options
xvlog
xelab, xvhdl, and xvlog xsim
Command Options
xvlog, xvhdl
xelab, xvhdl, and xvlog xsim
Command Options
xvlog
xelab, xvhdl, and xvlog xsim
Command Options
xvlog, xvhdl
xelab, xvhdl, and xvlog xsim
Command Options
xvlog, xvhdl
xelab, xvhdl, and xvlog xsim
Command Options
xvlog, xvhdl
xelab, xvhdl, and xvlog xsim
Command Options
xvlog, xvhdl
xelab, xvhdl, and xvlog xsim
Command Options
xvhdl, vlog
xelab, xvhdl, and xvlog xsim
Command Options
xvlog, xvhdl
Appendix K: Vivado Simulator Quick Reference Guide
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 254
Elaborating and Generating an Executable Snapshot
After parsing, you can elaborate the design in Vivado simulator using the XELAB command. XELAB generates an
executable snapshot.
You can skip the parser stage, directly invoke the XELAB command, and pass the PRJ file. XELAB calls XVLOG and XVHDL for
parsing the files.
Usage
xelab top1 top2
Elaborates a design that has two top design units: top1 and top2.
In this example, the design units are compiled in the work library.
xelab lib1.top1 lib2.top2
Elaborates a design that has two top design units: top1 and top2.
In this example, the design units have are compiled in lib1 and
lib2, respectively
xelab top1 top2 -prj
files.prj
Elaborates a design that has two top design units: top1 and top2.
In this example, the design units are compiled in the work library.
The file files.prj contains entries such as:
verilog <libraryName>
<VerilogDesignFileName>
vhdl <libraryName> <VHDLDesignFileName>
sv <libraryName>
<SystemVerilogDesignFileName>
xelab top1 top2 -s top
Elaborates a design that has two top design units: top1 and top2.
In this example, the design units are compiled in the work library.
After compilation, xelab generates an executable snapshot with
the name top. Without the -s top switch, xelab creates the
snapshot by concatenating the unit names.
Command Line
Help and xelab
Options
xelab -help
Table 15: xelab, xvhd, and xvlog Command Options
Running Simulation
After parsing, elaboration and compilation stages are successful; xsim generates an executable snapshot to run
simulation.
Usage
xsim top -R
Simulates the design to through completion.
xsim top -gui
Opens the Vivado simulator workspace (GUI).
xsim top
Opens the Vivado Design Suite command prompt in Tcl mode.
From there, you can invoke such options as:
run -all
run 100 ns
Important Shortcuts
You can invoke the parsing, elaboration, and executable generation and simulation in one, two, or three stages.
Three Stage
xvlog bot.v
xvhdl top.vhd
xelab work.top -s top
xsim top -R
Two Stage
xelab -prj my_prj.prj work.top -s top
xsim top -R
where my_prj.prj file contains:
verilog work bot.v
vhdl work top.vhd
Single Stage
xelab -prj my_prj.prj work.top -s top -R
where my_prj.prj file contains:
verilog work bot.v vhdl work top.vhd
Appendix K: Vivado Simulator Quick Reference Guide
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 255
Note: If your design contain UVM construct then you need to pass -L uvm to xvlog and xelab command
Vivado Simulation Tcl Commands
The following are commonly used Tcl commands. For a complete list, invoke following commands in the Tcl Console:
load_features simulator
help -category simulation
For information on any Tcl Command, type: -help <Tcl_command>
Common Vivado
Simulator Tcl
Commands:
add_bp
Add break point at a line of HDL source.
add_force
Force the value of a signal, wire, or register to a specified value. Tcl
command exampled are provided on Using Force Commands.
current_time
now
Report current simulation time. See Using a -tclbatch File for an
example of this command within a Tcl script.
current_scope
Report or set the current, working HDL scope. See Scope Window
for more information.
get_objects
Get a list of HDL objects in one or more HDL scopes, per the
specified pattern. For example command usage refer to: Example
SAIF Tcl Commands.
get_scopes
Get a list of child HDL scopes. See Scope Window for more
information.
get_value
Get the current value of the selected HDL object (variable, signal,
wire, register). Type get_value -help in Tcl Console for more
information.
launch_simulation
Launch simulation using the Vivado simulator.
remove_bps
Remove breakpoints from a simulation.
report_drivers
Print drivers along with current driving values for an HDL wire or
signal object. Reference for more information: Using the
report_drivers Tcl Command.
report_values
Print current simulated value of given HDL objects (variables,
signals, wires, or registers). For example Tcl command usage, see
Scope Window.
restart
Rewind simulation to post loading state (as though the design was
reloaded); time is set to 0.
set_value
Set the HDL object (variable, signal, wire, or register) to a specified
value. Reference for more information: Appendix I: Value Rules in
Vivado Simulator Tcl Commands.
step
Step simulation to the next statement. See Stepping Through a
Simulation.
Appendix K: Vivado Simulator Quick Reference Guide
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 256
Appendix L
Using Xilinx Simulator Interface
The Xilinx
®
Simulator Interface (XSI) is a C/C++ applicaon programming interface (API) to the
Xilinx Vivado simulator (xsim) that enables a C/C++ program to serve as the test bench for a HDL
design. Using XSI, the C/C++ program controls the acvity of the Vivado simulator which hosts
the HDL design.
The C/C++ program controls the simulaon in the following methods:
Seng the values of the top-level input ports of the HDL design
Instrucng the Vivado simulator to run the simulaon for a certain amount of simulaon me
Addionally, the C/C++ program can read the values of the top-level output ports of the HDL
design.
Perform the following steps to use XSI in your C/C++ program:
1. Prepare the XSI API funcons to be called through dynamic linking
2. Write your C/C++ test bench code using the API funcons
3. Compile and link your C/C++ program
4. Package the Vivado simulator and the HDL design together into a shared library
Preparing the XSI Functions for Dynamic
Linking
Xilinx recommends the usage of dynamic linking for indirectly calling the XSI funcons. While
this technique involves more steps than simply calling XSI funcons directly, dynamic linking
allows you to keep the compilaon of your HDL design independent of the compilaon of your
C/C++ program. You can compile and load your HDL design at any me, even while your C/C++
program connues to run.
To call a funcon through dynamic linking requires your program to perform the following steps:
1. Open the shared library containing the funcon.
2. Look up the funcon by name to get a pointer to the funcon.
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 257
3. Call the funcon using the funcon pointer.
4. Close the shared library (oponal).
Steps 1, 2, and 4 require the use of OS-specic library calls, as shown in the following table. See
your operang system documentaon for details about these funcons.
Table 58: Operating System Specific Library Calls
Function Linux Windows
Open shared library
void *dlopen(const char
*filename, int flag);
HMODULE WINAPI
LoadLibrary(_In_ LPCTSTR
lpFileName
);
Look up function by name
void *dlsym(void
*handle, const char
*symbol);
FARPROC WINAPI
GetProcAddress(_In_
HMODULE hModule,_In_
LPCSTR lpProcName
);
Close shared library
int dlclose(void
*handle);
BOOL WINAPI
FreeLibrary(_In_ HMODULE
hModule
);
XSI requires you to call funcons from two shared libraries: the kernel shared library and your
design shared library. The kernel shared library ships with the Vivado simulator and is called
librdi_simulator_kernel.so (Linux) or librdi_simulator_kernel.dll (Windows).
It resides in the following directory:
<Vivado Installation Root>/lib/<platform>
where <platform> is lnx64.o or win64.o. Make sure to include this directory in your library
path while running your program. On Linux, include the directory in the environment variable
LD_LIBRARY_PATH, and on Windows, in the environment variable PATH.
Your design shared library, which the Vivado simulator creates in the course of compiling your
HDL design, as described in Preparing the Design Shared Library, is called xsimk.so (Linux) or
xsimk.dll (Windows) and typically resides at the following locaon:
<HDL design directory>/xsim.dir/<snapshot name>
where <HDL design directory> is the directory from which your design shared library was
created, and <snapshot name> is the name of the snapshot that you specify during the
creaon of the library.
Your C/C++ program will call the XSI funcon xsi_open() residing in your design shared library
and all other XSI funcons from the kernel shared library.
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 258
The XSI code examples that ship with the Vivado simulator consolidate the XSI funcons into a C
++ class called Xsi::Loader. The class accepts the names of the two shared libraries, internally
executes the necessary dynamic linking steps, and exposes all the XSI funcons as member
funcons of the class. Wrapping the XSI funcons in this manner eliminates the necessity of
calling the dynamic linking OS funcons directly. You can nd the source code for the class that
can be copied into your own program at the following locaon under your Vivado installaon:
<Vivado Installation Root>/examples/xsim/verilog/xsi/counter/xsi_loader.h
<Vivado Installation Root>/examples/xsim/verilog/xsi/counter/xsi_loader.cpp
To use Xsi::Loader, simply instanate it by passing the names of the two shared libraries as
shown in the following example:
#include "xsi_loader.h"
...
Xsi::Loader loader("xsim.dir/mySnapshot/xsimk.so",
"librdi_simulator_kernel.so");
Writing the Test Bench Code
A C/C++ test bench using XSI typically uses the following steps:
1. Open the design.
2. Fetch the IDs of each top-level port.
3. Repeat the following unl the simulaon is nished:
a. Set values on top-level input ports.
b. Run the simulaon for a specic amount of me.
c. Fetch the values of top-level output ports.
4. Close the design.
The following table lists the XSI funcons and their Xsi::Loader member funcon equivalents
to use for each step. You can nd the usage details for each XSI funcon in the XSI Funcon
Reference.
Table 59: Xsi: :Loader Member Functions
Activity XSI Function
Xsi::Loader Member Function
Open the design
xsi_open open
Fetch a port ID
xsi_get_port_number get_port_number
Set an input port value
xsi_put_value put_value
Run the simulation
xsi_run run
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 259
Table 59: Xsi: :Loader Member Functions (cont'd)
Activity XSI Function
Xsi::Loader Member Function
Fetch an output port
value
xsi_get_value get_value
Close the design
xsi_close close
You can nd the example C++ programs that use XSI in your Vivado simulator installaon at the
following locaon:
<Vivado Installation Root>/examples/xsim/<HDL language>/xsi
Compiling Your C/C++ Program
You can use the XSI example programs as a guideline. Each example supplies one or two scripts
for compiling and running the example. Refer to your compiler's documentaon for details on
compiling a program. On Linux, compiling and running is a two-step process.
1. In a C shell, source set_env.csh
2. Invoke run.csh
On Windows, simply run the batch le run.bat.
Note the following from the scripts:
1. The compilaon lines specify (via -I) the inclusion of the directory containing the xsi.h
include le.
2. There is no menon of the design shared library or kernel shared library during the
compilaon of a C++ program.
The XSI include le resides at the following locaon:
<Vivado Installation Root>/data/xsim/include/xsi.h
Preparing the Design Shared Library
The last step for producing a working XSI-based C/C++ program involves the compilaon of a
HDL design and packaging it together with the Vivado simulator to become your design shared
library. You may repeat this step whenever there is a change in HDL designs source code.
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 260
CAUTION! If you intend to rebuild the design shared library for your C/C++ program while your program
connues to run, be sure to close the design in your program before execung this step.
Create your design shared library by invoking xelab on the HDL design and including the -dll
switch to instruct xelab to produce a shared library instead of the usual snapshot for use with the
Vivado simulator's user interface.
For example:
Type the following in the Linux command line to create a design shared library at ./xsim.dir/
design/xsimk.so:
xelab work.top1 work.top2 -dll -s design
where work.top1 and work.top2 are the top module names and design is the snapshot
name.
See xelab, xvhdl, and xvlog xsim Command Opons for more details on compiling an HDL design.
XSI Function Reference
This secon presents each of the XSI API funcons in plain (direct C call) and Xsi::Loader
member funcon forms. The plain form funcons take an xsiHandle argument, whereas the
member funcons do not take this argument. The xsiHandle contains state informaon about
the opened HDL design. The plain form xsi_open produces the xsiHandle. Xsi::Loader
contains an xsiHandle internally.
xsi_close
void xsi_close(xsiHandle design_handle);
void Xsi::Loader::close();
This funcon closes an HDL design, freeing the memory associated with the design. Call this
funcon to end the simulaon.
xsi_get_error_info
const char* xsi_get_error_info(xsiHandle design_handle);
const char* Xsi::Loader::get_error_info();
This funcon returns a string descripon of the last error encountered.
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 261
xsi_get_port_number
XSI_INT32 xsi_get_port_number(xsiHandle design_handle, const char*
port_name);
int Xsi::Loader::get_port_number(const char* port_name);
This funcon returns an integer ID for the requested top-level port of the HDL design. You may
subsequently use the ID to specify the port in xsi_get_value and xsi_put_value calls.
port_name is the name of the port and is case sensive for Verilog and case insensive for
VHDL. The funcon returns -1 if no port of the specied name exists.
Example code:
#include "xsi.h"
#include "xsi_loader.h"
...
Xsi::Loader loader("xsim.dir/mySnapshot/
xsimk.so","librdi_simulator_kernel.so");
...
int count = loader.get_port_number("count");
xsi_get_status
XSI_INT32 xsi_get_status(xsiHandle design_handle);
int Xsi::Loader::get_status();
This funcon returns the status of the simulaon. The status may be equal to one of the
following ideners:
Table 60: Xsi Simulation Status Identifiers
Status Code Identifiers Description
xsiNormal
No error
xsiError
The simulation has encountered an HDL run-time error
xsiFatalError
The simulation has encountered an error condition for which the
Vivado simulator cannot continue.
Example code:
#include "xsi.h"
#include "xsi_loader.h"
...
Xsi::Loader loader("xsim.dir/mySnapshot/
xsimk.so","librdi_simulator_kernel.so");
...
if (loader.get_status() == xsiError)
printf("HDL run-time error encountered.\n");
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 262
xsi_get_value
void xsi_get_value(xsiHandle design_handle, XSI_INT32 port_number, void*
value);
int Xsi::Loader::get_value(int port_number, void* value);
This funcon fetches the value of the port indicated by port ID port_number. The value is
placed in the memory buer to which value points. See xsi_get_port_number for informaon on
obtaining an ID for a port.
IMPORTANT! Your program must allocate sucient memory for the buer before calling the funcon.
See Vivado Simulator VHDL Data Format and Vivado Simulator Verilog Data Format to determine the
necessary size of the buer.
Example code:
#include "xsi.h"
#include "xsi_loader.h"
...
// Buffer for value of port "count"
s_xsi_vlog_logicval count_val = {0X00000000, 0X00000000};
Xsi::Loader loader("xsim.dir/mySnapshot/
xsimk.so","librdi_simulator_kernel.so");
...
int count = loader.get_port_number("count");
loader.get_value(count, &count_val);
xsi_open
typedef struct t_xsi_setup_info {
char* logFileName;
char* wdbFileName;
} s_xsi_setup_info, *p_xsi_setup_info;
xsiHandle xsi_open(p_xsi_setup_info setup_info);
void Xsi::Loader::open(p_xsi_setup_info setup_info);
bool Xsi::Loader::isopen() const;
This funcon opens an HDL design for simulaon. To use this funcon, you must rst inialize an
s_xsi_setup_info struct to pass to the funcon. Use logFileName for the name of the
simulaon log le, or NULL to disable logging. If waveform tracing is on (see xsi_trace_all),
wdbFileName is the name of the output WDB (waveform database) le. Use NULL for the
default name of xsim.wdb. If the waveform tracing is o, the Vivado simulator ignores the
wdbFileName eld.
TIP:
To protect your program from future changes to the XSI API, Xilinx recommends that you zero out the
s_xsi_setup_info
struct before lling in the elds, as shown in the xsi_open.
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 263
The plain (non-loader) form of the funcon returns an xsiHandle, a C object containing process
state informaon about the design, to be used with all other plain-form XSI funcons. The loader
form of the funcon has no return value. However, you may check whether the loader has
opened a design by querying the isopen member funcon, which returns true if the open
member funcon had been invoked.
Example
#include "xsi.h"
#include "xsi_loader.h"
...
Xsi::Loader loader("xsim.dir/mySnapshot/
xsimk.so","librdi_simulator_kernel.so");
s_xsi_setup_info info;
memset(&info, 0, sizeof(info));
info.logFileName = NULL;
char wdbName[] = "test.wdb"; // make a buffer for holding the string
"test.wdb"
info.wdbFileName = wdbName;
loader.open(&info);
xsi_put_value
void xsi_put_value(xsiHandle design_handle, XSI_INT32 port_number, void*
value);
void Xsi::Loader::put_value(int port_number, const void* value);
This funcon deposits the value stored in value onto the port specied by port ID
port_number. See xsi_get_port_number for informaon on obtaining an ID for a port. value is
a pointer to a memory buer that your program must allocate and ll. See the Vivado Simulator
VHDL Data Format and Vivado Simulator Verilog Data Format for informaon on the proper
format of value.
CAUTION!
For maximum performance, the Vivado simulator performs no checking on the size or type of
the value you pass to
xsi_put_value
. Passing a value to
xsi_put_value
which does not match
the size and type of the port may result in unpredictable behavior of your program and the Vivado
simulator.
Example code:
#include "xsi.h"
#include "xsi_loader.h"
...
// Hard-coded Buffer for a 1-bit "1" Verilog 4-state value
const s_xsi_vlog_logicval one_val = {0X00000001, 0X00000000};
Xsi::Loader loader("xsim.dir/mySnapshot/
xsimk.so","librdi_simulator_kernel.so");
...
int clk = loader.get_port_number("clk");
loader.put_value(clk, &one_val); // set clk to 1
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 264
xsi_restart
void xsi_restart(xsiHandle design_handle);
void Xsi::Loader:: restart();
This funcon resets the simulaon to simulaon me 0.
xsi_run
void xsi_run(xsiHandle design_handle, XSI_UINT64 time_ticks);
void Xsi::Loader::run(XSI_INT64 step);
This funcon runs the simulaon for the given amount of me specied in kernel precision units.
A kernel precision unit is the smallest unit of me precision specied among all HDL source les
of the design. For example, if a design has two source les, one of which that species a
precision of 1 ns and the other species a precision of 1 ps, the kernel precision unit becomes 1
ps, as that me unit is the smaller of the two.
A Verilog source le may specify the me precision using the `timescale direcve.
Example:
`timescale 1ns/1ps
In this example, the me unit aer the / (1 ps) is the me precision. VHDL has no equivalent of
`timescale.
You may addionally adjust the kernel precision unit through the use of the xelab command-
line opons --timescale, --override_timeprecision, and --timeprecision_vhdl.
See xelab, xvhdl, and xvlog xsim Command Opons for informaon on the use of these
command-line opons.
Note: xsi_run blocks unl the specied simulaon run me has elapsed. Your program and the Vivado
simulator share a single thread of execuon.
xsi_trace_all
void xsi_trace_all(xsiHandle design_handle);
void Xsi::Loader:: trace_all();
Call this funcon aer xsi_open to turn on waveform tracing for all signals of the HDL design.
Running the simulaon with waveform tracing on causes the Vivado simulator to produce a
waveform database (WDB) le containing all events for every signal in the design. The default
name of the WDB le is xsim.wdb. To specify a dierent WDB le name, set the
wdbFileName eld of the s_xsi_setup_info struct when calling xsi_open, as shown in
the example code.
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 265
Example code:
#include "xsi.h"
#include "xsi_loader.h"
...
Xsi::Loader loader("xsim.dir/mySnapshot/
xsimk.so","librdi_simulator_kernel.so");
s_xsi_setup_info info;
memset(&info, 0, sizeof(info));
char wdbName[] = "test.wdb"; // make a buffer for holding the string
"test.wdb"
info.wdbFileName = wdbName;
loader.open(&info);
loader.trace_all();
Aer the simulaon completes, you can open the WDB le in Vivado to examine the waveforms
of the signals. See Opening a Previously Saved Simulaon Run for more informaon on how to
view WDB les in Vivado.
IMPORTANT! When compiling the HDL design, you must specify
-debug all
or
-debug typical
on the xelab command line. The Vivado simulator will not record the waveform data without the
-debug
command line opon.
Vivado Simulator VHDL Data Format
This secon describes how to convert between VHDL values and the format of the memory
buers to use with the XSI funcons xsi_get_value and xsi_put_value.
IEEE std_logic Type
A single bit of VHDL std_logic and std_ulogic is represented in C/C++ as a single byte
(char or unsigned char). The following table shows the values of std_logic/std_ulogic and
their C/C++ equivalents.
Table 61: std_logic/std_ulogic Values and their C/C++ Equivalents
std_logic Value
C/C++ Byte Value (Decimal)
'U‘
0
‘X‘
1
‘0‘
2
‘1‘
3
‘Z‘
4
‘W‘
5
‘L‘
6
‘H‘
7
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 266
Table 61: std_logic/std_ulogic Values and their C/C++ Equivalents (cont'd)
std_logic Value
C/C++ Byte Value (Decimal)
‘_‘
8
Example code:
// Put a '1' on signal "clk," where "clk" is defined as
// signal clk : std_logic;
const char one_val = 3; // C encoding for std_logic '1'...
int clk = loader.get_port_number("clk");
loader.put_value(clk, &one_val); // set clk to 1
VHDL bit Type
A single bit of VHDL bit type is represented in C/C++ as a single byte. The following table
shows the values of bit and their C/C++ equivalents.
Table 62: Values of bit and their C/C++ equivalents
bit Value
C/C++ Byte Value (Decimal)
'0‘
0
‘1‘
1
Example code:
// Put a '1' on signal "clk," where "clk" is defined as
// signal clk : bit;
const char one_val = 1; // C encoding for bit '1'...
int clk = loader.get_port_number("clk");
loader.put_value(clk, &one_val); // set clk to 1
VHDL Character Type
A single VHDL character value is represented in C/C++ as a single byte. VHDL character
values are exactly idencal to C/C++ char literals and are also equal to their ASCII numeric
values. For example, the VHDL character value 'm’ is equivalent to the C/C++ char literal 'm’ or
decimal value 109.
Example code:
// Put a 'T' on signal "myChar," where "myChar" is defined as
// signal myChar : character;
const char tVal = 'T';
int myChar = loader.get_port_number("myChar");
loader.put_value(myChar, &tVal);
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 267
VHDL integer Type
A single VHDL integer value is represented in C/C++ as an int.
Example code:
// Put 1234 (decimal) on signal "myInt," where "myInt" is defined as
// signal myInt : integer;
const int intVal = 1234;
int myInt = loader.get_port_number("myInt");
loader.put_value(myInt, &intVal);
VHDL real Type
A single VHDL real value is represented in C/C++ as a double.
Example code:
// Put 3.14 on signal "myReal," where "myReal" is defined as
// signal myReal : real;
const double doubleVal = 3.14;
int myReal = loader.get_port_number("myReal");
loader.put_value(myReal, &doubleVal);
VHDL Array Types
A VHDL array is represented in C/C++ as an array of whatever C/C++ type represents the
element type of the VHDL array. The following table shows the examples of VHDL arrays and
their C/C++ equivalent types.
Table 63: VHDL Arrays and their C/C++ Equivalent Types
VHDL Array Type C/C++ Array Type
std_logic_vector (array of std_logic)
char [ ]
bit_vector (array of bit)
char [ ]
string (array of character)
char [ ]
array of integer
int [ ]
array of real
double [ ]
VHDL arrays are organized in C/C++ with the le index of the VHDL array mapped to C/C++
array element 0 and the right index mapped to C/C++ element <array size> - 1.
C/C++ Array Index
0 1 2 <array size> - 1
VHDL array(left TO right) Index left left + 1 left + 2 right
VHDL array(left DOWNTO right)
Index
left left – 1 left – 2 right
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 268
Example code:
// For the following VHDL definitions
// signal slv : std_logic_vector(7 downto 0);
// signal bv : bit_vector(3 downto 0);
// signal s : string(1 to 11);
// type IntArray is array(natural range <>) of integer;
// signal iv : IntArray(0 to 3);
// do the following assignments
//
// slv <= "11001010";
// bv <= B"1000";
// s <= "Hello world";
// iv <= (33, 44, 55, 66);
const unsigned char slvVal[] = {3, 3, 2, 2, 3, 2, 3, 2}; // 3 = '1', 2 = '0'
loader.put_value(slv, slvVal);
const unsigned char bvVal[] = {1, 0, 0, 0};
loader.put_value(bv, bvVal);
const char sVal[] = "Hello world"; // ends with extra '\0' that XSI ignores
loader.put_value(s, sVal);
const int ivVal[] = {33, 44, 55, 66};
loader.put_value(iv, ivVal);
Vivado Simulator Verilog Data Format
Verilog logic data is encoded in C/C++ using the following struct, dened in xsi.h:
typedef struct t_xsi_vlog_logicval {
XSI_UINT32 aVal;
XSI_UINT32 bVal;
} s_xsi_vlog_logicval, *p_xsi_vlog_logicval;
Each four-state bit of Verilog value occupies one bit posion in aVal and the corresponding bit
posion in bVal.
Table 65: Verilog Value Mapping
Verilog Value
aVal Bit Value bVal Bit Value
0 0 0
1 1 0
X 1 1
Z 0 1
For two-state SystemVerilog bit values, an aVal bit holds the bit value, and the corresponding
bVal bit is unused. Xilinx recommends that you zero out bVal when composing two-state
values for xsi_put_value.
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 269
Verilog vectors are organized in C/C++ with the right index of the Verilog vector mapped to
aVal/bVal bit posion 0 and the le index mapped to aVal/bVal bit posion <vector size> -
1
aVal/bVal Bit Position <vector size> to
31
<vector size> -
1
<vector size> - 2 ... 1 0
Index of
wire [left:right] vec
(where left > right)
unused left left - 1 ... right + 1 right
Index of
wire [left:right] vec
(where left < right)
unused left left + 1 ... right - 1 right
For example, the following table shows the Verilog and C/C++ equivalents of the following
Verilog vector.
wire [7:4] w = 4'bXX01;
Verilog Bit Index 7 6 5 4
Verilog Bit Value X X 0 1
C/C++ Bit Position 31 ... 4 3 2 1 0
aVal Bit Value unused ... unused 1 1 0 1
bVal Bit Value unused ... unused 1 1 0 0
The C/C++ representaon of a Verilog vector with more than 32 elements is an array of
s_xsi_vlog_logicval, for which the right-most 32 bits of the Verilog vector maps to
element 0 of the C/C++ array. The next 32 bits of the Verilog vector maps to element 1 of the
C/C++ array, and so forth. For example, the following table shows the mapping of Verilog vector
wire [2:69] vec;
to the C/C++ array
s_xsi_vlog_logicval val[3];
Table 68: Verilog Index Range
Verilog Index Range C/C++ Array Element
vec[38:69] val[0]
vec[6:37] val[1]
vec[2:5] val[3]
Hence, vec[2] maps to val[3] bit posion 3, and vec[69] maps to val[0] bit posion 0.
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 270
A mul-dimensional Verilog array maps to the bits of a s_xsi_vlog_logicval or
s_xsi_vlog_logicval array as if the Verilog array were aened in row-major order before
mapping to C/C++.
For example, the two-dimensional array
reg [7:0] mem[0:1];
is treated as if copied to a vector before mapping to C/C++:
reg [15:0] vec;
vec[7:0] = mem[1];
vec[8:15] = mem[0];
Appendix L: Using Xilinx Simulator Interface
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 271
Appendix M
Additional Resources and Legal
Notices
Xilinx Resources
For support resources such as Answers, Documentaon, Downloads, and Forums, see Xilinx
Support.
Documentation Navigator and Design Hubs
Xilinx
®
Documentaon Navigator (DocNav) provides access to Xilinx documents, videos, and
support resources, which you can lter and search to nd informaon. To open DocNav:
From the Vivado
®
IDE, select Help → Documentaon and Tutorials.
On Windows, select Start → All Programs → Xilinx Design Tools → DocNav.
At the Linux command prompt, enter docnav.
Xilinx Design Hubs provide links to documentaon organized by design tasks and other topics,
which you can use to learn key concepts and address frequently asked quesons. To access the
Design Hubs:
In DocNav, click the Design Hubs View tab.
On the Xilinx website, see the Design Hubs page.
Note: For more informaon on DocNav, see the Documentaon Navigator page on the Xilinx website.
References
These documents provide supplemental material useful with this guide:
Appendix M: Additional Resources and Legal Notices
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 272
1. Vivado Design Suite User Guide: Release Notes, Installaon, and Licensing (UG973)
2. Vivado Design Suite User Guide: System-Level Design Entry (UG895)
3. Vivado Design Suite User Guide: Designing with IP (UG896)
4. Vivado Design Suite User Guide: Using the Vivado IDE (UG893)
5. Vivado Design Suite User Guide: Using Tcl Scripng (UG894)
6. Vivado Design Suite 7 Series FPGA and Zynq-7000 SoC Libraries Guide (UG953)
7. Vivado Design Suite Tcl Command Reference Guide (UG835)
8. Vivado Design Suite User Guide: Power Analysis and Opmizaon (UG907)
9. Vivado Design Suite User Guide: Using Constraints (UG903)
10. Vivado Design Suite Tutorial: Logic Simulaon (UG937)
11. Vivado Design Suite User Guide: Design Flows Overview (UG892)
12. Vivado Design Suite Properes Reference Guide (UG912)
13. Vivado Design Suite User Guide: Synthesis (UG901)
14. Wring Ecient Test Benches (XAPP199)
15. IEEE Standard VHDL Language Reference Manual (IEEE-STD-1076-1993)
16. IEEE Standard Verilog Hardware Descripon Language(IEEE-STD-1364-2001)
17. IEEE Standard for SystemVerilog--Unied Hardware Design, Specicaon, and Vericaon
Language (IEEE-STD-1800-2009)
18. Standard Delay Format Specicaon (SDF) (IEEE-STD-1497-2004)
19. Recommended Pracce for Encrypon and Management of Electronic Design Intellectual
Property (IP) (IEEE-STD-P1735)
Links to Additional Information on Third-
Party Simulators
1. Questa Advanced Simulator/ModelSim simulators:
hp://www.mentor.com/products/fv/questa/
hp://www.mentor.com/products/fv/modelsim/
2. Synopsys VCS Simulators: hp://www.synopsys.com/Tools/Vericaon/
FunconalVericaon/Pages/VCS.aspx
3. Acve-HDL Simulators: hps://www.aldec.com/en/support/resources/documentaon/
arcles/1579
Appendix M: Additional Resources and Legal Notices
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 273
4. Riviera PRO Simulators: hps://www.aldec.com/en/support/resources/documentaon/
arcles/1525
Training Resources
Xilinx provides a variety of training courses and QuickTake videos to help you learn more about
the concepts presented in this document. Use these links to explore related training resources:
1. Designing FPGAs Using the Vivado Design Suite 1 Training Course
2. Designing FPGAs Using the Vivado Design Suite 2 Training Course
3. Designing FPGAs Using the Vivado Design Suite 3 Training Course
4. Vivado Design Suite Quick Take Video: How to use the Zynq-7000 Vericaon IP to verify
and debug using simulaon
5. Vivado Design Suite Quick Take Video: Logic Simulaon
6. Vivado Design Suite QuickTake Video Tutorials
Revision History
The following table shows the revision history for this document.
Section Revision Summary
04/21/2022 Version 2022.1
Supported Simulators Updated Supported Simulators table.
Understanding the Simulator Language Option Updated the content.
Chapter 3: Simulating with Third-Party Simulators Updated the content.
export_simulation Updated the content.
Vivado Simulator Compilation Options Updated the content.
Testbench Feature Updated the content.
Supported Features Updated the content.
Appendix F: SystemC Support in Vivado IDE Updated Protected Models, Unprotected Models, Simulators
Supported for SystemC Simulation
Appendix M: Additional Resources and Legal Notices
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 274
Please Read: Important Legal Notices
The informaon disclosed to you hereunder (the "Materials") is provided solely for the selecon
and use of Xilinx products. To the maximum extent permied by applicable law: (1) Materials are
made available "AS IS" and with all faults, Xilinx hereby DISCLAIMS ALL WARRANTIES AND
CONDITIONS, EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO
WARRANTIES OF MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY
PARTICULAR PURPOSE; and (2) Xilinx shall not be liable (whether in contract or tort, including
negligence, or under any other theory of liability) for any loss or damage of any kind or nature
related to, arising under, or in connecon with, the Materials (including your use of the
Materials), including for any direct, indirect, special, incidental, or consequenal loss or damage
(including loss of data, prots, goodwill, or any type of loss or damage suered as a result of any
acon brought by a third party) even if such damage or loss was reasonably foreseeable or Xilinx
had been advised of the possibility of the same. Xilinx assumes no obligaon to correct any
errors contained in the Materials or to nofy you of updates to the Materials or to product
specicaons. You may not reproduce, modify, distribute, or publicly display the Materials
without prior wrien consent. Certain products are subject to the terms and condions of
Xilinx's limited warranty, please refer to Xilinx's Terms of Sale which can be viewed at hps://
www.xilinx.com/legal.htm#tos; IP cores may be subject to warranty and support terms contained
in a license issued to you by Xilinx. Xilinx products are not designed or intended to be fail-safe or
for use in any applicaon requiring fail-safe performance; you assume sole risk and liability for
use of Xilinx products in such crical applicaons, please refer to Xilinx's Terms of Sale which can
be viewed at hps://www.xilinx.com/legal.htm#tos.
AUTOMOTIVE APPLICATIONS DISCLAIMER
AUTOMOTIVE PRODUCTS (IDENTIFIED AS "XA" IN THE PART NUMBER) ARE NOT
WARRANTED FOR USE IN THE DEPLOYMENT OF AIRBAGS OR FOR USE IN APPLICATIONS
THAT AFFECT CONTROL OF A VEHICLE ("SAFETY APPLICATION") UNLESS THERE IS A
SAFETY CONCEPT OR REDUNDANCY FEATURE CONSISTENT WITH THE ISO 26262
AUTOMOTIVE SAFETY STANDARD ("SAFETY DESIGN"). CUSTOMER SHALL, PRIOR TO USING
OR DISTRIBUTING ANY SYSTEMS THAT INCORPORATE PRODUCTS, THOROUGHLY TEST
SUCH SYSTEMS FOR SAFETY PURPOSES. USE OF PRODUCTS IN A SAFETY APPLICATION
WITHOUT A SAFETY DESIGN IS FULLY AT THE RISK OF CUSTOMER, SUBJECT ONLY TO
APPLICABLE LAWS AND REGULATIONS GOVERNING LIMITATIONS ON PRODUCT
LIABILITY.
Copyright
© Copyright 2012-2022 Xilinx, Inc. Xilinx, the Xilinx logo, Alveo, Arx, Kintex, Kria, Spartan,
Versal, Vis, Virtex, Vivado, Zynq, and other designated brands included herein are trademarks of
Xilinx in the United States and other countries.
Appendix M: Additional Resources and Legal Notices
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 275
AMBA, AMBA Designer, Arm, ARM1176JZ-S, CoreSight, Cortex, PrimeCell, Mali, and MPCore
are trademarks of Arm Limited in the EU and other countries.PCI, PCIe, and PCI Express are
trademarks of PCI-SIG and used under license. All other trademarks are the property of their
respecve owners.
Appendix M: Additional Resources and Legal Notices
UG900 (v2022.1) April 21, 2022 www.xilinx.com
Vivado Design Suite User Guide: Logic Simulation 276