HOME VHDL CODES C PROGRAMS SOCCER BUZzz TECH INFO

Showing posts with label 111 to 444 counter. Show all posts
Showing posts with label 111 to 444 counter. Show all posts


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..!

--vhdl code for 111 to 444 counter..


library ieee;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_arith.all;
entity counter111to444 is
port(clk:in std_logic;
count1:out integer);
end counter111to444;

architecture Behavioral of counter111to444 is
begin
process(clk)

variable a:integer:=1;
variable b:integer:=1;
variable c:integer:=1;
begin
if(clk' event and clk='1') then
a:=a+1;
if(a=10) then
b:=b+1;
a:=0;
if(b=10) then
c:=c+1;
b:=0;
end if;
end if;
if(c=4 and b=4 and a=5) then
a:=1;
b:=1;
c:=1;
end if; 
end if;
count1<= (c*100)+(b*10)+a;
end process;
end Behavioral;

the above code has been verified..! :) 

Total Pageviews

About this blog

Contributors

Followers

Powered by Blogger.

Labels