Vengineerの戯言

人生は短いけど、長いです。人生を楽しみましょう!

Xilinx xsimを調べる(その6)

はじめに

昨日は、xvlog コマンドが生成するファイルをみてみましたが、今日は xelab コマンドが生成するファイルをみてみます。

xelab コマンドでエラボレーション

top を xelab コマンドでエラボレーションした時のログは下記のようになりました。

xelab top
Vivado Simulator v2021.2
Copyright 1986-1999, 2001-2021 Xilinx, Inc. All Rights Reserved.
Running: /YYY/XILINX/Vivado/2021.2/bin/unwrapped/lnx64.o/xelab top
Multi-threading is on. Using 6 slave threads.
WARNING: [XSIM 43-3431] One or more environment variables have been detected which affect the operation of the C compiler. These are typically not set in standard installations and are not tested by Xilinx, however they may be appropriate for your system, so the flow will attempt to continue.  If errors occur, try running xelab with the "-mt off -v 1" switches to see more information from the C compiler. The following environment variables have been detected:
    CPATH
    LIBRARY_PATH
Starting static elaboration
Pass Through NonSizing Optimizer
Completed static elaboration
Starting simulation data flow analysis
Completed simulation data flow analysis
Time Resolution for simulation is 1ps
Compiling module work.top
Built simulation snapshot work.top

ログをみていきます。

Running: /mnt/usb/XILINX/Vivado/2021.2/bin/unwrapped/lnx64.o/xelab top

xelab コマンドの実態は、Vivado のインストールディレクトリの下にある unwrapped/xln64.o/xelab コマンドです。

Multi-threading is on. Using 6 slave threads.

こちらは、マルチスレッドでコンパイルしています。使っているCPUは、Core i7で論理コア数は8です。8コアの内、6コアを使ってコンパイルします。ただし、デザインは大きくないのでマルチコアの意味はありません。

マルチコア機能は、-mt off オプションにて無効化できます。

xelab top -mt off"
Running: /mnt/usb/XILINX/Vivado/2021.2/bin/unwrapped/lnx64.o/xelab top -mt off
Turned off multi-threading.
Gurned off multi-threading.

というメッセージが表示されます。

WARNING: [XSIM 43-3431] One or more environment variables have been detected which affect the operation of the C compiler. These are typically not set in standard installations and are not tested by Xilinx, however they may be appropriate for your system, so the flow will attempt to continue.  If errors occur, try running xelab with the "-mt off -v 1" switches to see more information from the C compiler. The following environment variables have been detected:
    CPATH
    LIBRARY_PATH

にあるように、"-mt off -v 1" を付けて、xelab コマンドを実行したら、いっぱいメッセージが表示されました。

Vivado Simulator v2021.2
Copyright 1986-1999, 2001-2021 Xilinx, Inc. All Rights Reserved.
Running: /mnt/usb/XILINX/Vivado/2021.2/bin/unwrapped/lnx64.o/xelab top -mt off -v
Turned off multi-threading.
WARNING: [XSIM 43-3431] One or more environment variables have been detected which affect the operation of the C compile
r. These are typically not set in standard installations and are not tested by Xilinx, however they may be appropriate f
or your system, so the flow will attempt to continue.  If errors occur, try running xelab with the "-mt off -v 1" switch
es to see more information from the C compiler. The following environment variables have been detected:
    CPATH
    LIBRARY_PATH
INFO: [XSIM 43-3427] Library Mapping: Sourcing library mapping file "/mnt/usb/XILINX/Vivado/2021.2/data/xsim/xsim.ini".
INFO: [VRFC 10-8317] The VHDL library search path for library "std" is now "/mnt/usb/XILINX/Vivado/2021.2/data/xsim/vhdl
/std_2008"
INFO: [VRFC 10-8319] The Verilog library search path for library "std" is now "/mnt/usb/XILINX/Vivado/2021.2/data/xsim/v
hdl/std_2008"
INFO: [VRFC 10-8317] The VHDL library search path for library "ieee" is now "/mnt/usb/XILINX/Vivado/2021.2/data/xsim/vhd
l/ieee_2008"

途中省略

Starting static elaboration
Pass Through NonSizing Optimizer
INFO: [VRFC 10-3232] compiling module 'top' [/XXX/top.sv:1]
Completed static elaboration
Warning: removing unused statement from line 6 in file /XXX/top
.sv
Warning: removing unused statement from line 8 in file /XXX/top
.sv
Starting simulation data flow analysis
Completed simulation data flow analysis
SDG Object Count: 17, SDG Object Memory Usage: 3 KB.
Time Resolution for simulation is 1ps
Compiling module work.top
ICR Memory Usage: 52KB, 8192KB
/usr/bin/gcc  -fPIC -c -Wa,-W -fPIC -m64  -I"/mnt/usb/XILINX/Vivado/2021.2/data/xsim/include" "xsim.dir/work.top/obj/xsi
m_1.c" -O1  -o "xsim.dir/work.top/obj/xsim_1.lnx64.o" -DXILINX_SIMULATOR
/usr/bin/gcc  -fPIC  -x c++ -c -Wa,-W -fPIC -m64  -I"/mnt/usb/XILINX/Vivado/2021.2/data/xsim/include" "xsim.dir/work.top
/obj/xsim_2.c" -O1  -o "xsim.dir/work.top/obj/xsim_2.lnx64.o" -DXILINX_SIMULATOR
Linking with command:
/usr/bin/gcc -Wa,-W  -O -fPIC  -m64  -Wl,--no-as-needed  -Wl,--unresolved-symbols=ignore-all  -o "xsim.dir/work.top/xsim
k"   "xsim.dir/work.top/obj/xsim_0.lnx64.o" "xsim.dir/work.top/obj/xsim_1.lnx64.o" "xsim.dir/work.top/obj/xsim_2.lnx64.o
" -L"/mnt/usb/XILINX/Vivado/2021.2/lib/lnx64.o" -lrdi_simulator_kernel
Built simulation snapshot work.top

エラボレーション

下記の部分からエラボレーションが実行されるようです。シミュレーションの Time Resolution は、1ps です。work.top に スナップショットが生成されます。

Starting static elaboration
Pass Through NonSizing Optimizer
Completed static elaboration
Starting simulation data flow analysis
Completed simulation data flow analysis
Time Resolution for simulation is 1ps
Compiling module work.top
Built simulation snapshot work.top
ls xsim.dir
work work.top

xvlog コマンドが生成した work の他に、work.top が生成されました。

‘‘‘ ls xsim.dir/work.top/ Compile_Options.txt xsim.dbg xsim.mem xsim.reloc xsim.rtti xsim.svtype xsim.type xsim.xdbg xsimk

- Compile_Options.txt
- xsim.dbg
- xsim.mem
- xsim.reloc
- xsim.rtti
- xsim.svtype
- xsim.type
- xsim.xdbg
- xsimk

が生成されました。

Compile_Options.txt は、ASCIIファイル、xsimk は実行ファイル、その他は data のようです。

file xsim.dir/work.top/* xsim.dir/work.top/Compile_Options.txt: ASCII text xsim.dir/work.top/xsim.dbg: data xsim.dir/work.top/xsim.mem: data xsim.dir/work.top/xsim.reloc: data xsim.dir/work.top/xsim.rtti: data xsim.dir/work.top/xsim.svtype: data xsim.dir/work.top/xsim.type: data xsim.dir/work.top/xsim.xdbg: data xsim.dir/work.top/xsimk: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=a90b75319dad9ebf72ac0640ecee22fc50a5806a, for GNU/Linux 3.2.0, not stripped

Compile_Options.txt ファイルは、xelab コマンドに渡した引数名が入っているようです。

cat xsim.dir/work.top/Compile_Options.txt "top" -mt "off" -v

実行ファイルのxsimkを動かしてみたら、ライブラリが無いと言われました。

xsim.dir/work.top/xsimk xsim.dir/work.top/xsimk: error while loading shared libraries: librdi_simulator_kernel.so: cannot open shared object file: No such file or directory

LD_LIBRARY_PATH で Vivado のインストールディレクトリ内の lib/lnx64.o を設定し、再度実行してみました。

LD_LIBRARY_PATH=/mnt/usb/XILINX/Vivado/2021.2/lib/lnx64.o xsim.dir/work.top/xsimk

(isim-gdb) =elaboration-done,precision="-12",dp_address="94644765240896",dp_size="3716" (isim-gdb)

なんか動いていますが、途中で止まっているようです。。。

# おわりに

今日は、xelab コマンドでエラボレーションまでをみてみました。明日は、xelab コマンドでシミュレーションを実行してみます。