Tuesday, September 11, 2018

74x151 multiplexer using if statement



74x151 Behavioral model using if – else statement

library IEEE;
use IEEE.std_logic_1164.all;

entity mux74x151 is
                port(EN_L:   in   std_logic;
                          S:   in   std_logic_vector(2 downto 0);
                          D:   in   std_logic_vector(7 downto 0);
                          Y, Y_L:   out   std_logic);
end mux74x151;

architecture arch6 of mux74x151 is
begin

     process (EN_L, S, D)
     begin     

if EN_L = '0' then

    if      S = "000" then           Y <= D(0);      Y_L <= not D(0);
    elsif  S = "001"  then          Y <= D(1);      Y_L <= not D(1);
    elsif  S = "010"  then          Y <= D(2);      Y_L <= not D(2);
    elsif  S = "011"   then         Y <= D(3);      Y_L <= not D(3);
    elsif  S = "100"  then          Y <= D(4);      Y_L <= not D(4);
    elsif  S = "101"   then         Y <= D(5);      Y_L <= not D(5);
    elsif  S = "110"   then         Y <= D(6);      Y_L <= not D(6);
    elsif  S = "111"    then         Y <= D(7);      Y_L <= not D(7);
    else                                                 Y <= 'z';          Y_L <= 'z';
    end if;

else                                         Y <= 'z';          Y_L <= 'z';
end if;

     end process;

end arch6;

No comments:

Post a Comment