The document discusses software driven verification using Xilinx's xsim simulator. It describes using the Xilinx Simulator Interface (XSI) which allows a C/C++ program to act as a testbench for an HDL design in xsim. It provides details on how to use XSI functions like getting port numbers and values, running simulation, and controlling simulation from C++. It also discusses calling XSI functions through dynamic linking and using SystemVerilog DPI to directly access the DUT from C++.
4. Software Driven Verification
● ソフトウェア(プログラム)を使って、ハードウェア(RTL等)を検証する
DUT (Design under Test)
RTL等で記述
Model
Driver/Checker/Monitor
Test Program
Top Testbench
5. SystemVerilogでは?
● UVM (Universal Verification Methodology) : UVM 2020-1.1
DUT (Design under Test)
SystemVerilog
Model
SystemVerilog
Test Program
SystemVerilog
Top Testbench
(SystemVerilog)
商用HDLシミュレータ、xsimでも利用可能
6. SystemVerilogでは?
● BFM + DPI (export task)
○ Xilinx xsim では、時間が進む task はサポートしていない
DUT (Design under Test)
SystemVerilog
Model
SystemVerilog
Test Program
C/C++
Top Testbench
(SystemVerilog)
DPI (export task)
7. Xilinx Simulator Interface
The Xilinx® Simulator Interface (XSI) is a C/C++ application
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 activity of the Vivado
simulator which hosts the HDL design.
● Verilator の テストベンチ側を C++ で書くのと同じ?
8. Xilinx Simulator Interface
● Simulation Engine + Design + C/C++ (Testbench + Test Program)
DUT (Design under Test)
SystemVerilog
Model
SystemVerilog
Test Program
C/C++
Top Testbench
(C/C++)
Design
Simulation
Engine
9. XSIでのシミュレーション制御
The C/C++ program controls the simulation in the following methods:
● Setting the values of the top-level input ports of the HDL design
● Instructing the Vivado simulator to run the simulation for a certain
amount of simulation time
● Additionally, the C/C++ program can read the values of the top-level
output ports of the HDL design.
10. XSIのステップ
Perform the following steps to use XSI in your C/C++ program:
1. Prepare the XSI API functions to be called through dynamic linking
2. Write your C/C++ test bench code using the API functions
3. Compile and link your C/C++ program
4. Package the Vivado simulator and the HDL design together into a
shared library
11. XSIをDynamic Linkingで呼び出す
Xilinx recommends the usage of dynamic linking for indirectly calling the
XSI functions.
While this technique involves more steps than simply calling XSI
functions directly, dynamic linking allows you to keep the compilation of
your HDL design independent of the compilation of your C/C++
program.
You can compile and load your HDL design at any time, even while your
C/C++ program continues to run.
12. XSIをDynamic Linkingで呼び出す
To call a function through dynamic linking requires your program to
perform the following steps:
1. Open the shared library containing the function.
2. Look up the function by name to get a pointer to the function.
3. Call the function using the function pointer.
4. Close the shared library (optional).
13. XSIを使ってシミュレーションをする
To call a function through dynamic linking requires your program to
perform the following steps:
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 until the simulation is finished:
a. Set values on top-level input ports.
b. Run the simulation for a specific amount of time.
c. Fetch the values of top-level output ports.
4. Close the design.
26. # xelab : Compile the HDL design into a simulatable Shared Library
$XSIM_ELAB work.top -prj top.prj -dll -s $OUT_SIM_SNAPSHOT -debug wave
# Compile the C++ code that interfaces with XSI of ISim
$GCC_COMPILER -I$XSI_INCLUDE_DIR -O3 -c -o xsi_loader.o xsi_loader.cpp
# Compile the program that needs to simulate the HDL design
$GCC_COMPILER -I$XSI_INCLUDE_DIR -O3 -c -o bfm.o bfm.cpp
$GCC_COMPILER -I$XSI_INCLUDE_DIR -O3 -c -o testbench.o testbench.cpp
# make executable
$GCC_COMPILER -o $OUT_EXE bfm.o testbench.o xsi_loader.o -ldl -lrt
# Run the program (export LD_LIBRARY_PATH="$XILINX_VIVADO/lib/lnx64.o")
./$OUT_EXE
run.sh
27. sv work top.v
# List other design files here
sv => SystemVerilog
work => library
top.prj
28. Xilinx xsim : XSI
● Test Program を別ファイルにして、いろいろなテストができる
DUT (Memory)
SystemVerilog RTL
Test Program
SystemC
Top Testbench
(C/C++)
● Read
● Write
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
C/C++
Simulation Engine
XSI
BFM
30. Xilinx xsim : XSI + SystemVerilog DPI
● SystemVerilogのDPIを使うと、DUTの中に直接アクセスできる
DUT (Memory)
SystemVerilog RTL
Simulation Engine
XSI
Test Program
SystemC
Top Testbench
(C/C++)
● Read
● Write
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
SystemC
Test Program
C/C++
SystemVerilog DPI
BFM