HOME VHDL CODES C PROGRAMS SOCCER BUZzz TECH INFO

Showing posts with label priority encoder. Show all posts
Showing posts with label priority encoder. Show all posts


--code for priority encoder using dataflow method:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity priority_encoder is
port( a:in std_logic_vector(7 downto 1);
y:out std_logic_vector(2 downto 0));
end priority_encoder;

architecture Behavioral of priority_encoder is
begin
y(2)<= a(7) or a(6) or a(5)or a(4);
y(1)<= a(7) or a(6) or ((not  a(5)) and (not  a(4)) and (a(3) or  a(2)));
y(0)<= a(7) or ((not a(6)) and (a(5) or ((not a(4)) and (a(3) or ((not a(2)) and a(1))))));
end Behavioral;

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


--code for priority encoder:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

entity priority_encoder_when is
port( a:in std_logic_vector(7 downto 1);
y:out std_logic_vector(2 downto 0));
end priority_encoder_when;

architecture Behavioral of priority_encoder_when is
begin
y<="111" when a(7)='1' else
   "110" when a(6)='1' else
"101" when a(5)='1' else
"100" when a(4)='1' else
"011" when a(3)='1' else
"010" when a(2)='1' else
"001" when a(1)='1' else
"000";
end Behavioral;

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

Total Pageviews

About this blog

Contributors

Followers

Powered by Blogger.

Labels