L
laserbeak43
Guest
Hi there, Having another problem with latches. I've referred to our
last conversation about them a few months ago, but couldn't come to
any conclusions about what i'm doing wrong in my project.
Could someone please help? I get a warning that says:
***************************************************************************
Warning (10631): VHDL Process Statement warning at part4.vhd(26):
inferring latch(es) for signal or variable "s_out", which holds its
previous value in one or more paths through the process
***************************************************************************
My code goes:
------------------------------------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
entity part4 is
port(
SW : in unsigned(2 downto 0);
KEY : in unsigned(0 downto 0);
HEX0 : out unsigned(6 downto 0)
);
end part4;
architecture behavioral of part4 is
signal s_sw : unsigned(2 downto 0);
signal s_key: std_logic;
signal s_out: unsigned(3 downto 0);
begin
s_sw <= SW;
s_key <= KEY(0);
hx : work.HEX port map (s_out, HEX0);
process(s_sw, s_out, s_key) begin
s_out <= (others => '0');
-- s_key <= (others => '0');
-- s_sw <= (others => '0');
if(s_sw(0) = '1') then
s_out <= "0000";
elsif(s_key = '0') then
case s_sw(2 downto 1) is
when "00" => s_out <= s_out;
when "01" => s_out <= s_out + 1;
when "10" => s_out <= s_out + 2;
when "11" => s_out <= s_out + 1;
end case;
end if;
end process;
end behavioral;
-----------------------------------------------------------------------------------------------------------------------
Thanks,
Malik
last conversation about them a few months ago, but couldn't come to
any conclusions about what i'm doing wrong in my project.
Could someone please help? I get a warning that says:
***************************************************************************
Warning (10631): VHDL Process Statement warning at part4.vhd(26):
inferring latch(es) for signal or variable "s_out", which holds its
previous value in one or more paths through the process
***************************************************************************
My code goes:
------------------------------------------------------------------------------------------------------------
LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
entity part4 is
port(
SW : in unsigned(2 downto 0);
KEY : in unsigned(0 downto 0);
HEX0 : out unsigned(6 downto 0)
);
end part4;
architecture behavioral of part4 is
signal s_sw : unsigned(2 downto 0);
signal s_key: std_logic;
signal s_out: unsigned(3 downto 0);
begin
s_sw <= SW;
s_key <= KEY(0);
hx : work.HEX port map (s_out, HEX0);
process(s_sw, s_out, s_key) begin
s_out <= (others => '0');
-- s_key <= (others => '0');
-- s_sw <= (others => '0');
if(s_sw(0) = '1') then
s_out <= "0000";
elsif(s_key = '0') then
case s_sw(2 downto 1) is
when "00" => s_out <= s_out;
when "01" => s_out <= s_out + 1;
when "10" => s_out <= s_out + 2;
when "11" => s_out <= s_out + 1;
end case;
end if;
end process;
end behavioral;
-----------------------------------------------------------------------------------------------------------------------
Thanks,
Malik