📄 00257.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>20.6 Specifying coverage options</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', '00257.html');" onmousedown="onBodyMouseDown();">
<!-- Begin Popups -->
<div class="Element801" id="popup00435">
<div class="Element800">
<div class="Element14">
链接</div>
<div class="Element11">
<div class="Element10">
<a href="00856.html" target="topic">第二十章 覆盖</a>, <a href="00965.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, 'popup00435');"><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="00256.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="00258.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.6 Specifying coverage options</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">
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. </p>
<p class="Element10">
</p>
<p class="Element10">
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 </p>
<p class="Element10">
that instance. </p>
<p class="Element10">
</p><p class="Element10" style="text-align: center">
<strong>Table 20-1: Instance specific coverage options</strong> </p><div class="Element63">
<div class="TableDiv">
<table cellspacing="0" class="Table1">
<tr>
<td class="Element65" valign="top" width="11%">
<div class="Element66">
Option name </div></td><td class="Element65" valign="top" width="2%">
<div class="Element66">
Default </div></td><td class="Element65" valign="top" width="87%">
<div class="Element66">
Description </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
weight= number </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
1 </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
If 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. </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
goal=number </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
90 </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
Specifies the target goal for a covergroup instance, or a coverpoint or a cross of an instance. </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
name=string </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
unique name </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
Specify a name for the covergroup instance. If unspecified, a unique name for each instance is automatically generated by the tool. </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
comment=string </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
“” </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
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. </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
at_least=number </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
1 </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
Minimum number of hits for each bin. A bin with a hit count that is less than number is not considered covered. </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
detect_overlap=boolean </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
0 </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
When true, a warning is issued if there is an overlap between the range list (or transition list) of two bins of a coverpoint. </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
auto_bin_max=number </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
64 </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
Maximum number of automatically created bins when no bins are explicitly defined for a coverpoint. </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
cross_auto_bin_max=number </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
unbounded </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
Maximum number of automatically created cross product bins for a<br>cross. </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
cross_num_print_missing= number </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
0 </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
Number of missing (not covered) cross product bins that must be saved to the coverage database and printed in the coverage report. </div></td></tr><tr>
<td class="Element67" valign="top" width="11%">
<div class="Element68">
per_instance=boolean </div></td><td class="Element67" valign="top" width="2%">
<div class="Element68">
0 </div></td><td class="Element67" valign="top" width="87%">
<div class="Element68">
Each instance contributes to the overall coverage information for the covergroup type. When true, coverage information for this covergroup instance is tracked as well. </div></td></tr></table></div></div>
<p class="Element10">
The instance specific options mentioned above can be set in the covergroup definition. The syntax for setting these options in the covergroup definition is: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00908');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00908"><pre class="Element12">option.option_name = expression ;</pre></div></div>
<p class="Element10">
The identifier option is a built-in member of any coverage group (see Section 20.9 for a description). An example is shown below. </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00909');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00909"><pre class="Element12">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</pre></div></div>
<p class="Element10">
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: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00910');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00910"><pre class="Element12">coverage_option_assignment ::= // not in Annex A
instance_name<strong><span style="color: #FF0000">.option.</span></strong>option_name <strong><span style="color: #FF0000">=</span></strong> expression<strong><span style="color: #FF0000">;</span></strong>
| instance_name<strong><span style="color: #FF0000">.</span></strong>covergroup_item_identifier<strong><span style="color: #FF0000">.option.</span></strong>option_name <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-5—Coverage option assignment syntax (not in Annex A)</strong></p><p class="Element10">
</p>
<p class="Element10">
Here is an example: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00911');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00911"><pre class="Element12">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</pre></div></div>
<p class="Element10">
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. </p>
<p class="Element10">
</p><p class="Element10" style="text-align: center">
<strong>Table 20-2: Coverage options per-syntactic level</strong> </p><div class="Element63">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -