forked from MahmoudSamy1452/6StageProcessor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mux8.vhd
40 lines (33 loc) · 958 Bytes
/
mux8.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
35
36
37
38
39
40
library ieee;
use ieee.std_logic_1164.all;
entity mux8 is
GENERIC (n: integer:= 10);
port(
in1,in2,in3,in4,in5,in6,in7,in8: in std_logic_vector(n - 1 downto 0);
out1 : out std_logic_vector(n - 1 downto 0);
sel : in std_logic_vector(2 downto 0)
);
end mux8;
architecture arch3 of mux8 is
component mux2 is
GENERIC (n: integer:= 10);
port(
in1,in2: in std_logic_vector(n - 1 downto 0);
out1 : out std_logic_vector(n - 1 downto 0);
sel : in std_logic
);
end component;
component mux4 is
GENERIC (n: integer:= 10);
port(
in1,in2,in3,in4: in std_logic_vector(n - 1 downto 0);
out1 : out std_logic_vector(n - 1 downto 0);
sel : in std_logic_vector(1 downto 0)
);
end component;
signal x1,x2:std_logic_vector(n - 1 downto 0);
begin
m1 : mux4 GENERIC MAP(n) port map(in1,in2,in3,in4,x1,sel(1 downto 0));
m2 : mux4 GENERIC MAP(n) port map(in5,in6,in7,in8,x2,sel(1 downto 0));
m3 : mux2 GENERIC MAP(n) port map(x1,x2,out1,sel(2));
end arch3;