----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity encode1 is
port(
enc_in : in std_logic_vector (3 downto 0);
enc_out : out std_logic_vector(1 downto 0)
);
end encode1;
architecture Behavioral of encode1 is
begin
enc_out <= "11" when enc_in(3) = '1' else
"10" when enc_in(2) = '1' else
"01" when enc_in(1) = '1' else
"00";
end Behavioral;
----------------------------------------------------------------------------------
Simulation
Shown below is my simulation result. As can be seen, when all bits of my input has a value of '1', since my MSB of the input has the highest priority, the first line of code in the architecture body was executed.
References:
(1) Pedroni, V., Circuit Design with VHDL, The MIT Press, 2004.
(2) Xilinx Priority Encoder Toolbox
2 comments:
I’m very glad to found this website because; it carries awesome and actually good data in favor of readers.
clover
www.n8fan.net
Thanks for sharing your thoughts. I truly appreciate your efforts and I am waiting for your next write ups thanks once again.
Chan
www.imarksweb.org
Post a Comment