?? 1076_8.html
字號:
<html>
<head>
<title>VHDL LRM- Introduction</title>
</head>
<body>
<h1><a name="8">Section 8</a></h1>
<a href="../../HTML/HOMEPG.HTM"><img src="HP.GIF" border=0></a>
<a href="1076_TOC.HTM"><img src="TOP.GIF" BORDER=0></a>
<a href="1076_7.HTM"><img src="LEFT.GIF" BORDER=0></a>
<a href="1076_9.HTM"><img src="RIGHT.GIF" BORDER=0></a>
<HR>
<h1>Sequential statements</h1>
<p>
<p>
<p>The various forms of sequential statements are described in this section. Sequential statements are used to define algorithms for the execution of a subprogram or process; they execute in the order in which they appear.
<pre> sequence_of_statements ::=
{ sequential_statement }
sequential_statement ::=
wait_statement
| assertion_statement
| report_statement
| signal_assignment_statement
| variable_assignment_statement
| procedure_call_statement
| if_statement
| case_statement
| loop_statement
| next_statement
| exit_statement
| return_statement
| null_statement
</pre>
<p>All sequential statements may be labeled. Such labels are implicitly declared at the beginning of the declarative part of the innermost enclosing process statement or subprogram body.
<h2><a name="8.1"> <a href = "1076_8.HTM#8.1"> 8.1 </a> Wait statement</a></h2>
<p>The wait statement causes the suspension of a process statement or a procedure.
<pre> wait_statement ::=
[ label : ] <b>wait</b> [ sensitivity_clause ] [ condition_clause ] [ timeout_clause ] ;
sensitivity_clause ::= <b>on</b> sensitivity_list
sensitivity_list ::= <i>signal</i>_name { , <i>signal</i>_name }
condition_clause ::= <b>until</b> condition
condition ::= <i>boolean</i>_expression
timeout_clause ::= <b>for</b> <i>time</i>_expression
</pre>
<p>The sensitivity clause defines the <i>sensitivity set</i> of the wait statement,which is the set of signals to which the wait statement is sensitive. Each signal name in the sensitivity list identifies a given signal as a member of the sensitivity set. Each signal name in the sensitivity list must be a static signal name, and each name must denote a signal for which reading is permitted. If no sensitivity clause appears, the sensitivity set is constructed according to the following (recursive) rule:
<p>The sensitivity set is initially empty. For each primary in the condition of the condition clause, if the primary is
<ul>
<p>-- A simple name that denotes a signal, add the longest static prefix of the name to the sensitivity set
<p>-- A selected name whose prefix denotes a signal, add the longest static prefix of the name to the sensitivity set
<p>-- An expanded name whose prefix denotes a signal, add the longest static prefix of the name to the sensitivity set
<p>-- An indexed name whose prefix denotes a signal, add the longest static prefix of the name to the sensitivity set and apply this rule to all expressions in the indexed name
<p>-- A slice name whose prefix denotes a signal, add the longest static prefix of the name to the sensitivity set and apply this rule to any expressions appearing in the discrete range of the slice name
<p>-- An attribute name, if the designator denotes a signal attribute, add the longest static prefix of the name of the implicit signal denoted by the attribute name to the sensitivity set; otherwise, apply this rule to the prefix of the attribute name
<p>-- An aggregate, apply this rule to every expression appearing after the choices and the =>, if any, in every element association
<p>-- A function call, apply this rule to every actual designator in every parameter association
<p>-- An actual designator of <b>open</b> in a parameter association, do not add to the sensitivity set
<p>-- A qualified expression, apply this rule to the expression or aggregate qualified by the type mark, as appropriate
<p>-- A type conversion, apply this rule to the expression type converted by the type mark
<p>-- A parenthesized expression, apply this rule to the expression enclosed within the parentheses
<p>-- Otherwise, do not add to the sensitivity set
</ul>
<p>This rule is also used to construct the sensitivity sets of the wait statements in the equivalent process statements for concurrent procedure call statements( <a href = "1076_9.HTM#9.3"> 9.3 </a> ), concurrent assertion statements ( <a href = "1076_9.HTM#9.4"> 9.4 </a> ), and concurrent signal assignment statements ( <a href = "1076_9.HTM#9.5"> 9.5 </a> ).
<p>If a signal name that denotes a signal of a composite type appears in a sensitivity list, the effect is as if the name of each scalar subelement of that signal appears in the list.
<p>The condition clause specifies a condition that must be met for the process to continue execution. If no condition clause appears, the condition clause <b>until</b> TRUE is assumed.
<p>The timeout clause specifies the maximum amount of time the process will remain suspended at this wait statement. If no timeout clause appears, the timeout clause <b>for</b> (STD.STANDARD.TIME'HIGH - STD.STANDARD.NOW) is assumed. It is an error if the time expression in the timeout clause evaluates to a negative value.
<p>The execution of a wait statement causes the time expression to be evaluated to determine the <i>timeout interval</i>. It also causes the execution of the corresponding process statement to be suspended, where the corresponding process statement is the one that either contains the wait statement or is the parent (see <a href = "1076_2.HTM#2.2"> 2.2 </a> ) of the procedure that contains the wait statement. The suspended process will resume, at the latest, immediately after the timeout interval has expired.
<p>The suspended process may also resume as a result of an event occurring on any signal in the sensitivity set of the wait statement. If such an event occurs,the condition in the condition clause is evaluated. If the value of the condition is TRUE, the process will resume. If the value of the condition is FALSE, the process will re-suspend. Such re-suspension does not involve the recalculation of the timeout interval.
<p>It is an error if a wait statement appears in a function subprogram or in a procedure that has a parent that is a function subprogram. Furthermore, it is an error if a wait statement appears in an explicit process statement that includes a sensitivity list or in a procedure that has a parent that is such a process statement.
<p><i>Example:</i>
<pre> <b>type</b> Arr <b>is</b> <b>array</b> (1 <b>to</b> 5) <b>of</b> BOOLEAN;
<b>function</b> F (P: BOOLEAN) <b>return</b> BOOLEAN;
<b>signal</b> S: Arr;
<b>signal</b> l, r: INTEGER <b>range</b> 1 <b>to</b> 5;
-- The following two wait statements have the same meaning:
<b>wait</b> <b>until</b> F(S(3)) <b>and</b> (S(l) <b>or</b> S(r));
<b>wait</b> <b>on</b> S(3), S, l, r <b>until</b> F(S(3)) <b>and</b> (S(l) <b>or</b> S(r));
</pre>
<h4>NOTES</h4>
<p>1--The wait statement <b>wait</b> <b>until</b> Clk = '1'; has semantics identical to
<pre> <b>loop</b>
<b>wait</b> <b>on</b> Clk;
<b>exit</b> <b>when</b> Clk = '1';
<b>end</b> <b>loop</b>;
</pre>
<p>because of the rules for the construction of the default sensitivity clause. These same rules imply that <b>wait</b> <b>until</b> True; has semantics identical to <b>wait</b>;.
<p>2--The conditions that cause a wait statement to resume execution of its enclosing process may no longer hold at the time the process resumes execution if the enclosing process is a postponed process.
<p>3--The rule for the construction of the default sensitivity set implies that if a function call appears in a condition clause and the called function is an impure function,then any signals that are accessed by the function but that are not passed through the association list of the call are not added to the default sensitivity set for the condition by virtue of the appearance of the function call in the condition.
<h2><a name="8.2"> <a href = "1076_8.HTM#8.2"> 8.2 </a> Assertion statement</a></h2>
<p>An assertion statement checks that a specified condition is true and reports an error if it is not.
<pre> assertion_statement ::= [ label : ] assertion ;
assertion ::=
<b>assert</b> condition
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -