Vengineerの妄想(準備期間)

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

UVM 1.0 : examples/simple/tlm2/temporal_decoupling (その2)


トップ階層は、tb_env.svファイル内のtb_envクラスで、
examples/simple/tlm2/blocking_simpleと全く同じです。
  class tb_env extends uvm_component; // uvm_componentを継承する

    `uvm_component_utils(tb_env)      // set_config_xxx/get_config_xxxのためのおなじない

    initiator master;                 // initiatorクラスのインスタンス
    target    slave;                  // targetクラスのインスタンス

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

    function void build_phase(uvm_phase phase);    // ビルドフェーズ
      // Factoryでmasterインスタンスを生成
      master = initiator::type_id::create("master", this); 
      // Factoryでslaveインスタンスを生成
      slave  = target::type_id::create("slave", this);     
    endfunction

    function void connect_phase(uvm_phase phase);  // コネクトフェース
      master.sock.connect(slave.sock);             // masterのsockとslave.sockを接続
    endfunction
  endclass

build_phase関数では、次のようにFactoryを使ってインスタンスを生成しています。
    function void build_phase(uvm_phase phase); 
      master = initiator::type_id::create("master", this); 
      slave  = target::type_id::create("slave", this);
    endfunction
この部分を次のようにnew関数にてインスタンスを生成にしても動作します。
    function void build_phase(uvm_phase phase);
      master = new();
      slave  = new();
    endfunction

検証、Verification、SystemVerilog、UVM、Unified Verification Methodology