Integer Handling in Verilog Case Statements Example - 2022.1 English

Vivado Design Suite User Guide: Synthesis (UG901)

Document ID
UG901
Release Date
2022-06-06
Version
2022.1 English

In the following coding example, the case item expression 4 is an unsized integer that causes unpredictable results. To resolve this issue, size the case item expression 4 to 3 bits, as shown in the following example:

reg [2:0] condition1; always @(condition1) begin

   case(condition1)

   4 : data_out = 2; // Generates faulty logic

   3'd4 : data_out = 2; // Does work

   endcase

end