What is latch inference and how can you avoid it?
What is latch inference and how can you avoid it?
Model answer
An inferred latch is storage the tool creates because a combinational always block does not assign an output on every path (missing else , missing default in case , or an output not assigned in all branches). It usually is unintended and causes timing/verification trouble. Avoid it by: verilog always @(*) begin y = 1'b0; // default value: no latch possible case (sel) 2'b00: y = a; 2'b01: y = b; 2'b10: y = c; default: y = 1'b0; endcase end