74x148
Behavioral model using if – else statement
library IEEE;
use
IEEE.std_logic_1164.all;
entity enc74x148 is
port
(EI_L: in STD_LOGIC;
I_L:
in STD_LOGIC_VECTOR (7 downto 0);
A_L: out STD_LOGIC_VECTOR (2 downto 0);
EO_L, GS_L: out STD_LOGIC);
end enc74x148;
architecture arch1 of enc74x148
is
begin
process (EI_L, I_L)
begin
EO_L <= '1';
GS_L <= '0';
if
I_L(7) = '0' then A_L <=
"000";
elsif
I_L(6) = '0' then A_L <= "001";
elsif
I_L(5) = '0' then A_L <= "010";
elsif
I_L(4) = '0' then A_L <= "011";
elsif
I_L(3) = '0' then A_L <= "100";
elsif
I_L(2) = '0' then A_L <= "101";
elsif
I_L(1) = '0' then A_L <= "110";
elsif
I_L(0) = '0' then A_L <= "111";
else
A_L <= "111";
EO_L <= '0';
GS_L <= '1';
end
if;
end process;
end arch1;
No comments:
Post a Comment