【SystemVerilog】coverage options

今天複習到coverage的相關寫法,翻到LRM進行查閱,發現自己之前做過筆記,但時間已久就忘了,現在把他記錄一下方便自己查閱。

coverage有兩大類option: 一類是針對每個covergroup instance的(即每個instance可以單獨指定),一類是針對covergroup type的(即每個covergroup指定);

類似于class 中 靜態變量和local 變量,靜態變量是每個instance所共有,而local 變量是每個instance私有。


先看針對每個covergroup instance的option

Option nameDefaultDescription
weight= number1If set at the covergroup syntactic level, it specifies the weight
of this covergroup instance for computing the overall instance
coverage of the simulation. If set at the coverpoint (or
cross) syntactic level, it specifies the weight of a coverpoint
(or cross) for computing the instance coverage of the enclosing
covergroup. The specified weight shall be a non-negative
integral value.
goal=number100Specifies the target goal for a covergroup instance or for a
coverpoint or a cross of an instance.
name=stringunique
name
Specifies a name for the covergroup instance. If unspecified, a
unique name for each instance is automatically generated by the
tool.
comment=string“”A comment that appears with a covergroup instance or with a
coverpoint or cross of the covergroup instance. The comment is
saved in the coverage database and included in the coverage
report.
at_least=number1Minimum number of hits for each bin. A bin with a hit count that
is less than number is not considered covered.
detect_overlap=boolean0When true, a warning is issued if there is an overlap between the
range list (or transition list) of two bins of a coverpoint.
auto_bin_max=number64Maximum number of automatically created bins when no bins are
explicitly defined for a coverpoint.
cross_num_print_missing=
number
0Number of missing (not covered) cross product bins that shall be
saved to the coverage database and printed in the coverage report.
per_instance=boolean0Each instance contributes to the overall coverage information for
the covergroup type. When true, coverage information for this
covergroup instance shall be saved in the coverage database and
included in the coverage report. When false, implementations are
not required to save instance-specific information.
get_inst_coverage=boolean0Only applies when the merge_instances type option is set.
Enables the tracking of per instance coverage with the
get_inst_coverage built-in method. When false, the value
returned by get_inst_coverage shall equal the value
returned by get_coverage.
covergroup g1 (int w, string instComment) @(posedge clk) ;

// track coverage information for each instance of g1 in addition
// to the cumulative coverage information for covergroup type g1
option.per_instance = 1;

// comment for each instance of this covergroup
option.comment = instComment;

a : coverpoint a_var
{
// Create 128 automatic bins for coverpoint “a” of each instance of g1
option.auto_bin_max = 128;
}

b : coverpoint b_var
{
// This coverpoint contributes w times as much to the coverage of an
// instance of g1 as coverpoints "a" and "c1"
option.weight = w;
}

c1 : cross a_var, b_var ;
endgroup

Option assignment statements in the covergroup definition are evaluated at the time that the covergroup is instantiated.

每個option的適用範圍

Option namecovergroupcoverpointcross
nameYesNoNo
weightYesYesYes
goalYesYesYes
commentYesYesYes
at_leastYes(default for coverpoints & crosses)YesYes
detect_overlapYes (default for coverpoints)YesNo
auto_bin_maxYes (default for coverpoints)YesNo
cross_num_print_missingYes (default for crosses)NoYes
per_instanceYesNoNo

針對covergroup type 的option

Option nameDefaultDescription
weight= number1If set at the covergroup syntactic level, it specifies the weight of
this covergroup for computing the overall cumulative (or type)
coverage of the saved database. If set at the coverpoint (or
cross) syntactic level, it specifies the weight of a coverpoint (or
cross) for computing the cumulative (or type) coverage of the
enclosing covergroup. The specified weight shall be a nonnegative
integral value.
goal=constant_number100Specifies the target goal for a covergroup type or for a coverpoint
or cross of a covergroup type.
strobe=boolean0When true, all samples happen at the end of the time slot, like the
$strobe system task.
comment=string“”A comment that appears with the covergroup type or with a
coverpoint or cross of the covergroup type. The comment is saved in
the coverage database and included in the coverage report.
merge_instances=boolean0When true, cumulative (or type) coverage is computed by merging
instances together as the union of coverage of all instances. When
false, type coverage is computed as the weighted average of
instances.
distribute_first=boolean0When true, instructs the tool to perform value distribution to the bins
prior to application of the with_covergroup_expression.
type_option.member_name = constant_expression ;
covergroup g1 (int w, string instComment) @(posedge clk) ;
// track coverage information for each instance of g1 in addition
// to the cumulative coverage information for covergroup type g1

option.per_instance = 1;
type_option.comment = "Coverage model for features x and y";
type_option.strobe = 1; // sample at the end of the time slot

// compute type coverage as the merge of all instances
type_option.merge_instances = 1;

// comment for each instance of this covergroup
option.comment = instComment;


a : coverpoint a_var

{
// Use weight 2 to compute the coverage of each instance
option.weight = 2;

// Use weight 3 to compute the cumulative (type) coverage for g1
type_option.weight = 3;

// NOTE: type_option.weight = w would cause syntax error.
}

endgroup

Different instances of a covergroup cannot assign different values to type options.

 適用範圍:

ref: sv LRM

 

  • 3
    点赞
  • 39
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值