case is a priority encoder
Cases are evaluated sequentially case (1’b1) s[0] : out = a; s[1] : out = b; s[2] : out = c; s[3] : out = d; endcase
Don’t cares must use casex
- Comparing to x in case is always false casex (s) 4’b1xxx : out = a; 4’b01xx : out = b; 4’b001x : out = c; 4’b0001 : out = d; endcase
s[0]'•s[1]'•s[2]'•s[3]•d;