Conditional if-else Statement - 2024.1 English

Vivado Design Suite User Guide: Synthesis (UG901)

Document ID
UG901
Release Date
2024-06-28
Version
2024.1 English

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 as parallel_case and full_case, respectively.