Vengineerの戯言

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

ovm_test_top

Verification Engineerの戯言

ovm_testクラスを継承してテストを記述した場合に、ovm_print_topology関数を実行すると、
ovm_test_topが最上位階層として表示されます。
    # ----------------------------------------------------------------------
    # Name                     Type                Size                Value
    # ----------------------------------------------------------------------
    # ovm_test_top             xxxxxxxxxxxxxxxxxx+ -    @{ovm_test_top} {r+
このovm_test_topは、どこにあるのでしょうか?

base/ovm_component.sv
    ovm_component ovm_test_top;
と定義されていて、トップ階層のインスタンスになっています。
実際のインスタンスの生成は、src/base/ovm_env.svrun_testタスクの中です。
{{{
    task ovm_env::run_test(string test_name="");
      bit testname_plusarg;

      testname_plusarg = 0;

      // if test not specified, check plusarg 
      if ($value$plusargs("OVM_TESTNAME=%s", test_name))
        testname_plusarg = 1;
      if ($value$plusargs("TESTNAME=%s", test_name)) begin
        _global_reporter.ovm_report_warning("DPRFT", 
                         "+TESTNAME is deprecated, please use +OVM_TESTNAME instead");
        testname_plusarg = 1;
      end

      // if test now defined, create it using common factory
      if (test_name != "") begin
        if(ovm_test_top != null) begin
          _global_reporter.ovm_report_error("TTINST", 
               "The ovm_test_top has been set via a previous call to run_test");
        end
        $cast(ovm_test_top, ovm_factory::create_component(test_name,
                                         "ovm_test_top", "ovm_test_top", null));
      end
run_testタスクの引数test_nameが""でないとき(何も指定されないとき)、
ovm_test_topをファクトリから生成します。
(引数で指定しなくても、、+OVM_TEST=...で指定すれば、test_nameはテスト名が設定されます)

テストを指定すると、そのテストがovm_test_topに代入され、トップ階層になるということです。

OVM 1.1では、ovm_test_topdeprecatedになったので使わないようにしましょう!
(OVM_Reference.pdf:P282参照)
(でも、OVM 1.1では、まだovm_test_topを使ってovm_root::run_testタスクを実装しています???''')

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