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

Subversion Repositories plasma

[/] [plasma/] [trunk/] [vhdl/] [mult.vhd] - Blame information for rev 121

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 rhoads
---------------------------------------------------------------------
2
-- TITLE: Multiplication and Division Unit
3 121 rhoads
-- AUTHORS: Steve Rhoads (rhoadss@yahoo.com)
4
--          Matthias Gruenewald
5 2 rhoads
-- DATE CREATED: 1/31/01
6
-- FILENAME: mult.vhd
7 43 rhoads
-- PROJECT: Plasma CPU core
8 2 rhoads
-- COPYRIGHT: Software placed into the public domain by the author.
9
--    Software 'as is' without warranty.  Author liable for nothing.
10
-- DESCRIPTION:
11
--    Implements the multiplication and division unit.
12 90 rhoads
--    Division takes 32 clock cycles.
13
--    Multiplication normally takes 16 clock cycles.
14
--    if b <= 0xffff then mult in 8 cycles. 
15
--    if b <= 0xff then mult in 4 cycles. 
16 97 rhoads
--
17
-- For multiplication set reg_b = 0x00000000 & b.  The 64-bit result
18
-- will be in reg_b.  The lower bits of reg_b contain the upper 
19
-- bits of b that have not yet been multiplied.  For 16 clock cycles
20
-- shift reg_b two bits to the right.  Use the lowest two bits of reg_b 
21
-- to multiply by two bits at a time and add the result to the upper
22
-- 32-bits of reg_b (using C syntax):
23
--    reg_b = (reg_b >> 2) + (((reg_b & 3) * reg_a) << 32);
24
--
25
-- For division set reg_b = '0' & b & 30_ZEROS.  The answer will be
26
-- in answer_reg and the remainder in reg_a.  For 32 clock cycles
27
-- (using C syntax):
28
--    answer_reg = (answer_reg << 1);
29
--    if (reg_a >= reg_b) {
30
--       answer_reg += 1;
31
--       reg_a -= reg_b;
32
--    }
33
--    reg_b = reg_b >> 1;
34 2 rhoads
---------------------------------------------------------------------
35 121 rhoads
--library ieee, MLITE_LIB;
36
--use MLITE_LIB.all;
37 2 rhoads
library ieee;
38
use ieee.std_logic_1164.all;
39 90 rhoads
use ieee.std_logic_unsigned.all;
40 121 rhoads
use IEEE.std_logic_arith.all;
41 39 rhoads
use work.mlite_pack.all;
42 2 rhoads
 
43
entity mult is
44 117 rhoads
   generic(adder_type : string := "GENERIC";
45
           mult_type  : string := "GENERIC");
46 2 rhoads
   port(clk       : in std_logic;
47
        a, b      : in std_logic_vector(31 downto 0);
48
        mult_func : in mult_function_type;
49
        c_mult    : out std_logic_vector(31 downto 0);
50
        pause_out : out std_logic);
51
end; --entity mult
52
 
53
architecture logic of mult is
54 121 rhoads
 
55 2 rhoads
--   type mult_function_type is (
56
--      mult_nothing, mult_read_lo, mult_read_hi, mult_write_lo, 
57
--      mult_write_hi, mult_mult, mult_divide, mult_signed_divide);
58 47 rhoads
   signal do_mult_reg   : std_logic;
59 2 rhoads
   signal do_signed_reg : std_logic;
60
   signal count_reg     : std_logic_vector(5 downto 0);
61
   signal reg_a         : std_logic_vector(31 downto 0);
62
   signal reg_b         : std_logic_vector(63 downto 0);
63
   signal answer_reg    : std_logic_vector(31 downto 0);
64 90 rhoads
   signal aa, bb        : std_logic_vector(33 downto 0);
65
   signal sum           : std_logic_vector(33 downto 0);
66 121 rhoads
   signal sum2          : std_logic_vector(67 downto 0);
67 90 rhoads
   signal reg_a_times3  : std_logic_vector(33 downto 0);
68 121 rhoads
   signal sign_extend_sig : std_logic;
69
 
70
   --Used in Xilinx tri-state area optimizated version
71
   signal SUB_Y, A_PROCESSED, B_PROCESSED, A_REG, B_REG : std_logic_vector(31 downto 0);
72
   signal DIV_Y, DIV_Y_IN, DIV_Y_IN_CALC, DIV_Y_IN_INIT, Y_IN, Y_IN2, MULT_Y, Y : std_logic_vector(63 downto 0) := (others => '0');
73
   signal SAVE_Y, SAVE_DIV_Y, MULT_ND, MULT_RDY, DO_SIGNED, DIV_ND : std_logic;
74
   signal DIV_COUNT, INVERT_A, INVERT_B, INVERT_Y, DIV_RDY : std_logic;
75
   signal DIV_COUNTER : std_logic_vector(4 downto 0);
76
   signal PAUSE_IN, SAVE_PAUSE, PAUSE : std_logic := '0';
77
   signal MULT_RFD : std_logic;
78
   signal a_temp_sig, a_neg_sig, b_neg_sig : std_logic_vector(31 downto 0);
79
   signal b_temp_sig    : std_logic_vector(63 downto 0);
80
   signal a_msb, b_msb  : std_logic;
81
   signal answer_temp_sig : std_logic_vector(31 downto 0);
82
   signal aa_select     : std_logic_vector(3 downto 0);
83
   signal bb_select     : std_logic_vector(1 downto 0);
84
   signal a_select      : std_logic_vector(4 downto 0);
85
   signal b_select      : std_logic_vector(11 downto 0);
86
   signal answer_select : std_logic_vector(2 downto 0);
87
 
88 2 rhoads
begin
89 121 rhoads
 
90
   --sum = aa + bb
91
   generic_adder: if adder_type = "GENERIC" generate
92
      sum <= (aa + bb) when do_mult_reg = '1' else
93
             (aa - bb);
94
   end generate; --generic_adder
95 2 rhoads
 
96 121 rhoads
   --For Altera: sum = aa + bb
97
   lpm_adder: if adder_type = "ALTERA" generate
98
      lpm_add_sub_component : lpm_add_sub
99
        GENERIC MAP (
100
          lpm_width => 34,
101
          lpm_direction => "UNUSED",
102
          lpm_type => "LPM_ADD_SUB",
103
          lpm_hint => "ONE_INPUT_IS_CONSTANT=NO"
104
          )
105
        PORT MAP (
106
          dataa   => aa,
107
          add_sub => do_mult_reg,
108
          datab   => bb,
109
          result  => sum
110
          );
111
   end generate; --lpm_adder
112 2 rhoads
 
113 121 rhoads
   -- Negate signals
114
   a_neg_sig <= bv_negate(a);
115
   b_neg_sig <= bv_negate(b);
116
   sign_extend_sig <= do_signed_reg and do_mult_reg;
117
 
118
   -- Result
119
   c_mult <= reg_b(31 downto 0)  when mult_func=mult_read_lo else
120
             reg_b(63 downto 32) when mult_func=mult_read_hi else
121
             ZERO;
122 2 rhoads
 
123
 
124 121 rhoads
   GENERIC_MULT: if MULT_TYPE="GENERIC" generate
125
 
126
   --multiplication/division unit
127
   mult_proc: process(clk, a, b, mult_func,
128
                      do_mult_reg, do_signed_reg, count_reg,
129
                      reg_a, reg_b, answer_reg, sum, reg_a_times3)
130
      variable do_mult_temp   : std_logic;
131
      variable do_signed_temp : std_logic;
132
      variable count_temp     : std_logic_vector(5 downto 0);
133
      variable a_temp         : std_logic_vector(31 downto 0);
134
      variable b_temp         : std_logic_vector(63 downto 0);
135
      variable answer_temp    : std_logic_vector(31 downto 0);
136
      variable start          : std_logic;
137
      variable do_write       : std_logic;
138
      variable do_hi          : std_logic;
139
      variable sign_extend    : std_logic;
140
 
141
   begin
142
      do_mult_temp   := do_mult_reg;
143
      do_signed_temp := do_signed_reg;
144
      count_temp     := count_reg;
145
      a_temp         := reg_a;
146
      b_temp         := reg_b;
147
      answer_temp    := answer_reg;
148
      sign_extend    := do_signed_reg and do_mult_reg;
149
      start          := '0';
150
      do_write       := '0';
151
      do_hi          := '0';
152
 
153
      case mult_func is
154
         when mult_read_lo =>
155
         when mult_read_hi =>
156
            do_hi := '1';
157
         when mult_write_lo =>
158
            do_write := '1';
159
         when mult_write_hi =>
160
            do_write := '1';
161
            do_hi := '1';
162
         when mult_mult =>
163
            start := '1';
164
            do_mult_temp := '1';
165
            do_signed_temp := '0';
166
         when mult_signed_mult =>
167
            start := '1';
168
            do_mult_temp := '1';
169
            do_signed_temp := '1';
170
         when mult_divide =>
171
            start := '1';
172
            do_mult_temp := '0';
173
            do_signed_temp := '0';
174
         when mult_signed_divide =>
175
            start := '1';
176
            do_mult_temp := '0';
177
            do_signed_temp := a(31) xor b(31);
178
         when others =>
179
      end case;
180
 
181
      if start = '1' then
182
         count_temp := "000000";
183
         answer_temp := ZERO;
184
         if do_mult_temp = '0' then
185
            b_temp(63) := '0';
186
            if mult_func /= mult_signed_divide or a(31) = '0' then
187
               a_temp := a;
188
            else
189
               a_temp := a_neg_sig;
190
            end if;
191
            if mult_func /= mult_signed_divide or b(31) = '0' then
192
               b_temp(62 downto 31) := b;
193
            else
194
               b_temp(62 downto 31) := b_neg_sig;
195
            end if;
196
            b_temp(30 downto 0) := ZERO(30 downto 0);
197
         else --multiply
198
            if do_signed_temp = '0' or b(31) = '0' then
199
               a_temp := a;
200
               b_temp(31 downto 0) := b;
201
            else
202
               a_temp := a_neg_sig;
203
               b_temp(31 downto 0) := b_neg_sig;
204
            end if;
205
            b_temp(63 downto 32) := ZERO;
206 99 rhoads
         end if;
207 121 rhoads
      elsif do_write = '1' then
208
         if do_hi = '0' then
209
            b_temp(31 downto 0) := a;
210 2 rhoads
         else
211 121 rhoads
            b_temp(63 downto 32) := a;
212 23 rhoads
         end if;
213 121 rhoads
      end if;
214
 
215
      if do_mult_reg = '0' then  --division
216
         aa <= (reg_a(31) and sign_extend) & (reg_a(31) and sign_extend) & reg_a;
217
         bb <= reg_b(33 downto 0);
218
      else                       --multiplication two-bits at a time
219
         case reg_b(1 downto 0) is
220
            when "00" =>
221
               aa <= "00" & ZERO;
222
            when "01" =>
223
               aa <= (reg_a(31) and sign_extend) & (reg_a(31) and sign_extend) & reg_a;
224
            when "10" =>
225
               aa <= (reg_a(31) and sign_extend) & reg_a & '0';
226
            when others =>
227
               aa <= reg_a_times3;
228
         end case;
229
         bb <= (reg_b(63) and sign_extend) & (reg_b(63) and sign_extend) & reg_b(63 downto 32);
230
      end if;
231
 
232
      if count_reg(5) = '0' and start = '0' then
233
         count_temp := bv_inc6(count_reg);
234
         if do_mult_reg = '0' then          --division
235
            answer_temp(31 downto 1) := answer_reg(30 downto 0);
236
            if reg_b(63 downto 32) = ZERO and sum(32) = '0' then
237
               a_temp := sum(31 downto 0);  --aa=aa-bb;
238
               answer_temp(0) := '1';
239
            else
240
               answer_temp(0) := '0';
241
            end if;
242
            if count_reg /= "011111" then
243
               b_temp(62 downto 0) := reg_b(63 downto 1);
244
            else                            --done with divide
245
               b_temp(63 downto 32) := a_temp;
246
               if do_signed_reg = '0' then
247
                  b_temp(31 downto 0) := answer_temp;
248
               else
249
                  b_temp(31 downto 0) := bv_negate(answer_temp);
250
               end if;
251
            end if;
252
         else  -- mult_mode
253
            b_temp(63 downto 30) := sum;
254
            b_temp(29 downto 0) := reg_b(31 downto 2);
255
            if count_reg = "001000" and sign_extend = '0' and   --early stop
256
               reg_b(15 downto 0) = ZERO(15 downto 0) then
257
               count_temp := "111111";
258
               b_temp(31 downto 0) := reg_b(47 downto 16);
259
            end if;
260
            if count_reg = "000100" and sign_extend = '0' and   --early stop
261
               reg_b(23 downto 0) = ZERO(23 downto 0) then
262
               count_temp := "111111";
263
               b_temp(31 downto 0) := reg_b(55 downto 24);
264
            end if;
265
            count_temp(5) := count_temp(4);
266 2 rhoads
         end if;
267
      end if;
268 121 rhoads
 
269
      if rising_edge(clk) then
270
         do_mult_reg <= do_mult_temp;
271
         do_signed_reg <= do_signed_temp;
272
         count_reg <= count_temp;
273
         reg_a <= a_temp;
274
         reg_b <= b_temp;
275
         answer_reg <= answer_temp;
276
         if start = '1' then
277
            reg_a_times3 <= ((a_temp(31) and do_signed_temp) & a_temp & '0') +
278
                            ((a_temp(31) and do_signed_temp) & (a_temp(31) and do_signed_temp) & a_temp);
279
         end if;
280
      end if;
281
 
282
      if count_reg(5) = '0' and mult_func /= mult_nothing and start = '0' then
283
         pause_out <= '1';
284 2 rhoads
      else
285 121 rhoads
         pause_out <= '0';
286 2 rhoads
      end if;
287 121 rhoads
 
288
   end process;
289 2 rhoads
 
290 121 rhoads
   end generate;
291
 
292
 
293
   AREA_OPTIMIZED_MULT: if MULT_TYPE="AREA_OPTIMIZED" generate
294
   --Xilinx Tristate size optimization by Matthias Gruenewald
295
 
296
   --multiplication/division unit
297
    mult_proc: process(a, b, clk, count_reg, do_mult_reg, do_signed_reg, mult_func, reg_b, sum)
298
      variable do_mult_temp   : std_logic;
299
      variable do_signed_temp : std_logic;
300
      variable count_temp     : std_logic_vector(5 downto 0);
301
      variable start          : std_logic;
302
      variable do_write       : std_logic;
303
      variable do_hi          : std_logic;
304
      variable sign_extend    : std_logic;
305
 
306
    begin
307
      do_mult_temp   := do_mult_reg;
308
      do_signed_temp := do_signed_reg;
309
      count_temp     := count_reg;
310
      sign_extend    := do_signed_reg and do_mult_reg;
311
      sign_extend_sig <= sign_extend;
312
      start          := '0';
313
      do_write       := '0';
314
      do_hi          := '0';
315
      a_select <= (others => '0');
316
      b_select <= (others => '0');
317
      aa_select <= (others => '0');
318
      bb_select <= (others => '0');
319
      answer_select <= (others => '0');
320
 
321
      case mult_func is
322
        when mult_read_lo =>
323
        when mult_read_hi =>
324
          do_hi := '1';
325
        when mult_write_lo =>
326
          do_write := '1';
327
        when mult_write_hi =>
328
          do_write := '1';
329
          do_hi := '1';
330
        when mult_mult =>
331
          start := '1';
332
          do_mult_temp := '1';
333
          do_signed_temp := '0';
334
        when mult_signed_mult =>
335
          start := '1';
336
          do_mult_temp := '1';
337
          do_signed_temp := '1';
338
        when mult_divide =>
339
          start := '1';
340
          do_mult_temp := '0';
341
          do_signed_temp := '0';
342
        when mult_signed_divide =>
343
          start := '1';
344
          do_mult_temp := '0';
345
          do_signed_temp := a(31) xor b(31);
346
        when others =>
347 90 rhoads
      end case;
348 2 rhoads
 
349 121 rhoads
      if start = '1' then
350
        count_temp := "000000";
351
        answer_select(0)<='1';
352
        --answer_temp := ZERO;
353
        if do_mult_temp = '0' then
354
          --b_temp(63) := '0';
355
          if mult_func /= mult_signed_divide or a(31) = '0' then
356
            a_select(0) <= '1';
357
            --a_temp := a;
358
          else
359
            a_select(1) <= '1';
360
            --a_temp := a_neg;
361
          end if;
362
          if mult_func /= mult_signed_divide or b(31) = '0' then
363
            b_select(0) <= '1';
364
            --b_temp(62 downto 31) := b;
365
          else
366
            b_select(1) <= '1';
367
            --b_temp(62 downto 31) := b_neg;
368
          end if;
369
          --b_temp(30 downto 0) := ZERO(30 downto 0);
370
        else --multiply
371
          if do_signed_temp = '0' or b(31) = '0' then
372
            a_select(2) <= '1';
373
            --a_temp := a;
374
            b_select(2) <= '1';
375
            --b_temp(31 downto 0) := b;
376
          else
377
            a_select(3) <= '1';
378
            --a_temp := a_neg;
379
            b_select(3) <= '1';
380
            --b_temp(31 downto 0) := b_neg;
381
          end if;
382
          --b_temp(63 downto 32) := ZERO;
383
        end if;
384
      elsif do_write = '1' then
385
        if do_hi = '0' then
386
          b_select(4) <= '1';
387
          --b_temp(31 downto 0) := a;
388
        else
389
          b_select(5) <= '1';
390
          --b_temp(63 downto 32) := a;
391
        end if;
392
      end if;
393
 
394
      if do_mult_reg = '0' then  --division
395
        aa_select(0) <= '1';
396
        --aa <= (reg_a(31) and sign_extend) & (reg_a(31) and sign_extend) & reg_a;
397
        bb_select(0) <= '1';
398
        --bb <= reg_b(33 downto 0);
399
      else                       --multiplication two-bits at a time
400
        case reg_b(1 downto 0) is
401
          when "00" =>
402
            aa_select(1) <= '1';
403
            --aa <= "00" & ZERO;
404
          when "01" =>
405
            aa_select(2) <= '1';
406
            --aa <= (reg_a(31) and sign_extend) & (reg_a(31) and sign_extend) & reg_a;
407
          when "10" =>
408
            aa_select(3) <= '1';
409
            --aa <= (reg_a(31) and sign_extend) & reg_a & '0';
410
          when others =>
411
            --aa_select(4) <= '1';
412
            --aa <= reg_a_times3;
413
        end case;
414
        bb_select(1) <= '1';
415
        --bb <= (reg_b(63) and sign_extend) & (reg_b(63) and sign_extend) & reg_b(63 downto 32);
416
      end if;
417
 
418
      if count_reg(5) = '0' and start = '0' then
419
        count_temp := bv_inc6(count_reg);
420
        if do_mult_reg = '0' then          --division          
421
          --answer_temp(31 downto 1) := answer_reg(30 downto 0);
422
          if reg_b(63 downto 32) = ZERO and sum(32) = '0' then
423
            a_select(4) <= '1';
424
            --a_temp := sum(31 downto 0);  --aa=aa-bb;
425
            answer_select(1) <= '1';
426
            --answer_temp(0) := '1';
427
          else
428
            answer_select(2) <= '1';
429
            --answer_temp(0) := '0';
430
          end if;
431
          if count_reg /= "011111" then
432
            --b_temp(62 downto 0) := reg_b(63 downto 1);
433
            b_select(6) <= '1';
434
          else                            --done with divide
435
            --b_temp(63 downto 32) := a_temp;
436 23 rhoads
            if do_signed_reg = '0' then
437 121 rhoads
              b_select(7) <= '1';
438
              --b_temp(31 downto 0) := answer_temp;
439 23 rhoads
            else
440 121 rhoads
              b_select(8) <= '1';
441
              --b_temp(31 downto 0) := bv_negate(answer_temp);
442 23 rhoads
            end if;
443 121 rhoads
          end if;
444
        else  -- mult_mode
445
          b_select(9) <= '1';
446
          --b_temp(63 downto 30) := sum;
447
          --b_temp(29 downto 0) := reg_b(31 downto 2);
448
          if count_reg = "001000" and sign_extend = '0' and   --early stop
449
            reg_b(15 downto 0) = ZERO(15 downto 0) then
450 2 rhoads
            count_temp := "111111";
451 121 rhoads
            b_select(10) <= '1';
452
            --b_temp(31 downto 0) := reg_b(47 downto 16);
453
          end if;
454
          if count_reg = "000100" and sign_extend = '0' and   --early stop
455
            reg_b(23 downto 0) = ZERO(23 downto 0) then
456 7 rhoads
            count_temp := "111111";
457 121 rhoads
            b_select(11) <= '1';
458
            --b_temp(31 downto 0) := reg_b(55 downto 24);
459
          end if;
460
          count_temp(5) := count_temp(4);
461
        end if;
462 2 rhoads
      end if;
463
 
464 121 rhoads
      if rising_edge(clk) then
465
        do_mult_reg <= do_mult_temp;
466
        do_signed_reg <= do_signed_temp;
467
        count_reg <= count_temp;
468
        reg_a <= a_temp_sig;
469
        reg_b <= b_temp_sig;
470
        answer_reg <= answer_temp_sig;
471
        if start = '1' then
472
          reg_a_times3 <= ((a_temp_sig(31) and do_signed_temp) & a_temp_sig & '0') +
473
                          ((a_temp_sig(31) and do_signed_temp) & (a_temp_sig(31) and do_signed_temp) & a_temp_sig);
474
        end if;
475 90 rhoads
      end if;
476 2 rhoads
 
477 121 rhoads
      if count_reg(5) = '0' and mult_func/= mult_nothing and start = '0' then
478
        pause_out <= '1';
479
      else
480
        pause_out <= '0';
481
      end if;
482
 
483
    end process;
484 2 rhoads
 
485
 
486 121 rhoads
    -- Arguments
487
    a_msb <= reg_a(31) and sign_extend_sig;
488
    aa <= a_msb & a_msb & reg_a when aa_select(0)='1' else
489
          "00" & ZERO           when aa_select(1)='1' else
490
          a_msb & a_msb & reg_a when aa_select(2)='1' else
491
          a_msb & reg_a & '0'   when aa_select(3)='1' else
492
          reg_a_times3;
493 47 rhoads
 
494 121 rhoads
    b_msb <= reg_b(63) and sign_extend_sig;
495
    bb <= reg_b(33 downto 0)                  when bb_select(0)='1' else (others => 'Z');
496
    bb <= b_msb & b_msb & reg_b(63 downto 32) when bb_select(1)='1' else (others => 'Z');
497 47 rhoads
 
498 121 rhoads
    -- Divide: Init
499
    a_temp_sig <= a                                   when a_select(0)='1' else (others => 'Z');
500
    a_temp_sig <= a_neg_sig                           when a_select(1)='1' else (others => 'Z');
501
    b_temp_sig <= '0' & b & ZERO(30 downto 0)         when b_select(0)='1' else (others => 'Z');
502
    b_temp_sig <= '0' & b_neg_sig & ZERO(30 downto 0) when b_select(1)='1' else (others => 'Z');
503
 
504
    -- Multiply: Init
505
    a_temp_sig <= a                when a_select(2)='1' else (others => 'Z');
506
    b_temp_sig <= ZERO & b         when b_select(2)='1' else (others => 'Z');
507
    a_temp_sig <= a_neg_sig        when a_select(3)='1' else (others => 'Z');
508
    b_temp_sig <= ZERO & b_neg_sig when b_select(3)='1' else (others => 'Z');
509 47 rhoads
 
510 121 rhoads
    -- Intermediate results
511
    b_temp_sig  <= reg_b(63 downto 32) & a when b_select(4)='1' else (others => 'Z');
512
    b_temp_sig  <= a & reg_b(31 downto 0)  when b_select(5)='1' else (others => 'Z');
513
 
514
    -- Divide: Operation
515
    a_temp_sig <= sum(31 downto 0)                        when a_select(4)='1'      else (others => 'Z');
516
    b_temp_sig <= reg_b(63) & reg_b(63 downto 1)          when b_select(6)='1'      else (others => 'Z');
517
    b_temp_sig <= a_temp_sig & answer_temp_sig            when b_select(7)='1'      else (others => 'Z');
518
    b_temp_sig <= a_temp_sig & bv_negate(answer_temp_sig) when b_select(8)='1'      else (others => 'Z');
519
 
520
    -- Multiply: Operation
521
    b_temp_sig <= sum & reg_b(31 downto 2)               when b_select(9)='1' and b_select(10)='0' and b_select(11)='0' else (others => 'Z');
522
    b_temp_sig <= sum(33 downto 2) & reg_b(47 downto 16) when b_select(10)='1'                                          else (others => 'Z');
523
    b_temp_sig <= sum(33 downto 2) & reg_b(55 downto 24) when b_select(11)='1'                                          else (others => 'Z');
524
 
525
    -- Default values
526
    a_temp_sig <= reg_a           when conv_integer(unsigned(a_select))=0 else (others => 'Z');
527
    b_temp_sig <= reg_b           when conv_integer(unsigned(b_select))=0 else (others => 'Z');
528
 
529
    -- Result
530
    answer_temp_sig <= ZERO                          when answer_select(0)='1' else
531
                       answer_reg(30 downto 0) & '1' when answer_select(1)='1' else
532
                       answer_reg(30 downto 0) & '0' when answer_select(2)='1' else
533
                       answer_reg;
534
 
535
  end generate;
536
 
537 2 rhoads
end; --architecture logic
538
 

powered by: WebSVN 2.1.0

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