8:3 Priority Encoder In VHDL Language
A priority encoder is a circuit or algorithm that compresses multiple binary inputs into a smaller number of outputs. The output of a priority encoder is the binary representation of the original number starting from zero of the most significant input bit. They are often used to control interrupt requests by acting on the highest priority request.In this i have use the if condtion and also elsif condition to write the code and then simulated in ISIM Simulater.
CODE:-
----------------------------------------------------------------------------------
-- Company: vhdltutorials.blogspot.in
-- Engineer: manohar mohanta
--
-- Create Date: 12:53:20 02/06/2015
-- Design Name:
-- Module Name: priority_encoder_8:3- Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity priority_encoder_8_3 is
Port ( datain : in STD_LOGIC_VECTOR (7 downto 0);
dataout : out STD_LOGIC_VECTOR (2 downto 0));
end priority_encoder_8_3;
architecture Behavioral of priority_encoder_8_3 is
--if you have any doughts visit the vhdltutorials.blogspot.in or watch my videos on youtube.
begin
process(datain)
begin
if(datain(7)='1') then
dataout<="111";
elsif(datain(6)='1') then
dataout<="110";
elsif(datain(5)='1') then
dataout<="101";
elsif(datain(4)='1') then
dataout<="100";
elsif(datain(3)='1') then
dataout<="011";
elsif(datain(2)='1') then
dataout<="010";
elsif(datain(1)='1') then
dataout<="001";
elsif(datain(0)='1') then
dataout<="000";
end if;
end process;
end Behavioral;
Simulated Result:-
A priority encoder is a circuit or algorithm that compresses multiple binary inputs into a smaller number of outputs. The output of a priority encoder is the binary representation of the original number starting from zero of the most significant input bit. They are often used to control interrupt requests by acting on the highest priority request.In this i have use the if condtion and also elsif condition to write the code and then simulated in ISIM Simulater.
CODE:-
----------------------------------------------------------------------------------
-- Company: vhdltutorials.blogspot.in
-- Engineer: manohar mohanta
--
-- Create Date: 12:53:20 02/06/2015
-- Design Name:
-- Module Name: priority_encoder_8:3- Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity priority_encoder_8_3 is
Port ( datain : in STD_LOGIC_VECTOR (7 downto 0);
dataout : out STD_LOGIC_VECTOR (2 downto 0));
end priority_encoder_8_3;
architecture Behavioral of priority_encoder_8_3 is
--if you have any doughts visit the vhdltutorials.blogspot.in or watch my videos on youtube.
begin
process(datain)
begin
if(datain(7)='1') then
dataout<="111";
elsif(datain(6)='1') then
dataout<="110";
elsif(datain(5)='1') then
dataout<="101";
elsif(datain(4)='1') then
dataout<="100";
elsif(datain(3)='1') then
dataout<="011";
elsif(datain(2)='1') then
dataout<="010";
elsif(datain(1)='1') then
dataout<="001";
elsif(datain(0)='1') then
dataout<="000";
end if;
end process;
end Behavioral;
Simulated Result:-
8:3 priority Encoder Simulated result |
No comments:
Post a Comment