Skip to content

Instantly share code, notes, and snippets.

@Trunkol
Created August 31, 2018 14:43
Show Gist options
  • Select an option

  • Save Trunkol/d08c39fd2d6aad5fdb69321a5533f759 to your computer and use it in GitHub Desktop.

Select an option

Save Trunkol/d08c39fd2d6aad5fdb69321a5533f759 to your computer and use it in GitHub Desktop.
LIBRARY IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.STD_LOGIC_ARITH.ALL;
USE IEEE.STD_LOGIC_UNSIGNED.ALL;
ENTITY demultiplexador IS
PORT (
x : IN std_logic;
s : IN std_logic_vector(3 DOWNTO 0);
y : OUT std_logic_vector(15 DOWNTO 0)
);
END demultiplexador;
ARCHITECTURE demux OF demultiplexador IS
BEGIN
PROCESS (x, s)
BEGIN
CASE s IS
WHEN "0000" =>
y(0) <= x;
WHEN "0001" =>
y(1) <= x;
WHEN "0010" =>
y(2) <= x;
WHEN "0011" =>
y(3) <= x;
WHEN "0100" =>
y(4) <= x;
WHEN "0101" =>
y(5) <= x;
WHEN "0110" =>
y(6) <= x;
WHEN "0111" =>
y(7) <= x;
WHEN "1000" =>
y(8) <= x;
WHEN "1001" =>
y(9) <= x;
WHEN "1010" =>
y(10) <= x;
WHEN "1011" =>
y(11) <= x;
WHEN "1100" =>
y(12) <= x;
WHEN "1101" =>
y(13) <= x;
WHEN "1110" =>
y(14) <= x;
WHEN OTHERS =>
y(15) <= x;
END CASE;
END PROCESS;
END demux;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment