-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMultiplier_4.vhd
182 lines (154 loc) · 3.61 KB
/
Multiplier_4.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 02/27/2024 03:33:04 PM
-- Design Name:
-- Module Name: Multiplier_4 - Behavioral
-- Project Name:
-- Target Devices:
-- Tool Versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
--use IEEE.NUMERIC_STD.ALL;
-- Uncomment the following library declaration if instantiating
-- any Xilinx leaf cells in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity Multiplier_4 is
Port ( A : in STD_LOGIC_VECTOR (3 downto 0);
B : in STD_LOGIC_VECTOR (3 downto 0);
Y : out STD_LOGIC_VECTOR (7 downto 0));
end Multiplier_4;
architecture Behavioral of Multiplier_4 is
component FA is
Port ( A : in STD_LOGIC;
B : in STD_LOGIC;
C_in : in STD_LOGIC;
S : out STD_LOGIC;
C_out : out STD_LOGIC);
end component;
SIGNAL b0a0, b0a1, b0a2, b0a3, b1a0, b1a1, b1a2, b1a3, b2a0, b2a1, b2a2, b2a3, b3a0, b3a1, b3a2, b3a3 : STD_LOGIC;
SIGNAL c_0_0, c_0_1, c_0_2, c_1_0, c_1_1, c_1_2, c_2_0, c_2_1, c_2_2, c_3_0, c_3_1, c_3_2: STD_LOGIC;
SIGNAL s_0_0, s_0_1, s_0_2, s_1_0, s_1_1, s_1_2, s_2_0, s_2_1, s_2_2, s_3_0, s_3_1, s_3_2: STD_LOGIC;
begin
FA_0_0 : FA
PORT MAP(
A => b1a0,
B => b0a1,
C_in => '0',
s => s_0_0,
c_out => c_0_0);
FA_0_1 : FA
PORT MAP(
A => b1a1,
B => b0a2,
C_in => '0',
s => s_0_1,
c_out => c_0_1);
FA_0_2 : FA
PORT MAP(
A => b1a2,
B => b0a3,
C_in => '0',
s => s_0_2,
c_out => c_0_2);
FA_1_0 : FA
PORT MAP(
A => b2a0,
B => s_0_1,
C_in => c_0_0,
s => s_1_0,
c_out => c_1_0);
FA_1_1 : FA
PORT MAP(
A => b2a1,
B => s_0_2,
C_in => c_0_2,
s => s_1_1,
c_out => c_1_1);
FA_1_2 : FA
PORT MAP(
A => b2a2,
B => b1a3,
C_in => c_0_2,
s => s_1_2,
c_out => c_1_2);
FA_2_0 : FA
PORT MAP(
A => b3a0,
B => s_1_1,
C_in => c_1_0,
s => s_2_0,
c_out => c_2_0);
FA_2_1 : FA
PORT MAP(
A => b3a1,
B => s_1_2,
C_in => c_1_1,
s => s_2_1,
c_out => c_2_1);
FA_2_2 : FA
PORT MAP(
A => b3a2,
B => b2a3,
C_in => c_1_2,
s => s_2_2,
c_out => c_2_2);
FA_3_0 : FA
PORT MAP(
A => s_2_1,
B => '0',
C_in => c_2_0,
s => s_3_0,
c_out => c_3_0);
FA_3_1 : FA
PORT MAP(
A => c_2_1,
B => s_2_2,
C_in => c_3_0,
s => s_3_1,
c_out => c_3_1);
FA_3_2 : FA
PORT MAP(
A => b3a3,
B => c_2_2,
C_in => c_3_1,
s => s_3_2,
c_out => c_3_2);
b0a0 <= A(0) AND B(0);
b0a1 <= A(1) AND B(0);
b0a2 <= A(2) AND B(0);
b0a3 <= A(3) AND B(0);
b1a0 <= A(0) AND B(1);
b1a1 <= A(1) AND B(1);
b1a2 <= A(2) AND B(1);
b1a3 <= A(3) AND B(1);
b2a0 <= A(0) AND B(2);
b2a1 <= A(1) AND B(2);
b2a2 <= A(2) AND B(2);
b2a3 <= A(3) AND B(2);
b3a0 <= A(0) AND B(3);
b3a1 <= A(1) AND B(3);
b3a2 <= A(2) AND B(3);
b3a3 <= A(3) AND B(3);
Y(0) <= b0a0;
Y(1) <= s_0_0;
Y(2) <= s_1_0;
Y(3) <= s_2_0;
Y(4) <= s_3_0;
Y(5) <= s_3_1;
Y(6) <= s_3_2;
y(7) <= c_3_2;
end Behavioral;