Altera_Forum
Honored Contributor
15 years agoError (10818): (does not hold its value outside the clock edge)
Hello,
I am trying to build a pulse counter that shoud be connected to an external switch and count the times the user push the button. moreover i need to output: result,result+1,result +2. i have written the next code and it works graet on model sim but quartus dosent like it, i an getting the error: Error (10818): Can't infer register for "q2_int[X]" at counter.vhd(32) because it does not hold its value outside the clock edge. for every bit, someone has an idea how to solve it? the code is: --- Quote Start --- library ieee; use ieee.std_logic_1164.all; use IEEE.std_logic_unsigned.all; entity counter is port ( load : in std_logic; q,q1,q2 : buffer std_logic_vector (4 downto 0)); end entity; architecture rtl of counter is signal q_int : std_logic_vector (4 downto 0):="00000"; signal q1_int : std_logic_vector (4 downto 0):="00000"; signal q2_int : std_logic_vector (4 downto 0):="00000"; begin process (load,q_int) begin if (q_int="00000") then q<="LLLLL"; q1_int<="LLLLH"; q2_int<="LLLHL"; else end if; if (rising_edge(load)) then q_int <= q_int + 1; q1_int<=q1_int + 1; q2_int<=q2_int + 1; end if; end process; q <= q_int; q1 <= q1_int; q2 <= q2_int; end rtl; --- Quote End --- thanks alot Pini Sberro