Altera_Forum
Honored Contributor
18 years agoCounter between a data range(VHDL)
Hi, everyone.
This is the Counter I design, lines below: library ieee; use ieee.std_logic_1164.all; use ieee.std_logic_unsigned.all; entity load_counter is port( clk:in std_logic; en:in std_logic; data_out: out std_logic_vector(11 downto 0)); end entity; architecture one of load_counter is begin process(clk,en) variable temp:std_logic_vector(11 downto 0):="101100110110"; constant a1:std_logic_vector(11 downto 0):="010011001110"; begin if en='1' then if clk'event and clk='1' then temp:=temp-1; elsif temp=a1 then temp:="010011001110"; end if; end if; data_out<=temp; end process; end one; The error messages are: Error (10818): Can't infer register for "temp[0]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[1]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[2]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[3]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[4]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[5]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[6]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[7]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[8]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[9]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[10]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10818): Can't infer register for "temp[11]" at load_counter.vhd(18) because it does not hold its value outside the clock edge Error (10822): HDL error at load_counter.vhd(18): couldn't implement registers for assignments on this clock edge I mean to make it count between "010011001110" and "101100110110", but it doesn't work as I plan to. I will appreciate it if anyone can give some help. Thanks.