I have a latch involving my signal d_reg
in this code. I'm new to VHDL and I can't seem to find the reason for this latch. I've already assigned d_reg a value for every case of in_data. Could anyone explain why I have a latch, and how to prevent this in the future?
The warning I receive is:
WARNING:Xst:1710 - FF/Latch
<d_reg_0>
(without init value) has a constant value of 0 in block<delay_incrementor>
. This FF/Latch will be trimmed during the optimization process.
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;
entity delay_incrementor is
Port ( clk,reset: in STD_LOGIC;
in_data : in STD_LOGIC_VECTOR (7 downto 0);
out_data : out STD_LOGIC_VECTOR (7 downto 0);
d : out STD_LOGIC_VECTOR (25 downto 0));
end delay_incrementor;
architecture Behavioral of delay_incrementor is
signal d_reg,d_next: std_logic_vector (25 downto 0);
begin
--Register
process(clk,reset)
begin
if reset='1' then
d_reg <= (others => '0');
elsif (clk='1' and clk'event) then
d_reg <= d_next;
end if;
end process;
--Next-State Logic
d_next <= std_logic_vector(unsigned(d_reg) + "1001100010010110100000000") when in_data = "01010101" else
std_logic_vector(unsigned(d_reg) + "1001100010010110100000000") when in_data = "01000100" else
d_reg;
out_data <= "00010111" when in_data /= "00000000" else
(others=>'0');
--Output Logic
d <= d_reg;
end Behavioral;
XST Warning 1710 is just a common warning for all memory elements (latches, flip flops, ...).
The warning notes that your FF has a constant value, so a possible d
input or ce
clock enable is not used or change or also trimmed :).
A latch found warning is XST Warning 737:
WARNING:Xst:737 - Found n-bit latch for signal .