注:コンパイルすると、Warningが出ます。これは、UVMが使用しているSystemVerilogのrandomizeメソッドをmodelsim-aseがサポートしていないためです。randomizeメソッド周りの動作は使えませんが、使 えなくてもUVMの恩恵はある程度受けられます。
`timescale 1ps/1ps
module tb_top;
`include "uvm_macros.svh"
import uvm_pkg::*;
endmodule
# 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)
#
# quit
class sample_test extends uvm_test;
`uvm_component_utils(sample_test)
function new (string name="sample_test", uvm_component parent=null);
super.new(name,parent);
endfunction
task run_phase(uvm_phase phase);
uvm_report_info("TEST", "Hello World");
endtask
endclass
initial begin
run_test("sample_test");
end
# UVM_INFO @ 0: reporter [RNTST] Running test sample_test...
# UVM_INFO @ 0: uvm_test_top [TEST] Hello World
initial begin
run_test(); //ここ
end
# 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 sample_test...
# UVM_INFO @ 0: uvm_test_top [TEST] Hello World
# UVM_WARNING @ 0: reporter [BDTYP] Cannot create a component of type 'sample' because it is not registered with the factory.
# UVM_FATAL @ 0: reporter [INVTST] Requested test from command line +UVM_TESTNAME=sample not found.