2

そのハンドルを使用してメソッドを呼び出すことができるように、カバーポイントのハンドルを取得するにはどうすればよいですか? 最初に、ハンドルをインスタンス化できるように、カバーポイントのタイプを知る必要があります。

次に例を示します。

class my_coverage_class;
  rand bit my_coverpoint;
  covergroup my_covergroup;
    option.per_instance = 1;
    coverpoint my_coverpoint;
  endgroup
  function new;
    my_covergroup = new;
  endfunction
endclass: my_coverage_class

program automatic testbench;
  initial begin
    my_coverage_class inst = new();
    begin 
      var type(inst.my_covergroup.my_coverpoint) cp
        = inst.my_covergroup.my_coverpoint; // BREAKS HERE
      cp.get_inst_coverage();
    end
  end
endprogram // testbench

VCS 2013.06 を使用して上記を実行すると、次のようになります。

Error-[NYI] Not Yet Implemented
testbench, 16
Feature is not yet supported: Type operator not supported 

注: を実行する$display("%s", $typename(inst.my_covergroup.my_coverpoint))と、<unknown>

4

1 に答える 1

2

エラー メッセージによると、シミュレーターはまだサポートしていませんtype。あったとしても、へのハンドルがある可能性があることを示唆するIEEE Std 1800-2012は何も表示されませcoverpointん シミュレーターが のハンドルをサポートしている場合covergorupsは、次のことができるはずです。

package my_package;
  covergroup my_cover_group(bit cp);
    option.per_instance = 1;
    coverpoint cp;
  endgroup
  class my_coverage_class;
    rand bit my_coverpoint;
    my_cover_group my_covergroup;
    function new;
      this.my_covergroup = new(this.my_coverpoint);
    endfunction
  endclass: my_coverage_class
endpackage : my_package

program automatic testbench;
  import my_package::*;
  my_cover_group covgrp_handle;
  initial begin
    my_coverage_class inst = new();
    begin 
      covgrp_handle = inst.my_covgrp;
      covgrp_handle.cp.get_inst_coverage();
    end
  end
endprogram // testbench

その他のオプションは、マクロを使用することです (例: `define cp inst.my_covergroup.my_coverpoint)。これは、提供されたテスト ケースでは機能しますが、多くの (場合によっては一意の) タイプのインスタンス/カバーグループ/カバーポイントを処理することを意図している場合、あまり柔軟ではありません。

于 2013-06-29T02:05:27.527 に答える