Vengineerの戯言

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

引数を指定しないときのrun_testタスクの動作は?(OVM 1.0/1.0.1の場合)

Verification Engineerの戯言

OVM 1.0/1.0.1版

run_testタスクを引数無しで実行したら、どうなるのでしょう!
ovm_env::run_testタスクを引数無しに実行すると、次のコードが実行されます。
    task ovm_env::run_test(string test_name="");

      if (m_comp_list.size() == 0) begin
        _global_reporter.ovm_report_fatal("NOCOMP", $psprintf("No components instantiated. You must instantiate at least one component before calling run_test. To run a test, use +OVM_TESTNAME or supply the test name in the argument to run_test(). Exiting simulation."));
          return;
      end

        _global_reporter.ovm_report_info("RNTST", $psprintf("Running test ..."),500);

      // run through that phase (run entire test)
      run_global_phase();

      if (finish_on_completion) begin
        fork 
          $finish;
        join_none
      end

    endtask
では、実際には、何が実行されるのでしょうか?

実は、ovm_print_topology関数で説明しました、各オブジェクトの内容を見てみると分かります。
    # OVM_INFO @ 0: reporter [OVMTOP] OVM testbench topology:
    # ----------------------------------------------------------------------
    # Name                     Type                Size                Value
    # ----------------------------------------------------------------------
    # urm_command_line_proces+ ovm_object          -    @{urm_command_line+
    # ----------------------------------------------------------------------
    # ----------------------------------------------------------------------
    # Name                     Type                Size                Value
    # ----------------------------------------------------------------------
    # topenv                   my_env              -    @{topenv} {ref to +
    #   inst1                  A                   -    @{topenv.inst1} {r+
    #     u1                   C                   -    @{topenv.inst1.u1}+
    #       v                  integral            32                   'h1e
    #       s                  integral            32                   'h10
    #       myaa               aa(string,string)   3                       -
    #         [bar]            string              3                     bye
    #         [foo]            string              3                     boo
    #         [foobar]         string              6                  boobah
    #     u2                   C                   -    @{topenv.inst1.u2}+
    #       v                  integral            32                    'h5
    #       s                  integral            32                   'h10
    #       myaa               aa(string,string)   3                       -
    #         [bar]            string              3                     bye
    #         [foo]            string              2                      hi
    #         [foobar]         string              5                   howdy
    #     debug                integral            1                     'h1
    #   inst2                  B                   -    @{topenv.inst2} {r+
    #     u1                   C                   -    @{topenv.inst2.u1}+
    #       v                  integral            32                    'ha
    #       s                  integral            32                    'h0
    #       myaa               aa(string,string)   3                       -
    #         [bar]            string              3                     bye
    #         [foo]            string              2                      hi
    #         [foobar]         string              5                   howdy
    #     debug                integral            1                     'h1
    #   debug                  integral            1                     'h0
    # ----------------------------------------------------------------------
トップ階層のインスタンスは、my_envクラスインスタンスであるtopenvです。
このtopenvに対して、runタスクを実行することになります。
これは、top.svのコードでtopenvをトップ階層のインスタンスとして定義しているからです。
(モジュールの階層ではなく、OVMのクラスの階層ですので、お間違えのないように!)
    module top;
      import ovm_pkg::*;
      import my_env_pkg::*;

      my_env topenv;

      initial begin

        topenv = new("topenv", null); topenv.build();

        // topenv.do_test();
        run_test();
        ovm_print_topology();
      end
    endmodule

top.svの中では、topenv.do_test()コメントアウトにしていますが、
この記述は、AVMでの記述法で、OVMではrun_testタスクを使います。

検証、Verification、SystemVerilog、OVM、Open Verification Methodology