FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

Vivado Simulatorを使ってUVMに入門する

私は論理回路の中でもデザインエンジニアなので、UVMが非常に苦手である。というか全く分からない。

ただし分からないと言うばかりではどうしようもないので、Vivado Simulatorを使って多少は勉強しなければなるまい。 UVMはUniversal Verification Methodologyの略で、主に検証で使用されるメソドロジ及びライブラリのセットだ。

Viavdo Simulatorは2019.02からUVMをサポートをしているらしい。まずはVivado Simulatorの環境を構築してみよう。

参考にしたのは以下のサイトだ。これを見ながらVivado Simulatorの環境を作っていった。

sites.google.com

  • test.sv
class test extends uvm_test;
  `uvm_component_utils(test)
  `uvm_new_func
    task run_phase(uvm_phase phase);
      phase.raise_objection(this);
      $display("Hello World\n");
      phase.drop_objection(this);
    endtask
endclass
  • tb_top.sv
module tb_top;
`include "uvm_macros.svh"
import uvm_pkg::*;
`include "test.sv"
initial begin
  run_test();
end
endmodule

で、Makefileを以下のように作成する。

.PHONY: all

all:
        xvlog -sv tb_top.sv -L uvm
        xelab tb_top -timescale 1ns/100ps -L uvm
        xsim tb_top -R --testplusarg "UVM_TESNAME=test"
$ make

一応それっぽく"Helllo World"が表示された。

UVM_INFO /proj/xbuilds/SWIP/2020.2_0711_1805/installs/lin64/Vivado/2020.2/data/system_verilog/uvm_1.2/xlnx_uvm_package.sv(18648) @ 0: reporter [NO_DPI_TSTNAME] UVM_NO_DPI defined--getting UVM_TESTNAME directly, without DPI
UVM_INFO @ 0: reporter [RNTST] Running test test...
UVM_INFO /proj/xbuilds/SWIP/2020.2_0711_1805/installs/lin64/Vivado/2020.2/data/system_verilog/uvm_1.2/xlnx_uvm_package.sv(20867) @ 0: reporter [UVM/COMP/NAMECHECK] This implementation of the component name checks requires DPI to be enabled
Hello World

UVM_INFO /proj/xbuilds/SWIP/2020.2_0711_1805/installs/lin64/Vivado/2020.2/data/system_verilog/uvm_1.2/xlnx_uvm_package.sv(19968) @ 0: reporter [TEST_DONE] 'run' phase is ready to proceed to the 'extract' phase
UVM_INFO /proj/xbuilds/SWIP/2020.2_0711_1805/installs/lin64/Vivado/2020.2/data/system_verilog/uvm_1.2/xlnx_uvm_package.sv(13673) @ 0: reporter [UVM/REPORT/SERVER] [UVM/RELNOTES]     1

たぶんだが、まずは+UVM_TESTNAME=xxxでテストのためのクラスを指定している。 run_test()を実行しているが、これ自体はおそらくデフォルトで定義されている関数で、run_phase()はその中で呼び出される関数なのだろう。

とりあえず環境自体は出来たので、次はチュートリアル的に何かを実行してみたいかな。