Use Case Block When Priority Encoder Not Needed - 2025.2 English - UG1387

Versal Adaptive SoC Hardware, IP, and Platform Development Methodology Guide (UG1387)

Document ID
UG1387
Release Date
2025-12-17
Version
2025.2 English

When a priority encoding is not needed, use a case block instead of an if-then-else block or ternary operator.

Inefficient coding example:

if (reg1)
  val = reg_in1;
else if (reg2)
   val = reg_in2;
else if (reg3)
   val = reg_in3;
else val = reg_in4;

Correct coding example:

(* parallel_case *) 
casex ({reg1, reg2, reg3})
 1xx: val = reg_in1;
 x1x: val = reg_in2;
 xx1: val = reg_in3;
 default: val = reg_in4;
endcase