-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTH_MUX.vhd
More file actions
60 lines (43 loc) · 1.62 KB
/
TH_MUX.vhd
File metadata and controls
60 lines (43 loc) · 1.62 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
-- Multiplexer.vhd
--------------------------------------------------------------------------
--------------------------------------------------------------------------
--------------------------------------------------------------------------
library IEEE,WORK;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use WORK.ALL;
entity MULTIPLEXER is
generic(N:integer:=8);
port( mM1,mM0: in std_logic_vector(N-1 downto 0);
mN1,mN0: in std_logic;
X1,X0: out std_logic_vector(N-1 downto 0));
end;
architecture STRUCT of MULTIPLEXER is
-- declarative area
component TH22
port(A,B: in std_logic;
Z: out std_logic);
end component;
component TH12
port(A,B: in std_logic;
Z: out std_logic);
end component;
begin
-- threshold gate instances that make the full adder
G1:TH22 port map(A=>mN1,B=>mM1(0),Z=>X1(0));
G2:TH12 port map(A=>mN0,B=>mM0(0),Z=>X0(0));
G3:TH22 port map(A=>mN1,B=>mM1(1),Z=>X1(1));
G4:TH12 port map(A=>mN0,B=>mM0(1),Z=>X0(1));
G5:TH22 port map(A=>mN1,B=>mM1(2),Z=>X1(2));
G6:TH12 port map(A=>mN0,B=>mM0(2),Z=>X0(2));
G7:TH22 port map(A=>mN1,B=>mM1(3),Z=>X1(3));
G8:TH12 port map(A=>mN0,B=>mM0(3),Z=>X0(3));
G9:TH22 port map(A=>mN1,B=>mM1(4),Z=>X1(4));
G10:TH12 port map(A=>mN0,B=>mM0(4),Z=>X0(4));
G11:TH22 port map(A=>mN1,B=>mM1(5),Z=>X1(5));
G12:TH12 port map(A=>mN0,B=>mM0(5),Z=>X0(5));
G13:TH22 port map(A=>mN1,B=>mM1(6),Z=>X1(6));
G14:TH12 port map(A=>mN0,B=>mM0(6),Z=>X0(6));
G15:TH22 port map(A=>mN1,B=>mM1(7),Z=>X1(7));
G16:TH12 port map(A=>mN0,B=>mM0(7),Z=>X0(7));
end;