LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
entity priority is
port(I : in bit_vector(4 downto 0);
A : out bit_vector(2 downto 0));
end priority;
architecture v1 of priority is
begin
process(I)
begin
if I(4) = '1' then--最高优先级
A <= "000";
elsif I(3) = '1' then--次优先级
A <= "001";
elsif I(2) = '1' then--
A <= "010";
elsif I(1) = '1' then
A <= "011";
elsif I(0) = '1' then
A <= "100";
else A<="111"
end if;
end process;
end v1;