Verilog case (cont)
Cases are executed sequentially
- The following implements a priority encoder
input [7:0] A; // 8-bit input vector
output [2:0] Y; // 3-bit encoded output
reg [2:0] Y; // target of assignment
default: Y = 3’bX; // Don’t care when input is all 0’s