epfl-archive/cs208-ca/vhdl/multiplexer.vhd
2022-04-07 18:43:21 +02:00

23 lines
569 B
VHDL
Executable File

library ieee;
use ieee.std_logic_1164.all;
entity multiplexer is
port(
i0 : in std_logic_vector(31 downto 0);
i1 : in std_logic_vector(31 downto 0);
i2 : in std_logic_vector(31 downto 0);
i3 : in std_logic_vector(31 downto 0);
sel : in std_logic_vector(1 downto 0);
o : out std_logic_vector(31 downto 0)
);
end multiplexer;
architecture synth of multiplexer is
begin
o <= i0 when sel = "00" else
i1 when sel = "01" else
i2 when sel = "10" else
i3 when sel = "11" else
i0;
end synth;