The syntax for a conditional if-else
statement is:
if (expression)
command1;
else
command2;
The else
is optional and assumes a latch or flip-flop
depending on whether or not there was a clock statement. Code with multiple if and else
entries can also be supported, as shown in the following example:
If (expression1)
Command1;
elsif (expression2)
command2;
elsif (expression3)
command3;
else
command4;
This example is synthesized as a priority if
statement.
- If the first expression is found to be
TRUE
, the others are not evaluated. - If unique or priority
if-else
statements are used, Vivado synthesis treats those asparallel_case
andfull_case
, respectively.