Vengineerの妄想(準備期間)

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

UVM 1.0 : examples/integrated/codec (その3)



Makefile.questaを見てみましょう!
    hw_reset hw_reset_test: comp
	    $(VSIM) +UVM_TESTNAME=hw_reset_test
	    $(CHECK)
の部分がシミュレーション実行コマンドです。テスト名を+UVM_TESTNAME=hw_reset_testで指定しています。
で、このhw_reset_testはどこにあるのでしょうか?
それは、testlib.svhの中では次のように定義されています。
    class hw_reset_test extends test;

       `uvm_component_utils(hw_reset_test)

       function new(string name, uvm_component parent = null);
           super.new(name, parent);
       endfunction

       local bit once = 1;
       task main_phase(uvm_phase phase);
           if (once) begin
               once = 0;
               phase.raise_objection(this);
               // 100 * 8クロック(env.vif.sclk)ウエイトします
               repeat (100 * 8) @(posedge env.vif.sclk);
               // This will clear the objection
               `uvm_info("TEST", "Jumping back to reset phase", UVM_NONE);
               // ここでリセットフェーズにジャンプします。
               phase.jump(uvm_reset_phase::get());
           end
       endtask

    endclass
testクラスを継承しています。また、main_phaseタスクを実装しています。
testクラスは、[ UVM 1.0 : examples/integrated/codec (その2)]で説明したtest.svファイル内で次のように定義されています。
    class test extends uvm_test;
        tb_env env;

        `uvm_component_utils(test)

        function new(string name, uvm_component parent = null);
            super.new(name, parent);
        endfunction

        function void start_of_simulation_phase(uvm_phase phase);
            // トップ階層をuvm_root::get()で獲得する
            uvm_root top = uvm_root::get();
            // topの階層から'''env'''を見つけ、
            // tb_envクラスのインスタンスenvに$castする
            $cast(env, top.find("env"));
        endfunction

    endclass

    `include "testlib.svh"
最後に先に説明したtestlib.svhファイルをインクルードしています。

検証、Verification、SystemVerilog、UVM