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

Subversion Repositories mlite

[/] [mlite/] [trunk/] [vhdl/] [mult.vhd] - Diff between revs 97 and 99

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 97 Rev 99
Line 72... Line 72...
   variable answer_temp    : std_logic_vector(31 downto 0);
   variable answer_temp    : std_logic_vector(31 downto 0);
   variable start          : std_logic;
   variable start          : std_logic;
   variable do_write       : std_logic;
   variable do_write       : std_logic;
   variable do_hi          : std_logic;
   variable do_hi          : std_logic;
   variable sign_extend    : std_logic;
   variable sign_extend    : std_logic;
 
   variable a_neg          : std_logic_vector(31 downto 0);
 
   variable b_neg          : std_logic_vector(31 downto 0);
 
 
begin
begin
   do_mult_temp   := do_mult_reg;
   do_mult_temp   := do_mult_reg;
   do_signed_temp := do_signed_reg;
   do_signed_temp := do_signed_reg;
   count_temp     := count_reg;
   count_temp     := count_reg;
Line 101... Line 103...
      do_mult_temp := '1';
      do_mult_temp := '1';
      do_signed_temp := '0';
      do_signed_temp := '0';
   when mult_signed_mult =>
   when mult_signed_mult =>
      start := '1';
      start := '1';
      do_mult_temp := '1';
      do_mult_temp := '1';
      do_signed_temp := a(31) xor b(31);
      do_signed_temp := '1';
   when mult_divide =>
   when mult_divide =>
      start := '1';
      start := '1';
      do_mult_temp := '0';
      do_mult_temp := '0';
      do_signed_temp := '0';
      do_signed_temp := '0';
   when mult_signed_divide =>
   when mult_signed_divide =>
Line 116... Line 118...
   end case;
   end case;
 
 
   if start = '1' then
   if start = '1' then
      count_temp := "000000";
      count_temp := "000000";
      answer_temp := ZERO;
      answer_temp := ZERO;
 
      a_neg := bv_negate(a);
 
      b_neg := bv_negate(b);
      if do_mult_temp = '0' then
      if do_mult_temp = '0' then
         b_temp(63) := '0';
         b_temp(63) := '0';
         if mult_func /= mult_signed_divide or b(31) = '0' then
 
            b_temp(62 downto 31) := b;
 
         else
 
            b_temp(62 downto 31) := bv_negate(b);
 
         end if;
 
         if mult_func /= mult_signed_divide or a(31) = '0' then
         if mult_func /= mult_signed_divide or a(31) = '0' then
            a_temp := a;
            a_temp := a;
         else
         else
            a_temp := bv_negate(a);
            a_temp := a_neg;
 
         end if;
 
         if mult_func /= mult_signed_divide or b(31) = '0' then
 
            b_temp(62 downto 31) := b;
 
         else
 
            b_temp(62 downto 31) := b_neg;
         end if;
         end if;
         b_temp(30 downto 0) := ZERO(30 downto 0);
         b_temp(30 downto 0) := ZERO(30 downto 0);
      else --multiply
      else --multiply
 
         if do_signed_temp = '0' or b(31) = '0' then
         a_temp := a;
         a_temp := a;
         b_temp := ZERO & b;
            b_temp(31 downto 0) := b;
 
         else
 
            a_temp := a_neg;
 
            b_temp(31 downto 0) := b_neg;
 
         end if;
 
         b_temp(63 downto 32) := ZERO;
      end if;
      end if;
   elsif do_write = '1' then
   elsif do_write = '1' then
      if do_hi = '0' then
      if do_hi = '0' then
         b_temp(31 downto 0) := a;
         b_temp(31 downto 0) := a;
      else
      else
Line 203... Line 213...
      count_reg <= count_temp;
      count_reg <= count_temp;
      reg_a <= a_temp;
      reg_a <= a_temp;
      reg_b <= b_temp;
      reg_b <= b_temp;
      answer_reg <= answer_temp;
      answer_reg <= answer_temp;
      if start = '1' then
      if start = '1' then
         reg_a_times3 <= ((a(31) and do_signed_temp) & a & '0') +
         reg_a_times3 <= ((a_temp(31) and do_signed_temp) & a_temp & '0') +
            ((a(31) and do_signed_temp) & (a(31) and do_signed_temp) & a);
            ((a_temp(31) and do_signed_temp) & (a_temp(31) and do_signed_temp) & a_temp);
      end if;
      end if;
   end if;
   end if;
 
 
   if count_reg(5) = '0' and mult_func/= mult_nothing and start = '0' then
   if count_reg(5) = '0' and mult_func/= mult_nothing and start = '0' then
      pause_out <= '1';
      pause_out <= '1';

powered by: WebSVN 2.1.0

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