HOME VHDL CODES C PROGRAMS SOCCER BUZzz TECH INFO


--vhdl code for counting number of one's using structural style:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
entity noof1 is
port(a:in std_logic_vector(4 downto 0);
count:out integer);
end noof1;

architecture structural of noof1 is
signal b,c,d,x:integer;
begin
with a(0) select
count<=x+1 when '1',
       x when others;
with a(1) select
  x<=b+1 when '1',
      b when others;
with a(2) select  
b<= c+1 when '1',
   c when others;
with a(3) select  
   c<= d+1 when '1',
    d when others;
with a(4) select
d<= 1 when '1',
    0 when others;
end structural;

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