Complete the code to add a default case in the always block.
always @(*) begin
case (state)
2'b00: out = 1'b0;
2'b01: out = 1'b1;
[1]
endcase
endThe default keyword is used in Verilog case statements to specify what happens if no other case matches.
Complete the code to ensure the output is assigned in all cases.
always @(*) begin
case (opcode)
3'b000: result = a + b;
3'b001: result = a - b;
[1]
endcase
endThe default case ensures result is assigned a value even if opcode doesn't match known cases, preventing latches.
Fix the error in the case statement by completing the default case.
always @(*) begin
case (sel)
2'b00: out = in0;
2'b01: out = in1;
2'b10: out = in2;
[1]
endcase
endAssigning 1'b0 in the default case prevents latches and sets a known safe output.
Complete the code to add a default case that prevents latches.
always @(*) begin
case (cmd)
3'b000: action = 2'b01;
3'b001: action = 2'b10;
[1]
endcase
endThe default case ensures action is assigned a safe value even for unknown cmd, preventing inferred latches.
Fill all three blanks to write a safe combinational block with a default case.
always @(*) begin [1] = 0; case (state) 2'b00: [2] = 1; 2'b01: [3] = 0; default: [2] = 0; endcase end
Assigning out before the case and in each case arm ensures no latches are inferred and output is always defined.