-
Notifications
You must be signed in to change notification settings - Fork 0
/
mux_8x1_16.vhd
executable file
·33 lines (30 loc) · 1.09 KB
/
mux_8x1_16.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
LIBRARY IEEE;
USE IEEE.std_logic_1164.all;
ENTITY mux_8x1_16 IS
PORT( sel : IN std_logic_vector(2 downto 0);
x0,x1,x2,x3,x4,x5,x6,x7 : IN std_logic_vector(15 downto 0);
q : OUT std_logic_vector(15 downto 0));
END mux_8x1_16;
ARCHITECTURE a_mux_8x1_16 OF mux_8x1_16 IS
BEGIN
PROCESS(x0,x1,x2,x3,x4,x5,x6,x7,sel)
BEGIN
IF sel(2) = '0' AND sel(1) = '0' AND sel(0) = '0' THEN
q <= x0;
ELSIF sel(2) = '0' AND sel(1) = '0' AND sel(0) = '1' THEN
q <= x1;
ELSIF sel(2) = '0' AND sel(1) = '1' AND sel(0) = '0' THEN
q <= x2;
ELSIF sel(2) = '0' AND sel(1) = '1' AND sel(0) = '1' THEN
q <= x3;
ELSIF sel(2) = '1' AND sel(1) = '0' AND sel(0) = '0' THEN
q <= x4;
ELSIF sel(2) = '1' AND sel(1) = '0' AND sel(0) = '1' THEN
q <= x5;
ELSIF sel(2) = '1' AND sel(1) = '1' AND sel(0) = '0' THEN
q <= x6;
ELSIF sel(2) = '1' AND sel(1) = '1' AND sel(0) = '1' THEN
q <= x7;
END IF;
END PROCESS;
END a_mux_8x1_16;