-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmux21.vhd
107 lines (73 loc) · 1.62 KB
/
mux21.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
library IEEE;
use IEEE.std_logic_1164.all; -- libreria IEEE con definizione tipi standard logic
--use WORK.constants.all; -- libreria WORK user-defined
entity MUX21 is
Port ( A: In std_logic;
B: In std_logic;
S: In std_logic;
Y: Out std_logic);
end MUX21;
architecture BEHAVIORAL_1 of MUX21 is
begin
Y <= (A and S) or (B and not(S)); -- processo implicito
end BEHAVIORAL_1;
architecture BEHAVIORAL_2 of MUX21 is
begin
Y <= A when S='1' else B;
end BEHAVIORAL_2;
architecture BEHAVIORAL_3 of MUX21 is
begin
pmux: process(A,B,S)
begin
if S='1' then
Y <= A;
else
Y <= B;
end if;
end process;
end BEHAVIORAL_3;
architecture STRUCTURAL of MUX21 is
signal Y1: std_logic;
signal Y2: std_logic;
signal SB: std_logic;
component ND2
Port ( A: In std_logic;
B: In std_logic;
Y: Out std_logic);
end component;
component IV
Port ( A: In std_logic;
Y: Out std_logic);
end component;
begin
UIV : IV
Port Map ( S, SB);
UND1 : ND2
Port Map ( A, S, Y1);
UND2 : ND2
Port Map ( B, SB, Y2);
UND3 : ND2
Port Map ( Y1, Y2, Y);
end STRUCTURAL;
configuration CFG_MUX21_BEHAVIORAL_1 of MUX21 is
for BEHAVIORAL_1
end for;
end CFG_MUX21_BEHAVIORAL_1;
configuration CFG_MUX21_BEHAVIORAL_2 of MUX21 is
for BEHAVIORAL_2
end for;
end CFG_MUX21_BEHAVIORAL_2;
configuration CFG_MUX21_BEHAVIORAL_3 of MUX21 is
for BEHAVIORAL_3
end for;
end CFG_MUX21_BEHAVIORAL_3;
configuration CFG_MUX21_STRUCTURAL of MUX21 is
for STRUCTURAL
for all : IV
use configuration WORK.CFG_IV_BEHAVIORAL;
end for;
for all : ND2
use configuration WORK.CFG_ND2_ARCH2;
end for;
end for;
end CFG_MUX21_STRUCTURAL;