Vivado Simulatorをコマンドラインから実行する場合、xvlog,xelab,xsimを続けて実行します。
#!/bin/sh
# RTL directory
RTL_DIR="../rtl"
INC_DIR="../include"
sim_file=$1
echo "Test Scenario=" $sim_file
# compile
xvlog \
-sv \
-i ${INC_DIR}/ \
--sourcelibdir ${RTL_DIR} \
--sourcelibext .v \
${sim_file}
# elaboration
xelab \
--debug all \
--notimingchecks \
test_module
# simulation
xsim test_module <<EOF
run all
EOF
シミュレーション実行までのプロセスは、ModelSimやNCSimと似ています。NCSimやModelsimと比べると、コンパイル時のオプションに違いがあります。
| Vivado Simulator | Modelsim | |
| サーチディレクトリ指定 | –sourcelibdir | –y |
| インクルードディレクトリ指定 | -i | +incdir+ |
| 拡張子指定 | –sourcelibext | +libext+ |
SystemVerilogサポート
ユーザーガイド(v2017.1)によると、Vivado SimulatorはSystemVerilogをサポートしています。ncverilogで実行したことがあるSystemVerilogのrandomizationコードをVivado Simulatorで試してみました。
class data_gen; rand reg [7:0] data; endclass module test_module; data_gen dg; initial begin assert(dg.randomize()); : endmodule
xsim実行結果
# xsim {work.test_module} -autoloadwcfg
Vivado Simulator 2017.1
Time resolution is 1 ps
FATAL_ERROR: Vivado Simulator kernel has discovered an exceptional condition from which it cannot recover. Process will terminate. For technical support on this issue, please open a WebCase with this project attached at http://www.xilinx.com/support.
randomizeは実行できませんでした。その他、clocking blockとmodportを使ったprogramもダメなようです。少なくともncverilogで実行できたSystemVerilogのコードをそのまま実行することはできませんでした。だた、ユーザーガイドのサポート状況を読むと、programやrandomizationもほとんどの機能が”Supported”となっているので、SystemVerilogの記述を工夫すれば動くのかも知れまません。

