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

📄 00253.html

📁 这是一本关于verilog编程语言的教程,对学习verilog语言有帮助
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>20.5 Defining cross coverage</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', '00253.html');" onmousedown="onBodyMouseDown();">

<!-- Begin Popups -->
<div class="Element801" id="popup00431">
<div class="Element800">
<div class="Element14">
链接</div>
<div class="Element11">
<div class="Element10">
<a href="00856.html" target="topic">第二十章 覆盖</a>, <a href="00964.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, 'popup00431');"><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="00252.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="00254.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.5 Defining cross coverage</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 coverage group can specify cross coverage between two or more coverage points or variables. Cross coverage is specified using the cross construct. When a variable V is part of a cross coverage, SystemVerilog implicitly creates a coverage point for the variable, as if it had been created by the statement coverpoint V;. Thus, a cross involves only coverage points. Expressions cannot be used directly in a cross; a coverage point must be explicitly defined first.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
The syntax for specifying cross coverage is given below. </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00897');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00897"><pre class="Element12">cover_cross ::=         // from Annex A.2.11
    [cover_point_identifer <strong><span style="color: #FF0000">:</span></strong>] <strong><span style="color: #FF0000">cross</span></strong> list_of_coverpoints[<strong><span style="color: #FF0000">iff(</span></strong>expression<strong><span style="color: #FF0000">)</span></strong>] select_bins_or_empty

list_of_coverpoints ::= cross_item <strong><span style="color: #FF0000">,</span></strong> cross_item {<strong><span style="color: #FF0000">,</span></strong> cross_item }

cross_item ::=
    cover_point_identifier
  | variable_identifier

select_bins_or_empty ::=
    <strong><span style="color: #FF0000">{</span></strong>{bins_selections_or_option<strong><span style="color: #FF0000">;</span></strong>}<strong><span style="color: #FF0000">}</span></strong>
  | <strong><span style="color: #FF0000">;</span></strong>

bins_selection_or_option ::=
    {attribute_instance} coverage_option
  | {attribute_instance} bins_selection

bins_selection ::= bins_keyword bin_identifier<strong><span style="color: #FF0000">=</span></strong>select_expression[<strong><span style="color: #FF0000">iff(</span></strong>expression<strong><span style="color: #FF0000">)</span></strong>]

select_expression ::=
    select_condition
  | <strong><span style="color: #FF0000">!</span></strong>select_condition
  | select_expression <strong><span style="color: #FF0000">&amp;&amp;</span></strong> select_expression
  | select_expression <strong><span style="color: #FF0000">||</span></strong> select_expression
  | <strong><span style="color: #FF0000">(</span></strong>select_expression<strong><span style="color: #FF0000">)</span></strong>

select_condition ::= <strong><span style="color: #FF0000">binsof(</span></strong>bins_expression<strong><span style="color: #FF0000">)</span></strong>[intersect<strong><span style="color: #FF0000">{</span></strong>open_range_list<strong><span style="color: #FF0000">}</span></strong>]

bins_expression ::=
    variable_identifier
  | cover_point_identifier[<strong><span style="color: #FF0000">.</span></strong>bins_identifier]

open_range_list ::= open_value_range {<strong><span style="color: #FF0000">,</span></strong> open_value_range}

open_value_range ::= value_range</pre></div></div>
<p class="Element10" style="text-align: center">
<strong>Syntax 20-4—Cross coverage syntax (excerpt from Annex A)</strong></p><p class="Element10">
&nbsp;</p>
<p class="Element10">
The label for a cross declaration provides an optional name. The label also creates a hierarchical scope for the bins defined within the cross.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
The expression within the optional iff provides a conditional guard for the cross coverage. If at any sample point, the condition evaluates to false, the cross coverage is ignored. The expression within the optional iff construct at the end of a cross bin definition provides a per-bin guard condition. If the expression is false, the cross bin is ignored.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
Cross coverage of a set of N coverage points is defined as the coverage of all combinations of all bins associated with the N coverage points, that is, the Cartesian product of the N sets of coverage-point bins. For example: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00898');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00898"><pre class="Element12">bit [3:0] a, b;
covergroup cov @(posedge clk);
    aXb : cross a, b;
endgroup</pre></div></div>
<p class="Element10">
The coverage group cov in the example above specifies the cross coverage of two 4-bit variables, a and b. SystemVerilog implicitly creates a coverage point for each variable. Each coverage point has 16 bins, namely auto[0]...auto[15]. The cross of a and b (labeled aXb), therefore, has 256 cross products, and each cross product is a bin of aXb.&nbsp;</p>
<p class="Element10">
&nbsp;</p>
<p class="Element10">
Cross coverage between expressions previously defined as coverage points is also allowed. For example: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00899');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00899"><pre class="Element12">bit [3:0] a, b, c;

covergroup cov2 @(posedge clk);
    BC: coverpoint b+c;
    aXb : cross a, BC;
endgroup</pre></div></div>
<p class="Element10">
The coverage group cov2 has the same number of cross products as the previous example, but in this case, one of the coverage points is the expression b+c, which is labeled BC. </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00900');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00900"><pre class="Element12">bit [31:0] a_var;
bit [3:0] b_var;

covergroup cov3 @(posedge clk);
    A: coverpoint a_var { bins yy[] = { [0:9] }; }
    CC: cross b_var, A;
endgroup</pre></div></div>

⌨️ 快捷键说明

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