I have a design module (a partially implemented seven segment display) with a case statement as shown below. However, it looks as if, if a case statement is not catered for a bcd value the previously assigned segment value is returned as the segment value for the bcd value which is not catered for in the switch statement.
Why is it behaving that way? Assuming I don't want to use a default statement.
I printed out the values of the bcd, segment and the expectedOutput and I observed what I just wrote above.
module seven_segment_display(output logic[6:0] segment, input logic[3:0] bcd);
always@(*)
begin
case (bcd)
4'b0011 : begin segment = 7'b1011011; end
4'b1000 : begin segment = 7'b1111011; end
4'b1010 : begin segment = 7'b0000000; end
4'b0000 : begin segment = 7'b1111110; end
endcase
end
endmodule
bcd segment expectedOutput
0000 1111110 1111110
0001 1111110 0110000
0010 1111110 1101101
0011 1011011 1111001
0100 1011011 0110011
0101 1011011 1011011
0110 1011011 1011111
0111 1011011 1110000
1000 1111011 1111111
1001 1111011 1111011
1010 0000000 0000000
1011 0000000 0000000
1100 0000000 0000000
1101 0000000 0000000
1110 0000000 0000000
1111 0000000 0000000