Vengineerの妄想(準備期間)

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

OVM 2.0 :Directed Test Style Interface(その1)

Verification Engineerの戯言

OVMでは、基本的にシーケンスを使って制約付きランダム生成にて自動テストを行います。
でも、ピンポイントでテストをしたいとき、つまり、ダイレクト・テストをしたいときはどうすればいいのでしょうか?

User Guideでは、ダイレクト・テストについてもPage 89-90で説明しています。
ポイントは、シーケンサexecute_itemタスクを使うというモノです。
    User Guide P.90のコードから

    class directed_test extends xbus_demo_base_test;
      `ovm_component_utils(directed_test)

      xbus_demo_tb xbus_demo_tb0;

      function new (string name = "directed_test", ovm_component parent = null);
        super.new(name, parent);
      endfunction

      virtual function void build();
        super.build();
        set_config_int("*.sequencer", "count", 0);
        // Create the testbench.
        xbus_demo_tb0 = xbus_demo_tb::type_id::create("xbus_demo_tb0", this);
      endfunction

      virtual task run();
        bit success; simple_item item;
        #10;
        item = new();
        success = item.randomize();
        tb.ahb.masters[1].sequencer.execute_item(item);
        success = item.randomize() with { addr < 32'h0123; } ;
        tb.ahb.masters[1].sequencer.execute_item(item);
      endtask

    endclass
まずは、build関数set_config_int関数を使って、シーケンサcount0にします。
こうすることで、ランダム生成をしないようにします。

次に、runタスクシーケンサexecute_itemタスクでシーケンス・アイテムをドライバに送ります。
通常のテスト(ovm_test)では、runタスクでは特に何もしませんが、
ダイレクト・テストのときは、この例のようにするようです。

execute_itemタスクは、ovm_sequence_param_base #(REQ,RSP)クラスで次のように実装されています。
    src/methodology/ovm_sequencer_param_base.svh

    virtual task execute_item(ovm_sequence_item item);
      ovm_sequence_base temp_seq;
      temp_seq = new();
      item.set_sequencer(this);
      item.set_parent_sequence(temp_seq);
      temp_seq.set_sequencer(this);
      temp_seq.start_item(item);
      temp_seq.finish_item(item);
    endtask // execute_item

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