-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmux.vhd
34 lines (32 loc) · 823 Bytes
/
mux.vhd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.numeric_std.all;
entity mux is
port(sel:in STD_LOGIC_VECTOR(1 downto 0);
enable: in STD_LOGIC;
w0:in STD_LOGIC_VECTOR(31 downto 0);
w1:in STD_LOGIC_VECTOR(31 downto 0);
w2:in STD_LOGIC_VECTOR(31 downto 0);
w3:in STD_LOGIC_VECTOR(31 downto 0);
output: out STD_LOGIC_VECTOR(31 downto 0)
);
end mux;
architecture behavioral of mux is
begin
process(enable,sel)
begin
if (enable ='1') then
if (sel="00") then
output <= w0;
elsif (sel="01") then
output <= w1;
elsif (sel="10") then
output <= w2;
elsif (sel="11") then
output <= w3;
end if;
else
output <= "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
end if;
end process;
end behavioral;