Forum Discussion
Altera_Forum
Honored Contributor
11 years agoHelp with reseting counet
Hey, I've written a simple counter code When the cnt = 5 the signal std_logic_vector Inc +'1' Now I want you end this process when It's equal to "1111"; Everytime I try to end this I ...
Altera_Forum
Honored Contributor
11 years agoEntity VCO is
Port(sw:in std_logic; Clk:in std_logic; Bit_4: out std_logic_vectot(3 downto 0)); End entity; Architecture behave of VCO is Signal cnt: integer range 0 to 50000000:=0; Signal f_out: std_logic_vector(3 downto 0):=x"0"; Begin Process (clk) Begin If sw = '1' then If clk 'event and clk=' 1' then Cnt<=cnt+1; If cnt=5 then F_Out<=f_out+'1'; Cnt<=0; Elsif cnt=5 then If f_out="1111" then F_out<="1111" Cnt<=0; End if; End if; End if; Elsif ='0' then Cnt<=0; F_out<="ZZZZ"; End if; End process; Bit_4<=f_out; End;