00. とりあえずrunするまで

最新のmodelsim-ase(10.1d)と、uvm-1.1dの組み合わせで、簡単なrunまで動いたので手順を説明します。

■前提

ふつうにUVMクラスライブラリをコンパイルすると、DPI-Cを使おうとします。ですが、家のase環境ではDPI-C周りがうまくいかないのでスキップする必要がありました。

■クラスライブラリのコンパイル

set dir = ./uvm-1.1d/src
vlog -sv $dir/uvm_pkg.sv +incdir+$dir +define+UVM_HDL_NO_DPI+UVM_NO_DPI+UVM_CMDLINE_NO_DPI+UVM_REGEX_NO_DPI

■サンプルテストベンチ

module tb_top;
  `include "./uvm-1.1d/src/uvm_macros.svh"
  import uvm_pkg::*;
  `include "test.sv"
  initial begin
    run_test();
  end
endmodule

■test.sv(uvm_test)(よりUVMっぽく更新しました)

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

■ベンチのコンパイル

vlog -sv tb_top.sv +incdir+./uvm-1.1d/src

■実行(vsim)

vsim -c tb_top +UVM_TESTNAME=test -do "run -all;quit"

■実行結果

Reading C:/altera/13.0/modelsim_ase/tcl/vsim/pref.tcl
# 10.1d
# vsim +UVM_TESTNAME=test -do {run -all;quit} -c tb_top
# Loading sv_std.std
# Loading work.uvm_pkg
# Loading work.tb_top
# ** Note: (vsim-8785) UVM-aware debugging capabilities will be disabled since no compiled "questa_uvm_pkg" can be found.
#
# This also means that later if you turn on UVM-aware debugging your debug simulations may have
#
# different random seeds from your non-debug simulations.
#
# ** Warning: Design size of 2 instances exceeds ModelSim ALTERA recommended capacity.
# This may because you are loading cell libraries which are not recommended with
# the ModelSim Altera version. Expect performance to be adversely affected.
# run -all
# ----------------------------------------------------------------
# UVM-1.1d
# (C) 2007-2013 Mentor Graphics Corporation
# (C) 2007-2013 Cadence Design Systems, Inc.
# (C) 2006-2013 Synopsys, Inc.
# (C) 2011-2013 Cypress Semiconductor Corp.
# ----------------------------------------------------------------
#
#   ***********       IMPORTANT RELEASE NOTES         ************
#
#   You are using a version of the UVM library that has been compiled
#   with `UVM_NO_DEPRECATED undefined.
#   See http://www.eda.org/svdb/view.php?id=3313 for more details.
#
#   You are using a version of the UVM library that has been compiled
#   with `UVM_OBJECT_MUST_HAVE_CONSTRUCTOR undefined.
#   See http://www.eda.org/svdb/view.php?id=3770 for more details.
#
#       (Specify +UVM_NO_RELNOTES to turn off this notice)
#
# UVM_INFO ./uvm-1.1d/src/base/uvm_root.svh(370) @ 0: reporter [NO_DPI_TSTNAME] UVM_NO_DPI defined--getting UVM_TESTNAME directly, without DPI
# UVM_INFO @ 0: reporter [RNTST] Running test test...
# Hello World
#

■メモ

uvm_testクラスはなんちゃってで書きました。

function newのところでマクロを使っているのは、UVMクラスライブラリの中を見ていて見つけたので、ただ使ってみただけです。