返回介绍

20.6 Specifying coverage options

发布于 2020-09-09 22:55:56 字数 8373 浏览 908 评论 0 收藏 0

Options control the behavior of the covergroup, coverpoint and cross. There are two types of options: those that are specific to an instance of a covergroup, and those that specify an option for the covergroup type as a whole.

The following table lists instance specific covergroup options and their description. Each instance of a covergroup can initialize an instance specific option to a different value. The initialized option value affects only

that instance.

Table 20-1: Instance specific coverage options

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.
goal=number90Specifies the target goal for a covergroup instance, or a coverpoint or a cross of an instance.
name=stringunique nameSpecify 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 the instance of a covergroup, or 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_auto_bin_max=numberunboundedMaximum number of automatically created cross product bins for a
cross.
cross_num_print_missing= number0Number of missing (not covered) cross product bins that must 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 is tracked as well.

The instance specific options mentioned above can be set in the covergroup definition. The syntax for setting these options in the covergroup definition is:

option.option_name = expression ;

The identifier option is a built-in member of any coverage group (see Section 20.9 for a description). An example is shown below.

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 than 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. The per_instance option can only be set in the covergroup definition. Other instance specific options can be set procedurally after a covergroup has been instantiated. The syntax is:

coverage_option_assignment ::=   // not in Annex A
    instance_name.option.option_name = expression;
  | instance_name.covergroup_item_identifier.option.option_name = expression;

Syntax 20-5—Coverage option assignment syntax (not in Annex A)

Here is an example:

covergroup gc @(posedge clk) ;
    a : coverpoint a_var;
    b : coverpoint b_var;
endgroup
...
gc g1 = new;
g1.option.comment = "Here is a comment set for the instance g1";
g1.a.option.weight = 3; // Set weight for coverpoint “a” of instance g1

The following table summarizes the syntactical level (covergroup, coverpoint, or cross) at which instance options can be specified. All instance options can be specified at the covergroup level. Except for the weight, goal, comment, and per_instance options, all other options set at the covergroup syntactic level act as a default value for the corresponding option of all coverpoints and crosses in the covergroup. Individual coverpoint or crosses can overwrite these default values. When set at the covergroup level, the weight, goal, comment, and per_instance options do not act as default values to the lower syntactic levels.

Table 20-2: Coverage options per-syntactic level

Option nameAllowed in Syntactic Level
covergroupcoverpointcross
nameYesNoNo
weightYesYesYes
goalYesYesYes
commentYesYesYes
al_leastYes (default for coverpoints & crosses)YesYes
detect_overlapYes (default for coverpoints)YesNo
auto_bin_maxYes (default for coverpoints)YesNo
cross_auto_bin_maxYes (default for crosses)NoYes
cross_num_print_missingYes (default for crosses)NoYes
per_instanceYesNoNo

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文