Advertisement
Doda94

dexmux24

Dec 4th, 2023
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 0.88 KB | None | 0 0
  1. library IEEE;
  2. use IEEE.STD_LOGIC_1164.ALL;
  3.  
  4. -- warning: this file will not be saved if:
  5. --     * following entity block contains any syntactic errors (e.g. port list isn't separated with ; character)
  6. --     * following entity name and current file name differ (e.g. if file is named mux41 then entity must also be named mux41 and vice versa)
  7. ENTITY demux24 IS port(
  8. g, c, b, a : in std_logic;
  9. y : out std_logic_vector(0 to 3)
  10. );
  11. END demux24;
  12.  
  13. ARCHITECTURE arch OF demux24 IS
  14.  
  15. BEGIN
  16.     process(a, b, c, g) is
  17.             variable i: std_logic_vector(0 to 1);
  18.         begin
  19.             y <= "1111";
  20.             i := (b, a);
  21.  
  22.             if(g = '0') then
  23.                 case i is
  24.                     when "00" =>
  25.                         y(0) <= not c;
  26.                     when "01" =>
  27.                         y(1) <= not c;
  28.                     when "10" =>
  29.                         y(2) <= not c;
  30.                     when "11" =>
  31.                         y(3) <= not c;
  32.                     when others =>
  33.                         y(0) <= c;
  34.                 end case;
  35.             end if;
  36.         end process;
  37. END arch;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement