Posted by Saradwata Bandyopadhyay on 01-03-2025
Here is the solution for the above question =>
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity behav_encoder_8_3 is
port(
din : in STD_LOGIC_VECTOR(7 downto 0);
dout : out STD_LOGIC_VECTOR(2 downto 0));
end behav_encoder_8_3;
architecture Behavioral of behav_encoder_8_3 is
begin
process(din)
begin
if (din="10000000")then
dout <= "000";
elsif(din="01000000")then
dout <= "001";
elsif(din="00100000")then
dout <= "010";
elsif(din="00010000")then
dout <= "011";
elsif(din="00001000")then
dout <= "100";
elsif(din="00000100")then
dout <= "101";
elsif(din="00000010")then
dout <= "110";
else dout <= "111";
end if;
end process;
end Behavioral;
You can directly download the Source Code and the Model Sim application from the
links below =>
Login to Comment.