📄 00173.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN">
<html>
<head>
<title>17.5 序列</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', '00173.html');" onmousedown="onBodyMouseDown();">
<!-- Begin Popups -->
<div class="Element801" id="popup00333">
<div class="Element800">
<div class="Element14">
链接</div>
<div class="Element11">
<div class="Element10">
<a href="00868.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, 'popup00333');"><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="00172.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="00868.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="00174.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.5 序列</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">
<div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00576');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00576"><pre class="Element12">sequence_expr ::= <span style="color: #008000">// 引用自附录A.2.10</span>
cycle_delay_range sequence_expr {cycle_delay_range sequence_expr}
| sequence_expr cycle_delay_range sequence_expr {cycle_delay_range sequence_expr}
| expression_or_dist [boolean_abbrev]
| <strong><span style="color: #FF0000">(</span></strong>expression_or_dist {<strong><span style="color: #FF0000">,</span></strong> sequence_match_item}<strong><span style="color: #FF0000">)</span></strong> [boolean_abbrev]
| sequence_instance [sequence_abbrev]
| <strong><span style="color: #FF0000">(</span></strong>sequence_expr {<strong><span style="color: #FF0000">,</span></strong> sequence_match_item}<strong><span style="color: #FF0000">)</span></strong> [sequence_abbrev]
| sequence_expr <strong><span style="color: #FF0000">and</span></strong> sequence_expr
| sequence_expr <strong><span style="color: #FF0000">intersect</span></strong> sequence_expr
| sequence_expr <strong><span style="color: #FF0000">or</span></strong> sequence_expr
| <strong><span style="color: #FF0000">first_match(</span></strong>sequence_expr {<strong><span style="color: #FF0000">,</span></strong> sequence_match_item}<strong><span style="color: #FF0000">)</span></strong>
| expression_or_dist <strong><span style="color: #FF0000">throughout</span></strong> sequence_expr
| sequence_expr <strong><span style="color: #FF0000">within</span></strong> sequence_expr
| clocking_event sequence_expr
cycle_delay_range ::=
<strong><span style="color: #FF0000">##</span></strong> integral_number
| <strong><span style="color: #FF0000">##</span></strong> identifier
| <strong><span style="color: #FF0000">##</span></strong> <strong><span style="color: #FF0000">(</span></strong>constant_expression<strong><span style="color: #FF0000">)</span></strong>
| <strong><span style="color: #FF0000">##</span></strong> <strong><span style="color: #FF0000">[</span></strong>cycle_delay_const_range_expression<strong><span style="color: #FF0000">]</span></strong>
sequence_match_item ::=
operator_assignment
| inc_or_dec_expression
| subroutine_call
sequence_instance ::=
ps_sequence_identifier [<strong><span style="color: #FF0000">(</span></strong>[actual_arg_list]<strong><span style="color: #FF0000">)</span></strong>]
actual_arg_list ::=
actual_arg_expr {<strong><span style="color: #FF0000">,</span></strong> actual_arg_expr}
| <strong><span style="color: #FF0000">.</span></strong>formal_identifier<strong><span style="color: #FF0000">(</span></strong>actual_arg_expr<strong><span style="color: #FF0000">)</span></strong> {<strong><span style="color: #FF0000">, .</span></strong>formal_identifier<strong><span style="color: #FF0000">(</span></strong>actual_arg_expr<strong><span style="color: #FF0000">)</span></strong>}
actual_arg_expr ::=
event_expression
| <strong><span style="color: #FF0000">$</span></strong>
boolean_abbrev ::=
consecutive_repetition
| non_consecutive_repetition
| goto_repetition
sequence_abbrev ::= consecutive_repetition
consecutive_repetition ::= <strong><span style="color: #FF0000">[*</span></strong> const_or_range_expression<strong><span style="color: #FF0000">]</span></strong>
non_consecutive_repetition ::= <strong><span style="color: #FF0000">[=</span></strong> const_or_range_expression<strong><span style="color: #FF0000">]</span></strong>
goto_repetition ::= <strong><span style="color: #FF0000">[-></span></strong> const_or_range_expression<strong><span style="color: #FF0000">]</span></strong>
const_or_range_expression ::=
constant_expression
| cycle_delay_const_range_expression
cycle_delay_const_range_expression ::=
constant_expression <strong><span style="color: #FF0000">:</span></strong> constant_expression
| constant_expression <strong><span style="color: #FF0000">:</span></strong> <strong><span style="color: #FF0000">$</span></strong>
expression_or_dist ::= expression[<strong><span style="color: #FF0000">dist{</span></strong>dist_list<strong><span style="color: #FF0000">}</span></strong>]</pre></div></div>
<p class="Element10" style="text-align: center">
<strong>语法17-2 — 序列语法(摘录自附录A)</strong></p><p class="Element10">
</p>
<p class="Element10">
特性经常由有序的行为构建。<span style="color: #0000FF">sequence</span>功能提供了一种能力来构建和处理有序的行为。最简单的有序行为是线性的。一个线性序列是SystemVerilog布尔表达式的一个有限列表,这些表达式以一个线性增加的时间顺序排列。如果第一个布尔表达式在第一个时钟标记处被计算成“真”,第二个布尔表达式在第二个时钟标记处被计算成“真”,依此类推,直到并包括最后一个布尔表达式在最后一个时钟标记被计算成“真”,那么这个线性序列被说成在一个连续时钟标记的有限间隔上匹配。单个布尔表达式是一个简单线性序列的一个例子,并且它在单个时钟标记处匹配,只要在这个时钟标记处该布尔表达式被计算成“真”。 </p>
<p class="Element10">
</p>
<p class="Element10">
更为复杂的有序行为通过SystemVerilog序列来描述。一个序列是一个基于SystemVerilog布尔表达式的正则表达式,它简明地说明了一组零个、有限多或无限多的线性序列。如果这个集合中的线性序列中至少有一个匹配于一个连续时钟标记的有限间隔,那么序列就被认为在这个间隔上匹配。 </p>
<p class="Element10">
</p>
<p class="Element10">
一个特性可能包含一个或多个开始于不同时间的有序行为的检查。一个序列的计算是一次搜索起始始于一个特定时钟标记的序列匹配的过程。为了确定是否存在一个这样的匹配,在特定的时钟标记处开始计算合适的布尔表达式并在后续的时钟标记上持续直到找到一个匹配或者由于不存在匹配而中止。 </p>
<p class="Element10">
</p>
<p class="Element10">
类似于链表的串联,序列可以由串联组成。串联使用<span style="color: #800080">##</span>指定了一个从第一个序列的结尾直到第二个序列的开始的延时。 </p>
<p class="Element10">
</p>
<p class="Element10">
下述为序列串联的语法: </p><div class="Element170">
<a href="#" onclick="CopyElementToClipboard('code00577');">Copy Code</a></div>
<div class="Element13"><div class="Element12" id="code00577"><pre class="Element12">sequence_expr ::= <span style="color: #008000">// 引用自附录A.2.10</span>
cycle_delay_range sequence_expr {cycle_delay_range sequence_expr}
| sequence_expr cycle_delay_range sequence_expr {cycle_delay_range sequence_expr}
...
cycle_delay_range ::=
<strong><span style="color: #FF0000">##</span></strong> integral_number
| <strong><span style="color: #FF0000">##</span></strong> identifier
| <strong><span style="color: #FF0000">## (</span></strong>constant_expression<strong><span style="color: #FF0000">)</span></strong>
| <strong><span style="color: #FF0000">## [</span></strong>cycle_delay_const_range_expression<strong><span style="color: #FF0000">]</span></strong>
cycle_delay_const_range_expression ::=
constant_expression <strong><span style="color: #FF0000">:</span></strong> constant_expression
| constant_expression <strong><span style="color: #FF0000">: $</span></strong></pre></div></div>
<p class="Element10" style="text-align: center">
<strong>语法17-3 — 序列串联语法(摘录自附录A)</strong></p><p class="Element10">
</p>
<p class="Element10">
在此语法中:
<ul class="Element631">
<li class="Element601"><i><span class="Element146">constant_expression</span></i>在编译时计算并且必须产生一个整数值。</li>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -