You are on page 1of 1

architecture Behavioral of encoder is

begin
process (x,e)
begin
if(e='1') then
if (x(7)='1') then
y<="111";
elsif (x(6)='1')then
y<="110";
elsif (x(5)='1')then
y<="101";
elsif (x(4)='1')then
y<="100";
elsif (x(3)='1')then
y<="011";
elsif (x(2)='1')then
y<="010";
elsif (x(1)='1')then
y<="001";
elsif (x(0)='1')then
y<="000";
else
y<="XXX";
end if;
else
y<="XXX";
end if;
end process;
end Behavioral;

You might also like