📄 00184.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>17.7.8 序列上的条件</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', '00184.html');" onmousedown="onBodyMouseDown();">
<!-- Begin Popups -->
<div class="Element801" id="popup00343">
<div class="Element800">
<div class="Element14">
链接</div>
<div class="Element11">
<div class="Element10">
<a href="00175.html" target="topic">17.7 序列操作</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, 'popup00343');"><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="00183.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="00175.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="00185.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">
17.7.8 序列上的条件</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">
序列经常发生在某种假设的条件下以获得正确的行为。一个逻辑条件必须保持为“真”,例如在处理一个事物的时候。而且,在处理一个事务的时候,是禁止出现某些值的 。这样的情形可以直接使用下面的结构来表达: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00638');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00638"><pre class="Element12">sequence_expr ::= <span style="color: #008000">// 引用自附录A.2.10</span>
...
| expression_or_dist <strong><span style="color: #FF0000">throughout</span></strong> sequence_expr</pre></div></div>
<p class="Element10" style="text-align: center">
<strong>语法17-10 — throughout结构的语法(摘录自附录A)</strong></p><p class="Element10">
</p>
<p class="Element10">
<i><span class="Element146">exp <span style="color: #0000FF">throughout</span> seq</span></i>结构是下列语句的缩写: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00639');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00639"><pre class="Element12"><span style="color: #800080">(</span>exp<span style="color: #800080">) [</span><span style="color: #FF0000">*0</span><span style="color: #800080">:</span><span style="color: #FF0000">$</span><span style="color: #800080">]</span> <span style="color: #0000FF">intersect</span> seq</pre></div></div>
<p class="Element10">
</p>
<p class="Element10">
对于复合序列<i>exp <span style="color: #0000FF">throughout</span> seq</i>,只要<i><span class="Element146">seq</span></i>在一个有限的连续时钟标记间隔上匹配并且<i><span class="Element146">exp</span></i>在这个间隔的每一个时钟标记上为“真”,那么这个复合序列就在这段间隔上匹配。 </p>
<p class="Element10">
</p>
<p class="Element10">
图17-11演示了如下的例子。 </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00640');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00640"><pre class="Element12"><span style="color: #0000FF">sequence</span> burst_rule1<span style="color: #800080">;</span>
<span style="color: #800080">@(</span><span style="color: #0000FF">posedge</span> mclk<span style="color: #800080">)</span>
<span style="color: #0000FF">$fell</span><span style="color: #800080">(</span>burst_mode<span style="color: #800080">) ##</span><span style="color: #FF0000">0</span>
<span style="color: #800080">(!</span>burst_mode<span style="color: #800080">)</span> <span style="color: #0000FF">throughout</span> <span style="color: #800080">(##</span><span style="color: #FF0000">2</span> <span style="color: #800080">((</span>trdy<span style="color: #800080">==</span><span style="color: #FF0000">0</span><span style="color: #800080">)&&(</span>irdy<span style="color: #800080">==</span><span style="color: #FF0000">0</span><span style="color: #800080">)) [</span><span style="color: #FF0000">*7</span><span style="color: #800080">]);</span>
<span style="color: #0000FF">endsequence</span></pre></div></div>
<p class="Element10">
</p>
<p class="Element10" style="text-align: center">
<img src="Figure_17_11.png" border="0" alt="" title=""> </p>
<p class="Element10" style="text-align: center">
<strong>图17-11 — throughout限制失败的匹配</strong></p><p class="Element10">
</p>
<p class="Element10">
图17-11演示了起始于时钟标记2处针对序列<i><span class="Element146">burst_rule1</span></i>的计算尝试。由于信号<i><span class="Element146">burst_mode</span></i>在时钟标记1处为高并且在时钟标记2处为低,所以<i><span class="Element146"><span style="color: #0000FF">$fell</span><span style="color: #800080">(</span>burst_mode<span style="color: #800080">)</span></span></i>在时钟标记2处为“真”。为了实现<i><span class="Element146">burst_rule1</span></i>的匹配,要求<i><span class="Element146">burst_mode</span></i>的值在起始于时钟标记2处的子序列<i><span class="Element146"><span style="color: #800080">(##</span><span style="color: #FF0000">2</span> <span style="color: #800080">((</span>trdy<span style="color: #800080">==</span><span style="color: #FF0000">0</span><span style="color: #800080">)&&(</span>irdy<span style="color: #800080">==</span><span style="color: #FF0000">0</span><span style="color: #800080">)) [</span><span style="color: #FF0000">*7</span><span style="color: #800080">])</span></span></i>的一次匹配期间内为低。这个子序列在时钟标记2到时钟标记10之间匹配。然而,在时钟标记9处<i><span class="Element146">burst_mode</span></i>变为高,因此,根据<span style="color: #0000FF">througout</span>的规则,序列的匹配失败。 </p>
<p class="Element10">
</p>
<p class="Element10">
相反,如果信号<i><span class="Element146">burst_mode</span></i>能够至少在时钟标记10处保持为低,那么从时钟标记2到时钟标记10之间<i><span class="Element146">burst_rule1</span></i>会有一次匹配,如图17-12所示。 </p><p class="Element10" style="text-align: center">
<img src="Figure_17_12.png" border="0" alt="" title=""> </p>
<p class="Element10" style="text-align: center">
<strong>图17-12 — throughout限制成功的匹配</strong> </p></div>
</div>
<a name="Group"></a><div class="Element14">
<a onclick="toggleVisibilityStored('Group');" class="a_Element14"><img src="sectionminus.png" border="0" alt="" title="" id="imgGroup">Group</a></div>
<div id="divGroup">
<div class="Element11">
<div class="Element10">
<p class="Element10">
<a href="00175.html" target="topic">17.7 序列操作</a></p></div>
</div>
</div>
<a name="Links"></a><div class="Element14">
<a onclick="toggleVisibilityStored('链接');" class="a_Element14"><img src="sectionminus.png" border="0" alt="" title="" id="img链接">链接</a></div>
<div id="div链接">
<div class="Element11">
<div class="Element10">
<a href="00175.html" target="topic">17.7 序列操作</a></div>
</div>
</div>
</div>
<!-- End Page Content -->
<!-- Begin Page Footer -->
<hr width="98%" align="center" size="1" color="#CCCCCC" />
<table align="center" cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr height="10">
<td></td>
</tr>
<tr align="center">
<td>
<script type="text/javascript"><!--
google_ad_client = "pub-5266859600380184";
google_ad_width = 468;
google_ad_height = 60;
google_ad_format = "468x60_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_page_url = document.location;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
</td>
</tr>
<tr height="15">
<td></td>
</tr>
<tr align="center">
<td>
<font size=2>除非特别声明,原文版权归作者所有,如有转摘请注明原作者以及译者(<a href="http://www.fpgatech.net/" target="_blank">FPGA技术网</a>)信息。<br />
如果您对本主题有何建议或意见,请登陆<a href="http://www.fpgatech.net/forum/forumdisplay.php?fid=18" target="_blank">FPGA开发者家园</a>提交,您的参与是我们前进的动力。</font>
<script language="javascript" type="text/javascript" src="http://js.users.51.la/195685.js"></script>
<noscript><a href="http://www.51.la/?195685" target="_blank"><img alt="我要啦免费统计" src="http://img.users.51.la/195685.asp" style="border:none" /></a></noscript>
</td>
</tr>
</tbody>
</table>
<!-- End Page Footer -->
</div>
</div>
<!-- End Client Area -->
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -