|
The If Then Statement lists a series of behavioral statements to be activated after the positive evaluation of one or more Boolean expressions.
The following example shows an If Then Statement:
IF a[] == b[] THEN c[8..1] = H "77"; addr[3..1] = f[3..1].q; f[].d = addr[] + 1; ELSIF g3 $ g4 THEN f[].d = addr[]; ELSE d = VCC; END IF;
The If Then Statement has the following characteristics:
The keywords IF
and THEN
enclose the Boolean expression to be evaluated and are followed by one or
more behavioral statements, each of which ends with a semicolon (;
).
The keywords ELSIF
and THEN
enclose any additional
Boolean expressions to be evaluated, and are also followed by one or more
behavioral statements. These optional statements can be repeated.
The behavioral statement(s) following the keyword THEN
are activated for the first expression that evaluates to true.
The keyword ELSE
followed by one or more
behavioral statements is similar to the WHEN
OTHERS
default alternative of the Case
Statement. If none of the previously evaluated Boolean equations is
true, the behavioral statement(s) following ELSE
are activated.
In the example shown above, if neither expression evaluates to true, the
equation d = VCC
is activated. The ELSE
clause
is also optional.
Expressions following IF
and ELSIF
keywords
(in the example shown above, a[] == b[]
and g3 $ g4
)
are evaluated concurrently.
The keywords END IF
and a semicolon (;
) end the
If Then Statement.
An If Then Statement may generate logic that is too complex for the Compiler. If an If Then Statement contains complex expressions, the inversion of each expression is likely to be even more complex. Example
- PLDWorld - |
|
Created by chm2web html help conversion utility. |