在系统 verilog 文件 returns 错误中的 class 中写入覆盖组
writing coverage group within a class in a system verilog file returns error
我正在我的 .sv 文件中的 class 中编写一个封面组,我正在使用它来随机化一些 inputs.I 不断出现错误:
An embedded coverage group not instantiated in the 'new' method
然后我在初始块中调用 run_coverage 函数。我不确定。
covergroup cg_for_arrays(ref logic [7:0]array, input int min, int max);
coverpoint cp_array
{
bins s = {min,max};
}
endgroup
function void run_coverage();
cg_for_arrays = new(array1,1,255);
cg_for_arrays.sample();
endfunction
错误信息很清楚。您只能在 class 的构造函数中构造一个 class 中定义的覆盖组。请参阅 SystemVerilog IEEE 1800-2012 LRM 中的 19.4 在 classes 中使用覆盖组。
我正在我的 .sv 文件中的 class 中编写一个封面组,我正在使用它来随机化一些 inputs.I 不断出现错误:
An embedded coverage group not instantiated in the 'new' method
然后我在初始块中调用 run_coverage 函数。我不确定。
covergroup cg_for_arrays(ref logic [7:0]array, input int min, int max);
coverpoint cp_array
{
bins s = {min,max};
}
endgroup
function void run_coverage();
cg_for_arrays = new(array1,1,255);
cg_for_arrays.sample();
endfunction
错误信息很清楚。您只能在 class 的构造函数中构造一个 class 中定义的覆盖组。请参阅 SystemVerilog IEEE 1800-2012 LRM 中的 19.4 在 classes 中使用覆盖组。