返回介绍

20.6.1 Covergroup Type Options

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

The following table lists options that describe a particular feature (or property) of the covergroup type as a whole. They are analogous to static data members of classes.

Table 20-3: Coverage group type (static) options

Option nameDefaultDescription
weight=constant_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.
goal=constant_number90Specifies the target goal for a covergroup type, or a coverpoint or cross of a covergroup type.
comment=string_literal""A comment that appears with the covergroup type, or a coverpoint or cross of the covergroup type. The comment is saved in the coverage database and included in the coverage report.
strobe=constant_number0If set to 1, all samples happen at the end of the time slot, like the $strobe system task.

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

type_option.option_name = expression ;

The identifier type_option is a built-in member of any coverage group (see Section 20.9 for a description).

Different instances of a covergroup cannot assign different values to type options. This is syntactically disallowed, since these options can only be initialized via constant expressions. Here is an example:

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 foo and bar";
    type_option.strobe = 1; // sample at the end of the time slot

    // 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.
    }

    b : coverpoint b_var
    {
        // Use weight w to compute the coverage of each instance
        option.weight = w;

        // Use weight 5 to compute the cumulative (type) coverage of g1
        type_option.weight = 5;
    }
endgroup

In the above example the coverage for each instance of g1 is computed as:

(((instance coverage of “a”) * 2) + ((instance coverage of “b”) * w)) / ( 2 + w)

On the other hand the coverage for covergroup type “g1” is computed as:

( ((overall type coverage of “a”) * 3) + ((overall type coverage of “b”) * 5) ) / (3 + 5).

Type options can be set procedurally at any time during simulation. The syntax is:

coverage_type_option_assignment ::=   // not in Annex A
    covergroup_name::type_option.option_name=expression;
  | covergroup_name::covergroup_item_identifier::type_option.option_name=expression;

Syntax 20-6—Coverage type 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::type_option.comment = "Here is a comment for covergroup g1";
// Set the weight for coverpoint "a" of covergroup g1
gc::a::type_option.weight = 3;
gc g1 = new;

The following table summarizes the syntactical level (covergroup, coverpoint, or cross) in which type options can be specified. When set at the covergroup level, the type options do not act as defaults for lower syntactic levels.

Table 20-4: Coverage type-options

Option nameAllowed Syntactic Level
covergroupcoverpointcross
weightYesYesYes
goalYesYesYes
commentYesYesYes
strobeYesNoNo

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

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

发布评论

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