System verilog 如何获得coverpoint的句柄?

System verilog 如何获得coverpoint的句柄?,system-verilog,function-coverage,System Verilog,Function Coverage,如何获取覆盖点的句柄,以便使用该句柄调用方法? 首先,我需要知道覆盖点的类型,以便可以实例化句柄 以下是一个例子: class my_coverage_class; rand bit my_coverpoint; covergroup my_covergroup; option.per_instance = 1; coverpoint my_coverpoint; endgroup function new; my_covergroup = new;

如何获取覆盖点的句柄,以便使用该句柄调用方法? 首先,我需要知道覆盖点的类型,以便可以实例化句柄

以下是一个例子:

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\u covergroup.my\u coverpoint))
时,根据错误消息,我得到

,您的模拟器还不支持
type
。即使是这样,我也看不到任何迹象表明有一个
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\u covergroup.my\u coverpoint
)。这将适用于提供的测试用例,但是如果用于处理许多(可能是唯一的)类型的实例/覆盖组/覆盖点,则它不是非常灵活