Control Flow Statements

HDL Coder™ supports the following control flow statements and constructs with restrictions.

Control Flow Statement Restrictions

for

Do not use for loops without static bounds.

Do not use the & and | operators within conditions of a for statement. Instead, use the && and || operators.

HDL Coder does not support nonscalar expressions in the conditions of for statements. Instead, use the all or any functions to collapse logical vectors into scalars.

if

Do not use the & and | operators within conditions of an if statement. Instead, use the && and || operators.

HDL Coder does not support nonscalar expressions in the conditions of if statements. Instead, use the all or any functions to collapse logical vectors into scalars.

switch

The conditional expression in a switch or case statement must use only:

  • uint8, uint16, uint32, int8, int16, or int32 data types

  • Scalar data

If multiple case statements make assignments to the same variable, the numeric type and fimath specification for that variable must be the same in every case statement.

The following control flow statements are not supported:

  • while

  • break

  • continue

  • return

  • parfor

Vector Function Limitations Related to Control Statements

Avoid using the following vector functions, as they may generate loops containing break statements:

  • isequal

  • bitrevorder

Was this topic helpful?