HOME VHDL CODES C PROGRAMS SOCCER BUZzz TECH INFO

--vhdl code to count number of 1's using behavioral:


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity one_counter is
port(a:in std_logic_vector(9 downto 0);
count:out integer);
end one_counter; 
architecture Behavioral of one_counter is
begin

process(a)
variable c: integer;
begin
c:=0;
a1:for i in 0 to 9 loop
if(a(i)='1')then
c:=c+1;
end if; 
end loop a1;
count<=c;
end process;
end Behavioral;

The above code has been executed and has been found to have no errors..!  plz do comment..!
thank u..!! :) :)
  

0 comments:

Post a Comment

Total Pageviews

About this blog

Contributors

Followers

Powered by Blogger.

Labels