I am doing some investigation on what kind of code does/does not generate latches on different synthesizers. The code below drives a 7-segment display from a 4-bit input. I would expect it not to generate latches, because all possible cases are covered in the conditional signal assignment.
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity seven_seg_conditional is
port (
value: in std_logic_vector(3 downto 0);
digit: out std_logic_vector(6 downto 0)
);
end;
architecture behavior of seven_seg_conditional is
signal value_int: integer range 0 to 15;
begin
value_int <= to_integer(unsigned(value));
digit <=
"0111111" when value_int = 0 else
"0000110" when value_int = 1 else
"1011011" when value_int = 2 else
"1001111" when value_int = 3 else
"1100110" when value_int = 4 else
"1101101" when value_int = 5 else
"1111101" when value_int = 6 else
"0000111" when value_int = 7 else
"1111111" when value_int = 8 else
"1101111" when value_int = 9 else
"1110111" when value_int = 10 else
"1111100" when value_int = 11 else
"0111001" when value_int = 12 else
"1011110" when value_int = 13 else
"1111001" when value_int = 14 else
"1110001" when value_int = 15;
end;
If I run it through Quartus 13.0, a latch is generated on each output. Is this correct behavior for a synthesizer as per the ongoing standards?
Note: if I rewrite the code using a case statement then there are no latches, even though I never added a when others
clause. If I add an unconditional else clause at the end there are no latches as well.