111 to 444 counter using binary incrementation method
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity counter is
port(clk: in std_logic;
c1,c2,c3:out std_logic_vector(3 downto 0));
end counter;
architecture arch of counter is
begin
process(clk)
variable t1:std_logic_vector(3 downto 0) :="0001";
variable t2:std_logic_vector(3 downto 0) :="0001";
variable t3:std_logic_vector(3 downto 0) :="0001";
begin
if(clk' event and ck='1')then
t1:=t1+'1';
if(t1="1010")then
t2:=t2+'1';
t1:="0000";
if(t2="1010")then
t3:=t3+'1';
t2:="0000";
end if;
end if;
if(t3="0100" and t2="0100" and t1="0101")then
t1:="0001";
t2:="0001";
t3:="0001";
end if;
end if;
c1<=t1;
c2<=t2;
c3<=t3;
end process;
end arch;
Above code is verified.
Plz do comment! :)
thank you..!