1 |
14 |
arif_endro |
-- $Id: mult_8bit.vhdl,v 1.3 2005-03-04 08:06:20 arif_endro Exp $
|
2 |
2 |
arif_endro |
-------------------------------------------------------------------------------
|
3 |
|
|
-- Title : Eight bit multiplier
|
4 |
|
|
-- Project : FM Receiver
|
5 |
|
|
-------------------------------------------------------------------------------
|
6 |
|
|
-- File : mult_8bit.vhdl
|
7 |
|
|
-- Author : "Arif E. Nugroho" <arif_endro@yahoo.com>
|
8 |
|
|
-- Created : 2004/12/20
|
9 |
|
|
-- Last update :
|
10 |
13 |
arif_endro |
-- Simulators :
|
11 |
2 |
arif_endro |
-- Synthesizers:
|
12 |
|
|
-- Target :
|
13 |
|
|
-------------------------------------------------------------------------------
|
14 |
|
|
-- Description : Multiplier used in phase detector
|
15 |
|
|
-------------------------------------------------------------------------------
|
16 |
13 |
arif_endro |
-- Copyright (C) 2004 Arif E. Nugroho
|
17 |
2 |
arif_endro |
-- This VHDL design file is an open design; you can redistribute it and/or
|
18 |
|
|
-- modify it and/or implement it after contacting the author
|
19 |
|
|
-------------------------------------------------------------------------------
|
20 |
13 |
arif_endro |
--------------------------------------------------------------------------------
|
21 |
|
|
--
|
22 |
|
|
-- THIS SOURCE FILE MAY BE USED AND DISTRIBUTED WITHOUT RESTRICTION
|
23 |
|
|
-- PROVIDED THAT THIS COPYRIGHT STATEMENT IS NOT REMOVED FROM THE FILE AND THAT
|
24 |
|
|
-- ANY DERIVATIVE WORK CONTAINS THE ORIGINAL COPYRIGHT NOTICE AND THE
|
25 |
|
|
-- ASSOCIATED DISCLAIMER.
|
26 |
|
|
--
|
27 |
|
|
--------------------------------------------------------------------------------
|
28 |
|
|
--
|
29 |
|
|
-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
30 |
|
|
-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
31 |
|
|
-- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
|
32 |
|
|
-- EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
33 |
|
|
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
34 |
|
|
-- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
35 |
|
|
-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
36 |
|
|
-- WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
37 |
|
|
-- OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
38 |
|
|
-- ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
39 |
|
|
--
|
40 |
|
|
--------------------------------------------------------------------------------
|
41 |
2 |
arif_endro |
|
42 |
|
|
library IEEE;
|
43 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
44 |
|
|
|
45 |
|
|
entity mult_8bit is
|
46 |
|
|
port (
|
47 |
|
|
mult_01 : in bit_vector (07 downto 0);
|
48 |
|
|
mult_02 : in bit_vector (07 downto 0);
|
49 |
|
|
result_mult : out bit_vector (15 downto 0)
|
50 |
|
|
);
|
51 |
|
|
end mult_8bit;
|
52 |
|
|
|
53 |
|
|
architecture structural of mult_8bit is
|
54 |
|
|
component adder_16bit
|
55 |
|
|
port (
|
56 |
|
|
addend_16bit : in bit_vector (15 downto 0);
|
57 |
|
|
augend_16bit : in bit_vector (15 downto 0);
|
58 |
|
|
adder16_output : out bit_vector (16 downto 0)
|
59 |
|
|
);
|
60 |
|
|
end component;
|
61 |
|
|
|
62 |
|
|
component adder_16bit_u
|
63 |
|
|
port (
|
64 |
|
|
addend_16bit : in bit_vector (15 downto 0);
|
65 |
|
|
augend_16bit : in bit_vector (15 downto 0);
|
66 |
|
|
adder16_output : out bit_vector (15 downto 0)
|
67 |
|
|
);
|
68 |
|
|
end component;
|
69 |
|
|
|
70 |
|
|
component adder_15bit
|
71 |
|
|
port (
|
72 |
|
|
addend_15bit : in bit_vector (14 downto 0);
|
73 |
|
|
augend_15bit : in bit_vector (14 downto 0);
|
74 |
|
|
adder15_output : out bit_vector (15 downto 0)
|
75 |
|
|
);
|
76 |
|
|
end component;
|
77 |
|
|
|
78 |
|
|
component adder_14bit
|
79 |
|
|
port (
|
80 |
|
|
addend_14bit : in bit_vector (13 downto 0);
|
81 |
|
|
augend_14bit : in bit_vector (13 downto 0);
|
82 |
|
|
adder14_output : out bit_vector (14 downto 0)
|
83 |
|
|
);
|
84 |
|
|
end component;
|
85 |
|
|
|
86 |
|
|
component adder_13bit
|
87 |
|
|
port (
|
88 |
|
|
addend_13bit : in bit_vector (12 downto 0);
|
89 |
|
|
augend_13bit : in bit_vector (12 downto 0);
|
90 |
|
|
adder13_output : out bit_vector (13 downto 0)
|
91 |
|
|
);
|
92 |
|
|
end component;
|
93 |
|
|
|
94 |
|
|
component adder_12bit
|
95 |
|
|
port (
|
96 |
|
|
addend_12bit : in bit_vector (11 downto 0);
|
97 |
|
|
augend_12bit : in bit_vector (11 downto 0);
|
98 |
|
|
adder12_output : out bit_vector (12 downto 0)
|
99 |
|
|
);
|
100 |
|
|
end component;
|
101 |
|
|
|
102 |
|
|
component adder_11bit
|
103 |
|
|
port (
|
104 |
|
|
addend_11bit : in bit_vector (10 downto 0);
|
105 |
|
|
augend_11bit : in bit_vector (10 downto 0);
|
106 |
|
|
adder11_output : out bit_vector (11 downto 0)
|
107 |
|
|
);
|
108 |
|
|
end component;
|
109 |
|
|
|
110 |
|
|
component adder_10bit
|
111 |
|
|
port (
|
112 |
|
|
addend_10bit : in bit_vector (09 downto 0);
|
113 |
|
|
augend_10bit : in bit_vector (09 downto 0);
|
114 |
|
|
adder10_output : out bit_vector (10 downto 0)
|
115 |
|
|
);
|
116 |
|
|
end component;
|
117 |
|
|
|
118 |
|
|
component adder_09bit
|
119 |
|
|
port (
|
120 |
|
|
addend_09bit : in bit_vector (08 downto 0);
|
121 |
|
|
augend_09bit : in bit_vector (08 downto 0);
|
122 |
|
|
adder09_output : out bit_vector (09 downto 0)
|
123 |
|
|
);
|
124 |
|
|
end component;
|
125 |
|
|
|
126 |
|
|
signal input_phase : bit_vector (07 downto 0);
|
127 |
|
|
signal signal_nco : bit_vector (07 downto 0);
|
128 |
|
|
|
129 |
|
|
signal sum_part01 : bit_vector (08 downto 0);
|
130 |
|
|
signal sum_part01_z : bit_vector (08 downto 0);
|
131 |
|
|
signal sum_part02 : bit_vector (09 downto 0);
|
132 |
|
|
signal sum_part03 : bit_vector (10 downto 0);
|
133 |
|
|
signal sum_part04 : bit_vector (11 downto 0);
|
134 |
|
|
signal sum_part05 : bit_vector (12 downto 0);
|
135 |
|
|
signal sum_part06 : bit_vector (13 downto 0);
|
136 |
|
|
signal sum_part07 : bit_vector (14 downto 0);
|
137 |
|
|
signal sum_part08_t : bit_vector (15 downto 0);
|
138 |
|
|
signal sum_part08_o : bit_vector (15 downto 0);
|
139 |
|
|
signal sum_part08_a : bit_vector (15 downto 0);
|
140 |
|
|
signal sum_part08 : bit_vector (15 downto 0);
|
141 |
|
|
|
142 |
|
|
signal adder_stage_01 : bit_vector (09 downto 0);
|
143 |
|
|
signal adder_stage_02 : bit_vector (10 downto 0);
|
144 |
|
|
signal adder_stage_03 : bit_vector (11 downto 0);
|
145 |
|
|
signal adder_stage_04 : bit_vector (12 downto 0);
|
146 |
|
|
signal adder_stage_05 : bit_vector (13 downto 0);
|
147 |
|
|
signal adder_stage_06 : bit_vector (14 downto 0);
|
148 |
|
|
signal adder_stage_07 : bit_vector (15 downto 0);
|
149 |
|
|
signal adder_stage_08 : bit_vector (16 downto 0);
|
150 |
|
|
|
151 |
|
|
begin
|
152 |
|
|
|
153 |
|
|
sum_part01_z (00) <= '0';
|
154 |
|
|
sum_part01_z (01) <= '0';
|
155 |
|
|
sum_part01_z (02) <= '0';
|
156 |
|
|
sum_part01_z (03) <= '0';
|
157 |
|
|
sum_part01_z (04) <= '0';
|
158 |
|
|
sum_part01_z (05) <= '0';
|
159 |
|
|
sum_part01_z (06) <= '0';
|
160 |
|
|
sum_part01_z (07) <= '0';
|
161 |
|
|
sum_part01_z (08) <= '0';
|
162 |
|
|
|
163 |
|
|
sum_part01(00) <= signal_nco(0) and input_phase(0);
|
164 |
|
|
sum_part01(01) <= signal_nco(0) and input_phase(1);
|
165 |
|
|
sum_part01(02) <= signal_nco(0) and input_phase(2);
|
166 |
|
|
sum_part01(03) <= signal_nco(0) and input_phase(3);
|
167 |
|
|
sum_part01(04) <= signal_nco(0) and input_phase(4);
|
168 |
|
|
sum_part01(05) <= signal_nco(0) and input_phase(5);
|
169 |
|
|
sum_part01(06) <= signal_nco(0) and input_phase(6);
|
170 |
|
|
sum_part01(07) <= signal_nco(0) and input_phase(7);
|
171 |
|
|
sum_part01(08) <= signal_nco(0) and input_phase(7);
|
172 |
|
|
|
173 |
|
|
sum_part02(00) <= '0';
|
174 |
|
|
sum_part02(01) <= signal_nco(1) and input_phase(0);
|
175 |
|
|
sum_part02(02) <= signal_nco(1) and input_phase(1);
|
176 |
|
|
sum_part02(03) <= signal_nco(1) and input_phase(2);
|
177 |
|
|
sum_part02(04) <= signal_nco(1) and input_phase(3);
|
178 |
|
|
sum_part02(05) <= signal_nco(1) and input_phase(4);
|
179 |
|
|
sum_part02(06) <= signal_nco(1) and input_phase(5);
|
180 |
|
|
sum_part02(07) <= signal_nco(1) and input_phase(6);
|
181 |
|
|
sum_part02(08) <= signal_nco(1) and input_phase(7);
|
182 |
|
|
sum_part02(09) <= signal_nco(1) and input_phase(7);
|
183 |
|
|
|
184 |
|
|
sum_part03(00) <= '0';
|
185 |
|
|
sum_part03(01) <= '0';
|
186 |
|
|
sum_part03(02) <= signal_nco(2) and input_phase(0);
|
187 |
|
|
sum_part03(03) <= signal_nco(2) and input_phase(1);
|
188 |
|
|
sum_part03(04) <= signal_nco(2) and input_phase(2);
|
189 |
|
|
sum_part03(05) <= signal_nco(2) and input_phase(3);
|
190 |
|
|
sum_part03(06) <= signal_nco(2) and input_phase(4);
|
191 |
|
|
sum_part03(07) <= signal_nco(2) and input_phase(5);
|
192 |
|
|
sum_part03(08) <= signal_nco(2) and input_phase(6);
|
193 |
|
|
sum_part03(09) <= signal_nco(2) and input_phase(7);
|
194 |
|
|
sum_part03(10) <= signal_nco(2) and input_phase(7);
|
195 |
|
|
|
196 |
|
|
sum_part04(00) <= '0';
|
197 |
|
|
sum_part04(01) <= '0';
|
198 |
|
|
sum_part04(02) <= '0';
|
199 |
|
|
sum_part04(03) <= signal_nco(3) and input_phase(0);
|
200 |
|
|
sum_part04(04) <= signal_nco(3) and input_phase(1);
|
201 |
|
|
sum_part04(05) <= signal_nco(3) and input_phase(2);
|
202 |
|
|
sum_part04(06) <= signal_nco(3) and input_phase(3);
|
203 |
|
|
sum_part04(07) <= signal_nco(3) and input_phase(4);
|
204 |
|
|
sum_part04(08) <= signal_nco(3) and input_phase(5);
|
205 |
|
|
sum_part04(09) <= signal_nco(3) and input_phase(6);
|
206 |
|
|
sum_part04(10) <= signal_nco(3) and input_phase(7);
|
207 |
|
|
sum_part04(11) <= signal_nco(3) and input_phase(7);
|
208 |
|
|
|
209 |
|
|
sum_part05(00) <= '0';
|
210 |
|
|
sum_part05(01) <= '0';
|
211 |
|
|
sum_part05(02) <= '0';
|
212 |
|
|
sum_part05(03) <= '0';
|
213 |
|
|
sum_part05(04) <= signal_nco(4) and input_phase(0);
|
214 |
|
|
sum_part05(05) <= signal_nco(4) and input_phase(1);
|
215 |
|
|
sum_part05(06) <= signal_nco(4) and input_phase(2);
|
216 |
|
|
sum_part05(07) <= signal_nco(4) and input_phase(3);
|
217 |
|
|
sum_part05(08) <= signal_nco(4) and input_phase(4);
|
218 |
|
|
sum_part05(09) <= signal_nco(4) and input_phase(5);
|
219 |
|
|
sum_part05(10) <= signal_nco(4) and input_phase(6);
|
220 |
|
|
sum_part05(11) <= signal_nco(4) and input_phase(7);
|
221 |
|
|
sum_part05(12) <= signal_nco(4) and input_phase(7);
|
222 |
|
|
|
223 |
|
|
sum_part06(00) <= '0';
|
224 |
|
|
sum_part06(01) <= '0';
|
225 |
|
|
sum_part06(02) <= '0';
|
226 |
|
|
sum_part06(03) <= '0';
|
227 |
|
|
sum_part06(04) <= '0';
|
228 |
|
|
sum_part06(05) <= signal_nco(5) and input_phase(0);
|
229 |
|
|
sum_part06(06) <= signal_nco(5) and input_phase(1);
|
230 |
|
|
sum_part06(07) <= signal_nco(5) and input_phase(2);
|
231 |
|
|
sum_part06(08) <= signal_nco(5) and input_phase(3);
|
232 |
|
|
sum_part06(09) <= signal_nco(5) and input_phase(4);
|
233 |
|
|
sum_part06(10) <= signal_nco(5) and input_phase(5);
|
234 |
|
|
sum_part06(11) <= signal_nco(5) and input_phase(6);
|
235 |
|
|
sum_part06(12) <= signal_nco(5) and input_phase(7);
|
236 |
|
|
sum_part06(13) <= signal_nco(5) and input_phase(7);
|
237 |
|
|
|
238 |
|
|
sum_part07(00) <= '0';
|
239 |
|
|
sum_part07(01) <= '0';
|
240 |
|
|
sum_part07(02) <= '0';
|
241 |
|
|
sum_part07(03) <= '0';
|
242 |
|
|
sum_part07(04) <= '0';
|
243 |
|
|
sum_part07(05) <= '0';
|
244 |
|
|
sum_part07(06) <= signal_nco(6) and input_phase(0);
|
245 |
|
|
sum_part07(07) <= signal_nco(6) and input_phase(1);
|
246 |
|
|
sum_part07(08) <= signal_nco(6) and input_phase(2);
|
247 |
|
|
sum_part07(09) <= signal_nco(6) and input_phase(3);
|
248 |
|
|
sum_part07(10) <= signal_nco(6) and input_phase(4);
|
249 |
|
|
sum_part07(11) <= signal_nco(6) and input_phase(5);
|
250 |
|
|
sum_part07(12) <= signal_nco(6) and input_phase(6);
|
251 |
|
|
sum_part07(13) <= signal_nco(6) and input_phase(7);
|
252 |
|
|
sum_part07(14) <= signal_nco(6) and input_phase(7);
|
253 |
|
|
|
254 |
|
|
sum_part08(00) <= '0';
|
255 |
|
|
sum_part08(01) <= '0';
|
256 |
|
|
sum_part08(02) <= '0';
|
257 |
|
|
sum_part08(03) <= '0';
|
258 |
|
|
sum_part08(04) <= '0';
|
259 |
|
|
sum_part08(05) <= '0';
|
260 |
|
|
sum_part08(06) <= '0';
|
261 |
|
|
sum_part08(07) <= signal_nco(7) and input_phase(0);
|
262 |
|
|
sum_part08(08) <= signal_nco(7) and input_phase(1);
|
263 |
|
|
sum_part08(09) <= signal_nco(7) and input_phase(2);
|
264 |
|
|
sum_part08(10) <= signal_nco(7) and input_phase(3);
|
265 |
|
|
sum_part08(11) <= signal_nco(7) and input_phase(4);
|
266 |
|
|
sum_part08(12) <= signal_nco(7) and input_phase(5);
|
267 |
|
|
sum_part08(13) <= signal_nco(7) and input_phase(6);
|
268 |
|
|
sum_part08(14) <= signal_nco(7) and input_phase(7);
|
269 |
|
|
sum_part08(15) <= signal_nco(7) and input_phase(7);
|
270 |
|
|
|
271 |
|
|
sum_part08_t (00) <= (not (sum_part08 (00)));
|
272 |
|
|
sum_part08_t (01) <= (not (sum_part08 (01)));
|
273 |
|
|
sum_part08_t (02) <= (not (sum_part08 (02)));
|
274 |
|
|
sum_part08_t (03) <= (not (sum_part08 (03)));
|
275 |
|
|
sum_part08_t (04) <= (not (sum_part08 (04)));
|
276 |
|
|
sum_part08_t (05) <= (not (sum_part08 (05)));
|
277 |
|
|
sum_part08_t (06) <= (not (sum_part08 (06)));
|
278 |
|
|
sum_part08_t (07) <= (not (sum_part08 (07)));
|
279 |
|
|
sum_part08_t (08) <= (not (sum_part08 (08)));
|
280 |
|
|
sum_part08_t (09) <= (not (sum_part08 (09)));
|
281 |
|
|
sum_part08_t (10) <= (not (sum_part08 (10)));
|
282 |
|
|
sum_part08_t (11) <= (not (sum_part08 (11)));
|
283 |
|
|
sum_part08_t (12) <= (not (sum_part08 (12)));
|
284 |
|
|
sum_part08_t (13) <= (not (sum_part08 (13)));
|
285 |
|
|
sum_part08_t (14) <= (not (sum_part08 (14)));
|
286 |
|
|
sum_part08_t (15) <= (not (sum_part08 (15)));
|
287 |
|
|
|
288 |
|
|
sum_part08_o (00) <= '1';
|
289 |
|
|
sum_part08_o (01) <= '0';
|
290 |
|
|
sum_part08_o (02) <= '0';
|
291 |
|
|
sum_part08_o (03) <= '0';
|
292 |
|
|
sum_part08_o (04) <= '0';
|
293 |
|
|
sum_part08_o (05) <= '0';
|
294 |
|
|
sum_part08_o (06) <= '0';
|
295 |
|
|
sum_part08_o (07) <= '0';
|
296 |
|
|
sum_part08_o (08) <= '0';
|
297 |
|
|
sum_part08_o (09) <= '0';
|
298 |
|
|
sum_part08_o (10) <= '0';
|
299 |
|
|
sum_part08_o (11) <= '0';
|
300 |
|
|
sum_part08_o (12) <= '0';
|
301 |
|
|
sum_part08_o (13) <= '0';
|
302 |
|
|
sum_part08_o (14) <= '0';
|
303 |
|
|
sum_part08_o (15) <= '0';
|
304 |
|
|
|
305 |
|
|
stage_01 : adder_09bit
|
306 |
|
|
port map (
|
307 |
|
|
addend_09bit (08 downto 0) => sum_part01_z,
|
308 |
|
|
augend_09bit (08 downto 0) => sum_part01,
|
309 |
|
|
adder09_output (09 downto 0) => adder_stage_01
|
310 |
|
|
);
|
311 |
|
|
|
312 |
|
|
stage_02 : adder_10bit
|
313 |
|
|
port map (
|
314 |
|
|
addend_10bit (09 downto 0) => adder_stage_01,
|
315 |
|
|
augend_10bit (09 downto 0) => sum_part02,
|
316 |
|
|
adder10_output (10 downto 0) => adder_stage_02
|
317 |
|
|
);
|
318 |
|
|
|
319 |
|
|
stage_03 : adder_11bit
|
320 |
|
|
port map (
|
321 |
|
|
addend_11bit (10 downto 0) => adder_stage_02,
|
322 |
|
|
augend_11bit (10 downto 0) => sum_part03,
|
323 |
|
|
adder11_output (11 downto 0) => adder_stage_03
|
324 |
|
|
);
|
325 |
|
|
|
326 |
|
|
stage_04 : adder_12bit
|
327 |
|
|
port map (
|
328 |
|
|
addend_12bit (11 downto 0) => adder_stage_03,
|
329 |
|
|
augend_12bit (11 downto 0) => sum_part04,
|
330 |
|
|
adder12_output (12 downto 0) => adder_stage_04
|
331 |
|
|
);
|
332 |
|
|
|
333 |
|
|
stage_05 : adder_13bit
|
334 |
|
|
port map (
|
335 |
|
|
addend_13bit (12 downto 0) => adder_stage_04,
|
336 |
|
|
augend_13bit (12 downto 0) => sum_part05,
|
337 |
|
|
adder13_output (13 downto 0) => adder_stage_05
|
338 |
|
|
);
|
339 |
|
|
|
340 |
|
|
stage_06 : adder_14bit
|
341 |
|
|
port map (
|
342 |
|
|
addend_14bit (13 downto 0) => adder_stage_05,
|
343 |
|
|
augend_14bit (13 downto 0) => sum_part06,
|
344 |
|
|
adder14_output (14 downto 0) => adder_stage_06
|
345 |
|
|
);
|
346 |
|
|
|
347 |
|
|
stage_07 : adder_15bit
|
348 |
|
|
port map (
|
349 |
|
|
addend_15bit (14 downto 0) => adder_stage_06,
|
350 |
|
|
augend_15bit (14 downto 0) => sum_part07,
|
351 |
|
|
adder15_output (15 downto 0) => adder_stage_07
|
352 |
|
|
);
|
353 |
|
|
|
354 |
|
|
stage_08_a : adder_16bit_u
|
355 |
|
|
port map (
|
356 |
|
|
addend_16bit (15 downto 0) => sum_part08_t,
|
357 |
|
|
augend_16bit (15 downto 0) => sum_part08_o,
|
358 |
|
|
adder16_output (15 downto 0) => sum_part08_a
|
359 |
|
|
);
|
360 |
|
|
|
361 |
|
|
stage_08 : adder_16bit
|
362 |
|
|
port map (
|
363 |
|
|
addend_16bit (15 downto 0) => adder_stage_07,
|
364 |
|
|
augend_16bit (15 downto 0) => sum_part08_a,
|
365 |
|
|
adder16_output (16 downto 0) => adder_stage_08
|
366 |
|
|
);
|
367 |
|
|
|
368 |
|
|
input_phase <= mult_01;
|
369 |
|
|
signal_nco <= mult_02;
|
370 |
|
|
result_mult <= adder_stage_08(15 downto 0);
|
371 |
|
|
|
372 |
|
|
end structural;
|