⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 00247.html

📁 这是一本关于verilog编程语言的教程,对学习verilog语言有帮助
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>20.4 定义覆盖点</title>
    <meta http-equiv="Content-Type" content="text/html; charset=GB2312" />
    <meta name="generator" content="Doc-O-Matic" />
    <meta http-equiv="Content-Style-Type" content="text/css" />
    <link rel="STYLESHEET" href="default.css" type="text/css" />

<script type="text/javascript" src="scripts.js"></script>
</head>
<body class="Element700" onload="onBodyLoadEx('systemverilog31a.html', 'topic', '00247.html');" onmousedown="onBodyMouseDown();">

<!-- Begin Popups -->
<div class="Element801" id="popup00425">
<div class="Element800">
<div class="Element14">
链接</div>
<div class="Element11">
<div class="Element10">
<a href="00856.html" target="topic">第二十章 覆盖</a>, <a href="00963.html" target="topic">主题</a></div>
</div>
</div>
</div>

<!-- End Popups -->

<!-- Begin Page Header -->
<div class="Element710" id="areafixed">
<div class="Element92">
<table width="100%" cellspacing="0" cellpadding="0">
<tr><td width="33%">
<div class="Element1">
<a href="#" onmousedown="showPopup(this, 'popup00425');"><img src="seealsolink.png" border="0" alt="" title=""></a> SystemVerilog 3.1a语言参考手册</div>
</td><td width="34%">
<div class="Element2">
</div>
</td><td width="33%">
<div class="Element90">
<a href="00246.html" target="topic"><img src="btn_prev_lightblue.gif" border="0" alt="Previous" title="Previous" onmouseover="switchImage(this, 'btn_prev_lightblue_hover.gif');" onmouseout="switchImage(this, 'btn_prev_lightblue.gif');"></a><a href="00856.html" target="topic"><img src="btn_up_lightblue.gif" border="0" alt="Up" title="Up" onmouseover="switchImage(this, 'btn_up_lightblue_hover.gif');" onmouseout="switchImage(this, 'btn_up_lightblue.gif');"></a><a href="00248.html" target="topic"><img src="btn_next_lightblue.gif" border="0" alt="Next" title="Next" onmouseover="switchImage(this, 'btn_next_lightblue_hover.gif');" onmouseout="switchImage(this, 'btn_next_lightblue.gif');"></a></div>
</td></tr></table><div class="Element5">
20.4 定义覆盖点</div>
</div>
</div>

<!-- End Page Header -->

<!-- Begin Client Area -->
<div class="Element720" id="areascroll">
<div class="Element721">

<!-- Begin Page Content -->
<div class="Element58">
<a name="描述"></a><div class="Element11">
<div class="Element10">
<p class="Element10">
A covergroup can contain one or more coverage points. A coverage point can be an integral variable or an integral expression. Each coverage point includes a set of bins associated with its sampled values or its valuetransitions. The bins can be explicitly defined by the user or automatically created by SystemVerilog. The syntax for specifying coverage points is given below. </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00870');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00870"><pre class="Element12">cover_point ::=         // from Annex A.2.11
    [cover_point_identifer <strong><span style="color: #FF0000">:</span></strong>] <strong><span style="color: #FF0000">coverpoint</span></strong> expression [<strong><span style="color: #FF0000">iff(</span></strong>expression<strong><span style="color: #FF0000">)</span></strong>] bins_or_empty

bins_or_empty ::=
    <strong><span style="color: #FF0000">{</span></strong>{attribute_instance} {bins_or_options<strong><span style="color: #FF0000">;</span></strong>}<strong><span style="color: #FF0000">}</span></strong>
  | <strong><span style="color: #FF0000">;</span></strong>

bins_or_options ::=
    coverage_option
  | [<strong><span style="color: #FF0000">wildcard</span></strong>] bins_keyword bin_identifier[<strong><span style="color: #FF0000">[</span></strong>[expression]<strong><span style="color: #FF0000">]</span></strong>]<strong><span style="color: #FF0000">={</span></strong>range_list<strong><span style="color: #FF0000">}</span></strong>[<strong><span style="color: #FF0000">iff(</span></strong>expression<strong><span style="color: #FF0000">)</span></strong>]
  | [<strong><span style="color: #FF0000">wildcard</span></strong>] bins_keyword bin_identifier[<strong><span style="color: #FF0000">[]</span></strong>]=trans_list [<strong><span style="color: #FF0000">iff(</span></strong>expression<strong><span style="color: #FF0000">)</span></strong>]
  | bins_keyword bin_identifier[<strong><span style="color: #FF0000">[</span></strong>[expression]<strong><span style="color: #FF0000">]</span></strong>]<strong><span style="color: #FF0000">=default</span></strong> [<strong><span style="color: #FF0000">iff(</span></strong>expression<strong><span style="color: #FF0000">)</span></strong>]
  | bins_keyword bin_identifier <strong><span style="color: #FF0000">=</span></strong> <strong><span style="color: #FF0000">default</span></strong> <strong><span style="color: #FF0000">sequence</span></strong> [<strong><span style="color: #FF0000">iff(</span></strong>expression<strong><span style="color: #FF0000">)</span></strong>]

bins_keyword::= <strong><span style="color: #FF0000">bins</span></strong> | <strong><span style="color: #FF0000">illegal_bins</span></strong> | <strong><span style="color: #FF0000">ignore_bins</span></strong>

range_list ::= value_range {<strong><span style="color: #FF0000">,</span></strong> value_range}

value_range ::=                        // from Annex A.8.3
    expression
  | <strong><span style="color: #FF0000">[</span></strong>expression <strong><span style="color: #FF0000">:</span></strong> expression<strong><span style="color: #FF0000">]</span></strong></pre></div></div>
<p class="Element10" style="text-align: center">
<strong>Syntax 20-2—coverpoint syntax (excerpt from Annex A)</strong></p><p class="Element10">
&nbsp;</p>
<p class="Element10">
A coverage point creates a hierarchical scope, and can be optionally labeled. If the label is specified then it designates the name of the coverage point. This name can be used to add this coverage point to a cross coverage specification, or to access the methods of the coverage point. If the label is omitted and the coverage point is associated with a single variable then the variable name becomes the name of the coverage point. Otherwise, an implementation can generate a name for the coverage point only for the purposes of coverage reporting, that is, generated names cannot be used within the language.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
A coverage point can sample the values that correspond to a particular scheduling region (see Section 14) by specifying a clocking block signal. Thus, a coverage point that denotes a clocking block signal will sample the values made available by the clocking block. If the clocking block specifies a skew of #1step, the coverage point will sample the signal values from the Preponed region. If the clocking block specifies a skew of #0, the coverage point will sample the signal values from the Observe region.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
The expression within the iff construct specifies an optional condition that disables coverage for that cover point. If the guard expression evaluates to false at a sampling point, the coverage point is ignored. For example: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00871');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00871"><pre class="Element12">covergroup g4;
    coverpoint s0 iff(!reset);
endgroup</pre></div></div>
<p class="Element10">
In the preceding example, cover point s0 is covered only if the value reset is false.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
A coverage-point bin associates a name and a count with a set of values or a sequence of value transitions. If the bin designates a set of values, the count is incremented every time the coverage point matches one of the values in the set. If the bin designates a sequence of value transitions, the count is incremented every time the coverage point matches the entire sequence of value transitions.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
The bins for a coverage point can be automatically created by SystemVerilog or explicitly defined using the bins construct to name each bin. If the bins are not explicitly defined, they are automatically created by SystemVerilog. The number of automatically created bins can be controlled using the auto_bin_max coverage option. Coverage options are described in Section 20.6.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
The bins construct allows creating a separate bin for each value in the given range-list, or a single bin for the entire range of values. To create a separate bin for each value (an array of bins) the square brackets, [], must follow the bin name. To create a fixed number of bins for a set of values, a number can be specified inside the square brackets. The range_list used to specify the set of values associated with a bin shall be constant expressions, instance constants (for classes only) or non-ref arguments to the coverage group.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
If a fixed number of bins is specified, and that number is smaller than the number of values in the bin then the possible bin values are uniformly distributed among the specified bins. If the number of values is not divisible by the number of bins then the last bin will include the remaining items. For example: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00872');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00872"><pre class="Element12">bins fixed [3] = {1:10};</pre></div></div>
<p class="Element10">
The 11 possible values are distributed as follows: &lt;1,2,3&gt;, &lt;4,5,6&gt;, &lt;7,8,9,10&gt;. If the number of bins exceeds the number of values then some of the bins will be empty.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
The expression within the iff construct at the end of a bin definition provides a per-bin guard condition. If the expression is false at a sampling point, the count for the bin is not incremented.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
The default specification defines a bin that is associated with none of the defined value bins. The default bin catches the values of the coverage point that do not lie within any of the defined bins. However, the coverage calculation for a coverage point shall not take into account the coverage captured by the default bin. The default is useful for catching unplanned or invalid values. The default sequence form can be used to catch all transitions (or sequences) that do not lie within any of the defined transition bins (see Section 20.4.1). The default sequence specification does not accept multiple transition bins (the [] notation is not allowed). </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00873');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00873"><pre class="Element12">bit [9:0] v_a;
covergroup cg @(posedge clk);
    coverpoint v_a
    {
        bins a = { [0:63],65 };
        bins b[] = { [127:150],[148:191] }; // note overlapping values
        bins c[] = { 200,201,202 };
        bins d = { [1000:$] };
        bins others[] = default;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -