5.
You want to design a 8-to-3 priority encoder in VHDL that outputs the binary position of the highest priority input bit set to '1'. Which approach correctly implements this behavior?
process(inputs)
begin
output <= "000";
if inputs(7) = '1' then
output <= "111";
elsif inputs(6) = '1' then
output <= "110";
elsif inputs(5) = '1' then
output <= "101";
elsif inputs(4) = '1' then
output <= "100";
elsif inputs(3) = '1' then
output <= "011";
elsif inputs(2) = '1' then
output <= "010";
elsif inputs(1) = '1' then
output <= "001";
elsif inputs(0) = '1' then
output <= "000";
end if;
end process;