OpenCores
URL https://opencores.org/ocsvn/raytrac/raytrac/trunk

Subversion Repositories raytrac

[/] [raytrac/] [branches/] [fp_sgdma/] [arith/] [wide/] [fmul32.vhd] - Blame information for rev 241

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 82 jguarin200
------------------------------------------------
2 121 jguarin200
--! @file fmul32.vhd
3 82 jguarin200
--! @brief RayTrac Mantissa Multiplier  
4
--! @author Julián Andrés Guarín Reyes
5
--------------------------------------------------
6
 
7
 
8
-- RAYTRAC (FP BRANCH)
9
-- Author Julian Andres Guarin
10 121 jguarin200
-- fmul32.vhd
11 82 jguarin200
-- This file is part of raytrac.
12
-- 
13
--     raytrac is free software: you can redistribute it and/or modify
14
--     it under the terms of the GNU General Public License as published by
15
--     the Free Software Foundation, either version 3 of the License, or
16
--     (at your option) any later version.
17
-- 
18
--     raytrac is distributed in the hope that it will be useful,
19
--     but WITHOUT ANY WARRANTY; without even the implied warranty of
20
--     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21
--     GNU General Public License for more details.
22
-- 
23
--     You should have received a copy of the GNU General Public License
24
--     along with raytrac.  If not, see <http://www.gnu.org/licenses/>
25
library ieee;
26
use ieee.std_logic_1164.all;
27
use ieee.std_logic_unsigned.all;
28 155 jguarin200
use work.arithpack.all;
29
 
30
 
31 121 jguarin200
entity fmul32 is
32 150 jguarin200
 
33 82 jguarin200
        port (
34 150 jguarin200
                clk             : in std_logic;
35 82 jguarin200
 
36 238 jguarin200
                factor0 : in std_logic_vector(31 downto 0);
37
                factor1 : in std_logic_vector(31 downto 0);
38
                factor2 : in std_logic_vector(31 downto 0);
39
                factor3 : in std_logic_vector(31 downto 0);
40
                factor4 : in std_logic_vector(31 downto 0);
41
                factor5 : in std_logic_vector(31 downto 0);
42
                factor6 : in std_logic_vector(31 downto 0);
43
                factor7 : in std_logic_vector(31 downto 0);
44
                factor8 : in std_logic_vector(31 downto 0);
45
                factor9 : in std_logic_vector(31 downto 0);
46
                factor10: in std_logic_vector(31 downto 0);
47
                factor11: in std_logic_vector(31 downto 0);
48
                p0: out std_logic_vector(31 downto 0);
49
                p1: out std_logic_vector(31 downto 0);
50
                p2: out std_logic_vector(31 downto 0);
51
                p3: out std_logic_vector(31 downto 0);
52
                p4: out std_logic_vector(31 downto 0);
53 239 jguarin200
                p5: out std_logic_vector(31 downto 0)
54 238 jguarin200
 
55
 
56 82 jguarin200
        );
57 153 jguarin200
end entity;
58 121 jguarin200
architecture fmul32_arch of fmul32 is
59 82 jguarin200
 
60 238 jguarin200
        --! Altera Compiler Directive, to avoid m9k autoinferring thanks to the guys at http://www.alteraforum.com/forum/archive/index.php/t-30784.html .... 
61
        attribute altera_attribute : string;
62
        attribute altera_attribute of fmul32_arch : architecture is "-name AUTO_SHIFT_REGISTER_RECOGNITION OFF";
63 89 jguarin200
 
64 155 jguarin200
 
65 94 jguarin200
        --Stage 0 signals
66 238 jguarin200
        signal s0dataa_alfa_p0,s0dataa_beta_p0,s0dataa_gama_p0,s0datab_p0 : std_logic_vector(17 downto 0);
67
        signal s0dataa_alfa_p1,s0dataa_beta_p1,s0dataa_gama_p1,s0datab_p1 : std_logic_vector(17 downto 0);
68
        signal s0dataa_alfa_p2,s0dataa_beta_p2,s0dataa_gama_p2,s0datab_p2 : std_logic_vector(17 downto 0);
69
        signal s0dataa_alfa_p3,s0dataa_beta_p3,s0dataa_gama_p3,s0datab_p3 : std_logic_vector(17 downto 0);
70
        signal s0dataa_alfa_p4,s0dataa_beta_p4,s0dataa_gama_p4,s0datab_p4 : std_logic_vector(17 downto 0);
71
        signal s0dataa_alfa_p5,s0dataa_beta_p5,s0dataa_gama_p5,s0datab_p5 : std_logic_vector(17 downto 0);
72 160 jguarin200
        --!TXBXSTART:MULT_STAGE0        
73 238 jguarin200
        signal s0sga_p0,s0sgb_p0,s0zrs_p0 : std_logic;
74
        signal s0sga_p1,s0sgb_p1,s0zrs_p1 : std_logic;
75
        signal s0sga_p2,s0sgb_p2,s0zrs_p2 : std_logic;
76
        signal s0sga_p3,s0sgb_p3,s0zrs_p3 : std_logic;
77
        signal s0sga_p4,s0sgb_p4,s0zrs_p4 : std_logic;
78
        signal s0sga_p5,s0sgb_p5,s0zrs_p5 : std_logic;
79
        signal s0exp_p0 : std_logic_vector(7 downto 0);
80
        signal s0exp_p1 : std_logic_vector(7 downto 0);
81
        signal s0exp_p2 : std_logic_vector(7 downto 0);
82
        signal s0exp_p3 : std_logic_vector(7 downto 0);
83
        signal s0exp_p4 : std_logic_vector(7 downto 0);
84
        signal s0exp_p5 : std_logic_vector(7 downto 0);
85
        signal s0uma_p0,s0umb_p0 : std_logic_vector(22 downto 0);
86
        signal s0uma_p1,s0umb_p1 : std_logic_vector(22 downto 0);
87
        signal s0uma_p2,s0umb_p2 : std_logic_vector(22 downto 0);
88
        signal s0uma_p3,s0umb_p3 : std_logic_vector(22 downto 0);
89
        signal s0uma_p4,s0umb_p4 : std_logic_vector(22 downto 0);
90
        signal s0uma_p5,s0umb_p5 : std_logic_vector(22 downto 0);
91
        signal s0ac_p0 : std_logic_vector(35 downto 0);
92
        signal s0ac_p1 : std_logic_vector(35 downto 0);
93
        signal s0ac_p2 : std_logic_vector(35 downto 0);
94
        signal s0ac_p3 : std_logic_vector(35 downto 0);
95
        signal s0ac_p4 : std_logic_vector(35 downto 0);
96
        signal s0ac_p5 : std_logic_vector(35 downto 0);
97 152 jguarin200
        --!TBXEND
98 238 jguarin200
        signal s1sgr_p0,s2sgr_p0:std_logic;
99
        signal s1sgr_p1,s2sgr_p1:std_logic;
100
        signal s1sgr_p2,s2sgr_p2:std_logic;
101
        signal s1sgr_p3,s2sgr_p3:std_logic;
102
        signal s1sgr_p4,s2sgr_p4:std_logic;
103
        signal s1sgr_p5,s2sgr_p5:std_logic;
104
        signal s0exa_p0,s0exb_p0,s1exp_p0,s2exp_p0:std_logic_vector(7 downto 0);
105
        signal s0exa_p1,s0exb_p1,s1exp_p1,s2exp_p1:std_logic_vector(7 downto 0);
106
        signal s0exa_p2,s0exb_p2,s1exp_p2,s2exp_p2:std_logic_vector(7 downto 0);
107
        signal s0exa_p3,s0exb_p3,s1exp_p3,s2exp_p3:std_logic_vector(7 downto 0);
108
        signal s0exa_p4,s0exb_p4,s1exp_p4,s2exp_p4:std_logic_vector(7 downto 0);
109
        signal s0exa_p5,s0exb_p5,s1exp_p5,s2exp_p5:std_logic_vector(7 downto 0);
110
        signal s0ad_p0,s0bc_p0,s1ad_p0,s1bc_p0:std_logic_vector(23 downto 0);
111
        signal s0ad_p1,s0bc_p1,s1ad_p1,s1bc_p1:std_logic_vector(23 downto 0);
112
        signal s0ad_p2,s0bc_p2,s1ad_p2,s1bc_p2:std_logic_vector(23 downto 0);
113
        signal s0ad_p3,s0bc_p3,s1ad_p3,s1bc_p3:std_logic_vector(23 downto 0);
114
        signal s0ad_p4,s0bc_p4,s1ad_p4,s1bc_p4:std_logic_vector(23 downto 0);
115
        signal s0ad_p5,s0bc_p5,s1ad_p5,s1bc_p5:std_logic_vector(23 downto 0);
116
        signal s1ac_p0,s1umu_p0:std_logic_vector(35 downto 0);
117
        signal s1ac_p1,s1umu_p1:std_logic_vector(35 downto 0);
118
        signal s1ac_p2,s1umu_p2:std_logic_vector(35 downto 0);
119
        signal s1ac_p3,s1umu_p3:std_logic_vector(35 downto 0);
120
        signal s1ac_p4,s1umu_p4:std_logic_vector(35 downto 0);
121
        signal s1ac_p5,s1umu_p5:std_logic_vector(35 downto 0);
122
        signal s2umu_p0:std_logic_vector(24 downto 0);
123
        signal s2umu_p1:std_logic_vector(24 downto 0);
124
        signal s2umu_p2:std_logic_vector(24 downto 0);
125
        signal s2umu_p3:std_logic_vector(24 downto 0);
126
        signal s2umu_p4:std_logic_vector(24 downto 0);
127
        signal s2umu_p5:std_logic_vector(24 downto 0);
128 94 jguarin200
 
129 219 jguarin200
        --! LPM_MULTIPLIER
130
        component lpm_mult
131
        generic (
132
                lpm_hint                        : string;
133
                lpm_pipeline            : natural;
134
                lpm_representation      : string;
135
                lpm_type                        : string;
136
                lpm_widtha                      : natural;
137
                lpm_widthb                      : natural;
138
                lpm_widthp                      : natural
139
        );
140
        port (
141
                dataa   : in std_logic_vector ( lpm_widtha-1 downto 0 );
142
                datab   : in std_logic_vector ( lpm_widthb-1 downto 0 );
143
                result  : out std_logic_vector( lpm_widthp-1 downto 0 )
144
        );
145
        end component;
146
 
147
 
148 139 jguarin200
begin
149 94 jguarin200
 
150 150 jguarin200
 
151 139 jguarin200
        process(clk)
152 82 jguarin200
        begin
153
 
154 139 jguarin200
                if clk'event and clk='1'  then
155 86 jguarin200
                        --! Registro de entrada
156 238 jguarin200
                        s0sga_p0 <= factor0(31);
157
                        s0sga_p1 <= factor2(31);
158
                        s0sga_p2 <= factor4(31);
159
                        s0sga_p3 <= factor6(31);
160
                        s0sga_p4 <= factor8(31);
161
                        s0sga_p5 <= factor10(31);
162
 
163
                        s0sgb_p0 <= factor1(31);
164
                        s0sgb_p1 <= factor3(31);
165
                        s0sgb_p2 <= factor5(31);
166
                        s0sgb_p3 <= factor7(31);
167
                        s0sgb_p4 <= factor9(31);
168
                        s0sgb_p5 <= factor11(31);
169
 
170
                        s0exa_p0 <= factor0(30 downto 23);
171
                        s0exa_p1 <= factor2(30 downto 23);
172
                        s0exa_p2 <= factor4(30 downto 23);
173
                        s0exa_p3 <= factor6(30 downto 23);
174
                        s0exa_p4 <= factor8(30 downto 23);
175
                        s0exa_p5 <= factor10(30 downto 23);
176
 
177
                        s0exb_p0 <= factor1(30 downto 23);
178
                        s0exb_p1 <= factor3(30 downto 23);
179
                        s0exb_p2 <= factor5(30 downto 23);
180
                        s0exb_p3 <= factor7(30 downto 23);
181
                        s0exb_p4 <= factor9(30 downto 23);
182
                        s0exb_p5 <= factor11(30 downto 23);
183
 
184
                        s0uma_p0 <= factor0(22 downto 0);
185
                        s0uma_p1 <= factor2(22 downto 0);
186
                        s0uma_p2 <= factor4(22 downto 0);
187
                        s0uma_p3 <= factor6(22 downto 0);
188
                        s0uma_p4 <= factor8(22 downto 0);
189
                        s0uma_p5 <= factor10(22 downto 0);
190
 
191
                        s0umb_p0 <= factor1(22 downto 0);
192
                        s0umb_p1 <= factor3(22 downto 0);
193
                        s0umb_p2 <= factor5(22 downto 0);
194
                        s0umb_p3 <= factor7(22 downto 0);
195
                        s0umb_p4 <= factor9(22 downto 0);
196
                        s0umb_p5 <= factor11(22 downto 0);
197
 
198 89 jguarin200
                        --! Etapa 0 multiplicacion de la mantissa, suma de los exponentes y multiplicaci&oacute;n de los signos.
199 238 jguarin200
                        s1sgr_p0 <= s0sga_p0 xor s0sgb_p0;
200
                        s1sgr_p1 <= s0sga_p1 xor s0sgb_p1;
201
                        s1sgr_p2 <= s0sga_p2 xor s0sgb_p2;
202
                        s1sgr_p3 <= s0sga_p3 xor s0sgb_p3;
203
                        s1sgr_p4 <= s0sga_p4 xor s0sgb_p4;
204
                        s1sgr_p5 <= s0sga_p5 xor s0sgb_p5;
205
 
206
                        s1ad_p0 <= s0ad_p0;
207
                        s1ad_p1 <= s0ad_p1;
208
                        s1ad_p2 <= s0ad_p2;
209
                        s1ad_p3 <= s0ad_p3;
210
                        s1ad_p4 <= s0ad_p4;
211
                        s1ad_p5 <= s0ad_p5;
212 94 jguarin200
 
213 238 jguarin200
                        s1bc_p0 <= s0bc_p0;
214
                        s1bc_p1 <= s0bc_p1;
215
                        s1bc_p2 <= s0bc_p2;
216
                        s1bc_p3 <= s0bc_p3;
217
                        s1bc_p4 <= s0bc_p4;
218
                        s1bc_p5 <= s0bc_p5;
219
 
220
                        s1ac_p0 <= s0ac_p0;
221
                        s1ac_p1 <= s0ac_p1;
222
                        s1ac_p2 <= s0ac_p2;
223
                        s1ac_p3 <= s0ac_p3;
224
                        s1ac_p4 <= s0ac_p4;
225
                        s1ac_p5 <= s0ac_p5;
226
 
227
                        s1exp_p0 <= s0exp_p0;
228
                        s1exp_p1 <= s0exp_p1;
229
                        s1exp_p2 <= s0exp_p2;
230
                        s1exp_p3 <= s0exp_p3;
231
                        s1exp_p4 <= s0exp_p4;
232
                        s1exp_p5 <= s0exp_p5;
233
 
234 94 jguarin200
                        --! Etapa 1 Sumas parciales
235 238 jguarin200
                        s2umu_p0 <= s1umu_p0(35 downto 11);
236
                        s2umu_p1 <= s1umu_p1(35 downto 11);
237
                        s2umu_p2 <= s1umu_p2(35 downto 11);
238
                        s2umu_p3 <= s1umu_p3(35 downto 11);
239
                        s2umu_p4 <= s1umu_p4(35 downto 11);
240
                        s2umu_p5 <= s1umu_p5(35 downto 11);
241 94 jguarin200
 
242 238 jguarin200
                        s2sgr_p0 <= s1sgr_p0;
243
                        s2sgr_p1 <= s1sgr_p1;
244
                        s2sgr_p2 <= s1sgr_p2;
245
                        s2sgr_p3 <= s1sgr_p3;
246
                        s2sgr_p4 <= s1sgr_p4;
247
                        s2sgr_p5 <= s1sgr_p5;
248
 
249
                        s2exp_p0 <= s1exp_p0;
250
                        s2exp_p1 <= s1exp_p1;
251
                        s2exp_p2 <= s1exp_p2;
252
                        s2exp_p3 <= s1exp_p3;
253
                        s2exp_p4 <= s1exp_p4;
254
                        s2exp_p5 <= s1exp_p5;
255 137 jguarin200
 
256 238 jguarin200
 
257 82 jguarin200
                end if;
258
        end process;
259 137 jguarin200
        --! Etapa 2 entregar el resultado
260 238 jguarin200
        p0(31) <= s2sgr_p0;
261
        p1(31) <= s2sgr_p1;
262
        p2(31) <= s2sgr_p2;
263
        p3(31) <= s2sgr_p3;
264
        p4(31) <= s2sgr_p4;
265
        p5(31) <= s2sgr_p5;
266
 
267
        process (
268
                s2exp_p0,
269
                s2exp_p1,
270
                s2exp_p2,
271
                s2exp_p3,
272
                s2exp_p4,
273
                s2exp_p5,
274
 
275
                s2umu_p0,
276
                s2umu_p1,
277
                s2umu_p2,
278
                s2umu_p3,
279
                s2umu_p4,
280
                s2umu_p5
281
        )
282 137 jguarin200
        begin
283 238 jguarin200
 
284
                p0(30 downto 23) <= s2exp_p0+s2umu_p0(24);
285
                p1(30 downto 23) <= s2exp_p1+s2umu_p1(24);
286
                p2(30 downto 23) <= s2exp_p2+s2umu_p2(24);
287
                p3(30 downto 23) <= s2exp_p3+s2umu_p3(24);
288
                p4(30 downto 23) <= s2exp_p4+s2umu_p4(24);
289
                p5(30 downto 23) <= s2exp_p5+s2umu_p5(24);
290
 
291
                if s2umu_p0(24) ='1' then
292
                        p0(22 downto 0) <= s2umu_p0(23 downto 1);
293 137 jguarin200
                else
294 238 jguarin200
                        p0(22 downto 0) <= s2umu_p0(22 downto 0);
295 137 jguarin200
                end if;
296 238 jguarin200
                if s2umu_p1(24) ='1' then
297
                        p1(22 downto 0) <= s2umu_p1(23 downto 1);
298 240 jguarin200
                else
299 238 jguarin200
                        p1(22 downto 0) <= s2umu_p1(22 downto 0);
300
                end if;
301
                if s2umu_p2(24) ='1' then
302
                        p2(22 downto 0) <= s2umu_p2(23 downto 1);
303
                else
304
                        p2(22 downto 0) <= s2umu_p2(22 downto 0);
305
                end if;
306
                if s2umu_p3(24) ='1' then
307
                        p3(22 downto 0) <= s2umu_p3(23 downto 1);
308
                else
309
                        p3(22 downto 0) <= s2umu_p3(22 downto 0);
310
                end if;
311
                if s2umu_p4(24) ='1' then
312
                        p4(22 downto 0) <= s2umu_p4(23 downto 1);
313
                else
314
                        p4(22 downto 0) <= s2umu_p4(22 downto 0);
315
                end if;
316
                if s2umu_p5(24) ='1' then
317
                        p5(22 downto 0) <= s2umu_p5(23 downto 1);
318
                else
319
                        p5(22 downto 0) <= s2umu_p5(22 downto 0);
320
                end if;
321 137 jguarin200
        end process;
322 82 jguarin200
 
323 94 jguarin200
        --! Combinatorial Gremlin Etapa 0 : multiplicacion de la mantissa, suma de los exponentes y multiplicaci&oacute;n de los signos.
324
 
325
        --! Multipliers
326 238 jguarin200
        s0dataa_alfa_p0 <= s0zrs_p0&s0uma_p0(22 downto 6);
327
        s0dataa_alfa_p1 <= s0zrs_p1&s0uma_p1(22 downto 6);
328
        s0dataa_alfa_p2 <= s0zrs_p2&s0uma_p2(22 downto 6);
329
        s0dataa_alfa_p3 <= s0zrs_p3&s0uma_p3(22 downto 6);
330
        s0dataa_alfa_p4 <= s0zrs_p4&s0uma_p4(22 downto 6);
331
        s0dataa_alfa_p5 <= s0zrs_p5&s0uma_p5(22 downto 6);
332
 
333
        s0datab_p0 <= s0zrs_p0&s0umb_p0(22 downto 6);
334
        s0datab_p1 <= s0zrs_p1&s0umb_p1(22 downto 6);
335
        s0datab_p2 <= s0zrs_p2&s0umb_p2(22 downto 6);
336
        s0datab_p3 <= s0zrs_p3&s0umb_p3(22 downto 6);
337
        s0datab_p4 <= s0zrs_p4&s0umb_p4(22 downto 6);
338
        s0datab_p5 <= s0zrs_p5&s0umb_p5(22 downto 6);
339
 
340
        mult18x18ac0:lpm_mult
341 155 jguarin200
        generic map (
342
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
343
                lpm_pipeline => 0,
344
                lpm_representation => "UNSIGNED",
345
                lpm_type => "LPM_MULT",
346
                lpm_widtha => 18,
347
                lpm_widthb => 18,
348
                lpm_widthp => 36
349
        )
350
        port map (
351 238 jguarin200
                dataa => s0dataa_alfa_p0,
352
                datab => s0datab_p0,
353
                result => s0ac_p0
354 155 jguarin200
        );
355 238 jguarin200
 
356
        mult18x18ac1:lpm_mult
357 155 jguarin200
        generic map (
358
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
359
                lpm_pipeline => 0,
360
                lpm_representation => "UNSIGNED",
361
                lpm_type => "LPM_MULT",
362
                lpm_widtha => 18,
363 238 jguarin200
                lpm_widthb => 18,
364
                lpm_widthp => 36
365
        )
366
        port map (
367
                dataa => s0dataa_alfa_p1,
368
                datab => s0datab_p1,
369
                result => s0ac_p1
370
        );
371
 
372
        mult18x18ac2:lpm_mult
373
        generic map (
374
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
375
                lpm_pipeline => 0,
376
                lpm_representation => "UNSIGNED",
377
                lpm_type => "LPM_MULT",
378
                lpm_widtha => 18,
379
                lpm_widthb => 18,
380
                lpm_widthp => 36
381
        )
382
        port map (
383
                dataa => s0dataa_alfa_p2,
384
                datab => s0datab_p2,
385
                result => s0ac_p2
386
        );
387
 
388
        mult18x18ac3:lpm_mult
389
        generic map (
390
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
391
                lpm_pipeline => 0,
392
                lpm_representation => "UNSIGNED",
393
                lpm_type => "LPM_MULT",
394
                lpm_widtha => 18,
395
                lpm_widthb => 18,
396
                lpm_widthp => 36
397
        )
398
        port map (
399
                dataa => s0dataa_alfa_p3,
400
                datab => s0datab_p3,
401
                result => s0ac_p3
402
        );
403
 
404
        mult18x18ac4:lpm_mult
405
        generic map (
406
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
407
                lpm_pipeline => 0,
408
                lpm_representation => "UNSIGNED",
409
                lpm_type => "LPM_MULT",
410
                lpm_widtha => 18,
411
                lpm_widthb => 18,
412
                lpm_widthp => 36
413
        )
414
        port map (
415
                dataa => s0dataa_alfa_p4,
416
                datab => s0datab_p4,
417
                result => s0ac_p4
418
        );
419
        mult18x18ac5:lpm_mult
420
        generic map (
421
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
422
                lpm_pipeline => 0,
423
                lpm_representation => "UNSIGNED",
424
                lpm_type => "LPM_MULT",
425
                lpm_widtha => 18,
426
                lpm_widthb => 18,
427
                lpm_widthp => 36
428
        )
429
        port map (
430
                dataa => s0dataa_alfa_p5,
431
                datab => s0datab_p5,
432
                result => s0ac_p5
433
        );
434
 
435
        s0dataa_beta_p0 <= s0zrs_p0&s0uma_p0(22 downto 6);
436
        s0dataa_beta_p1 <= s0zrs_p1&s0uma_p1(22 downto 6);
437
        s0dataa_beta_p2 <= s0zrs_p2&s0uma_p2(22 downto 6);
438
        s0dataa_beta_p3 <= s0zrs_p3&s0uma_p3(22 downto 6);
439
        s0dataa_beta_p4 <= s0zrs_p4&s0uma_p4(22 downto 6);
440
        s0dataa_beta_p5 <= s0zrs_p5&s0uma_p5(22 downto 6);
441
 
442
        mult18x6ad0:lpm_mult
443
        generic map (
444
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
445
                lpm_pipeline => 0,
446
                lpm_representation => "UNSIGNED",
447
                lpm_type => "LPM_MULT",
448
                lpm_widtha => 18,
449 155 jguarin200
                lpm_widthb => 6,
450
                lpm_widthp => 24
451
        )
452
        port map (
453 238 jguarin200
                dataa => s0dataa_beta_p0,
454
                datab => s0umb_p0(5 downto 0),
455
                result => s0ad_p0
456 155 jguarin200
        );
457 238 jguarin200
 
458
 
459
        mult18x6ad1:lpm_mult
460 155 jguarin200
        generic map (
461
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
462
                lpm_pipeline => 0,
463
                lpm_representation => "UNSIGNED",
464
                lpm_type => "LPM_MULT",
465
                lpm_widtha => 18,
466
                lpm_widthb => 6,
467
                lpm_widthp => 24
468
        )
469
        port map (
470 238 jguarin200
                dataa => s0dataa_beta_p1,
471
                datab => s0umb_p1(5 downto 0),
472
                result => s0ad_p1
473 155 jguarin200
        );
474 238 jguarin200
 
475
        mult18x6ad2:lpm_mult
476
        generic map (
477
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
478
                lpm_pipeline => 0,
479
                lpm_representation => "UNSIGNED",
480
                lpm_type => "LPM_MULT",
481
                lpm_widtha => 18,
482
                lpm_widthb => 6,
483
                lpm_widthp => 24
484
        )
485
        port map (
486
                dataa => s0dataa_beta_p2,
487
                datab => s0umb_p2(5 downto 0),
488
                result => s0ad_p2
489
        );
490
 
491
        mult18x6ad3:lpm_mult
492
        generic map (
493
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
494
                lpm_pipeline => 0,
495
                lpm_representation => "UNSIGNED",
496
                lpm_type => "LPM_MULT",
497
                lpm_widtha => 18,
498
                lpm_widthb => 6,
499
                lpm_widthp => 24
500
        )
501
        port map (
502
                dataa => s0dataa_beta_p3,
503
                datab => s0umb_p3(5 downto 0),
504
                result => s0ad_p3
505
        );
506
 
507
        mult18x6ad4:lpm_mult
508
        generic map (
509
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
510
                lpm_pipeline => 0,
511
                lpm_representation => "UNSIGNED",
512
                lpm_type => "LPM_MULT",
513
                lpm_widtha => 18,
514
                lpm_widthb => 6,
515
                lpm_widthp => 24
516
        )
517
        port map (
518
                dataa => s0dataa_beta_p4,
519
                datab => s0umb_p4(5 downto 0),
520
                result => s0ad_p4
521
        );
522
 
523
        mult18x6ad5:lpm_mult
524
        generic map (
525
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
526
                lpm_pipeline => 0,
527
                lpm_representation => "UNSIGNED",
528
                lpm_type => "LPM_MULT",
529
                lpm_widtha => 18,
530
                lpm_widthb => 6,
531
                lpm_widthp => 24
532
        )
533
        port map (
534
                dataa => s0dataa_beta_p5,
535
                datab => s0umb_p5(5 downto 0),
536
                result => s0ad_p5
537
        );
538
 
539
 
540
        s0dataa_gama_p0 <= s0zrs_p0&s0umb_p0(22 downto 6);
541
        s0dataa_gama_p1 <= s0zrs_p0&s0umb_p1(22 downto 6);
542
        s0dataa_gama_p2 <= s0zrs_p0&s0umb_p2(22 downto 6);
543
        s0dataa_gama_p3 <= s0zrs_p0&s0umb_p3(22 downto 6);
544
        s0dataa_gama_p4 <= s0zrs_p0&s0umb_p4(22 downto 6);
545
        s0dataa_gama_p5 <= s0zrs_p0&s0umb_p5(22 downto 6);
546
 
547
        mult18x6bc0:lpm_mult
548
        generic map (
549
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
550
                lpm_pipeline => 0,
551
                lpm_representation => "UNSIGNED",
552
                lpm_type => "LPM_MULT",
553
                lpm_widtha => 18,
554
                lpm_widthb => 6,
555
                lpm_widthp => 24
556
        )
557
        port map (
558
                dataa => s0dataa_gama_p0,
559
                datab => s0uma_p0(5 downto 0),
560
                result => s0bc_p0
561
        );
562 89 jguarin200
 
563 241 jguarin200
        mult18x6bc1:lpm_mult
564 238 jguarin200
        generic map (
565
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
566
                lpm_pipeline => 0,
567
                lpm_representation => "UNSIGNED",
568
                lpm_type => "LPM_MULT",
569
                lpm_widtha => 18,
570
                lpm_widthb => 6,
571
                lpm_widthp => 24
572
        )
573
        port map (
574 241 jguarin200
                dataa => s0dataa_gama_p1,
575
                datab => s0uma_p1(5 downto 0),
576
                result => s0bc_p1
577 238 jguarin200
        );
578
 
579 241 jguarin200
        mult18x6bc2:lpm_mult
580 238 jguarin200
        generic map (
581
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
582
                lpm_pipeline => 0,
583
                lpm_representation => "UNSIGNED",
584
                lpm_type => "LPM_MULT",
585
                lpm_widtha => 18,
586
                lpm_widthb => 6,
587
                lpm_widthp => 24
588
        )
589
        port map (
590 241 jguarin200
                dataa => s0dataa_gama_p2,
591
                datab => s0uma_p2(5 downto 0),
592
                result => s0bc_p2
593 238 jguarin200
        );
594
 
595 241 jguarin200
        mult18x6bc3:lpm_mult
596 238 jguarin200
        generic map (
597
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
598
                lpm_pipeline => 0,
599
                lpm_representation => "UNSIGNED",
600
                lpm_type => "LPM_MULT",
601
                lpm_widtha => 18,
602
                lpm_widthb => 6,
603
                lpm_widthp => 24
604
        )
605
        port map (
606 241 jguarin200
                dataa => s0dataa_gama_p4,
607
                datab => s0uma_p4(5 downto 0),
608
                result => s0bc_p4
609 238 jguarin200
        );
610
 
611 241 jguarin200
        mult18x6bc5:lpm_mult
612 238 jguarin200
        generic map (
613
                lpm_hint => "DEDICATED_MULTIPLIER_CIRCUITRY=YES,MAXIMIZE_SPEED=9",
614
                lpm_pipeline => 0,
615
                lpm_representation => "UNSIGNED",
616
                lpm_type => "LPM_MULT",
617
                lpm_widtha => 18,
618
                lpm_widthb => 6,
619
                lpm_widthp => 24
620
        )
621
        port map (
622 241 jguarin200
                dataa => s0dataa_gama_p5,
623
                datab => s0uma_p5(5 downto 0),
624
                result => s0bc_p5
625 238 jguarin200
        );
626
 
627
 
628 94 jguarin200
        --! Exponent Addition 
629 238 jguarin200
        process (
630
                s0sga_p0,
631
                s0sga_p1,
632
                s0sga_p2,
633
                s0sga_p3,
634
                s0sga_p4,
635
                s0sga_p5,
636 121 jguarin200
 
637 238 jguarin200
                s0sgb_p0,
638
                s0sgb_p1,
639
                s0sgb_p2,
640
                s0sgb_p3,
641
                s0sgb_p4,
642
                s0sgb_p5,
643
 
644
                s0exa_p0,
645
                s0exa_p1,
646
                s0exa_p2,
647
                s0exa_p3,
648
                s0exa_p4,
649
                s0exa_p5,
650
 
651
                s0exb_p0,
652
                s0exb_p1,
653
                s0exb_p2,
654
                s0exb_p3,
655
                s0exb_p4,
656
                s0exb_p5
657
        )
658
 
659 89 jguarin200
        begin
660 121 jguarin200
 
661 238 jguarin200
                if s0exa_p0=x"00" or s0exb_p0=x"00" then
662
                        s0exp_p0 <= (others => '0');
663
                        s0zrs_p0 <= '0';
664 89 jguarin200
                else
665 238 jguarin200
                        s0zrs_p0<='1';
666
                        s0exp_p0 <= s0exa_p0+s0exb_p0+x"81";
667 89 jguarin200
                end if;
668 238 jguarin200
                if s0exa_p1=x"00" or s0exb_p1=x"00" then
669
                        s0exp_p1 <= (others => '0');
670
                        s0zrs_p1 <= '0';
671
                else
672
                        s0zrs_p1<='1';
673
                        s0exp_p1 <= s0exa_p1+s0exb_p1+x"81";
674
                end if;
675
                if s0exa_p2=x"00" or s0exb_p2=x"00" then
676
                        s0exp_p2 <= (others => '0');
677
                        s0zrs_p2 <= '0';
678
                else
679
                        s0zrs_p2<='1';
680
                        s0exp_p2 <= s0exa_p2+s0exb_p2+x"81";
681
                end if;
682
                if s0exa_p3=x"00" or s0exb_p3=x"00" then
683
                        s0exp_p3 <= (others => '0');
684
                        s0zrs_p3 <= '0';
685
                else
686
                        s0zrs_p3<='1';
687
                        s0exp_p3 <= s0exa_p3+s0exb_p3+x"81";
688
                end if;
689
                if s0exa_p4=x"00" or s0exb_p4=x"00" then
690
                        s0exp_p4 <= (others => '0');
691
                        s0zrs_p4 <= '0';
692
                else
693
                        s0zrs_p4<='1';
694
                        s0exp_p4 <= s0exa_p4+s0exb_p4+x"81";
695
                end if;
696
                if s0exa_p5=x"00" or s0exb_p5=x"00" then
697
                        s0exp_p5 <= (others => '0');
698
                        s0zrs_p5 <= '0';
699
                else
700
                        s0zrs_p5<='1';
701
                        s0exp_p5 <= s0exa_p5+s0exb_p5+x"81";
702
                end if;
703 89 jguarin200
        end process;
704
 
705 94 jguarin200
        --! Etapa 1: Suma parcial de la multiplicacion. Suma del exponente      
706 238 jguarin200
        process(
707
 
708
                s1ac_p0,
709
                s1ac_p1,
710
                s1ac_p2,
711
                s1ac_p3,
712
                s1ac_p4,
713
                s1ac_p5,
714
 
715
                s1ad_p0,
716
                s1ad_p1,
717
                s1ad_p2,
718
                s1ad_p3,
719
                s1ad_p4,
720
                s1ad_p5,
721
 
722
                s1bc_p0,
723
                s1bc_p1,
724
                s1bc_p2,
725
                s1bc_p3,
726
                s1bc_p4,
727
                s1bc_p5
728
        )
729 94 jguarin200
        begin
730 238 jguarin200
 
731
                s1umu_p0 <= s1ac_p0+s1ad_p0(23 downto 6)+s1bc_p0(23 downto 6);
732
                s1umu_p1 <= s1ac_p1+s1ad_p1(23 downto 6)+s1bc_p1(23 downto 6);
733
                s1umu_p2 <= s1ac_p2+s1ad_p2(23 downto 6)+s1bc_p2(23 downto 6);
734
                s1umu_p3 <= s1ac_p3+s1ad_p3(23 downto 6)+s1bc_p3(23 downto 6);
735
                s1umu_p4 <= s1ac_p4+s1ad_p4(23 downto 6)+s1bc_p4(23 downto 6);
736
                s1umu_p5 <= s1ac_p5+s1ad_p5(23 downto 6)+s1bc_p5(23 downto 6);
737
 
738 94 jguarin200
        end process;
739
 
740
 
741
 
742
 
743
 
744
 
745 153 jguarin200
end architecture;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.