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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [core/] [neorv32_cpu_cp_muldiv.vhd] - Diff between revs 3 and 4

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

Rev 3 Rev 4
Line 109... Line 109...
      -- FSM --
      -- FSM --
      case state is
      case state is
        when IDLE =>
        when IDLE =>
          opx   <= rs1_i;
          opx   <= rs1_i;
          opy   <= rs2_i;
          opy   <= rs2_i;
          if (ctrl_i(ctrl_cp_use_c) = '1') and (ctrl_i(ctrl_cp_id_msb_c downto ctrl_cp_id_lsb_c) = cp_sel_muldiv_c) then
 
            cp_op <= ctrl_i(ctrl_cp_cmd2_c downto ctrl_cp_cmd0_c);
            cp_op <= ctrl_i(ctrl_cp_cmd2_c downto ctrl_cp_cmd0_c);
 
          if (ctrl_i(ctrl_cp_use_c) = '1') and (ctrl_i(ctrl_cp_id_msb_c downto ctrl_cp_id_lsb_c) = cp_sel_muldiv_c) then
            state <= DECODE;
            state <= DECODE;
          end if;
          end if;
 
 
        when DECODE =>
        when DECODE =>
 
          cnt <= "11111";
          if (cp_op = cp_op_div_c) or (cp_op = cp_op_rem_c) then -- result sign compensation for div?
          if (cp_op = cp_op_div_c) or (cp_op = cp_op_rem_c) then -- result sign compensation for div?
            div_res_corr <= opx(opx'left) xor opy(opy'left);
            div_res_corr <= opx(opx'left) xor opy(opy'left);
          else
          else
            div_res_corr <= '0';
            div_res_corr <= '0';
          end if;
          end if;
          cnt <= "11111";
 
          if (operation = '1') then -- division
          if (operation = '1') then -- division
            state <= INIT_OPX;
            state <= INIT_OPX;
          else -- multiplication
          else -- multiplication
            start <= '1';
            start <= '1';
            state <= PROCESSING;
            state <= PROCESSING;
Line 183... Line 183...
      end if;
      end if;
    end if;
    end if;
  end process multiplier_core;
  end process multiplier_core;
 
 
  -- MUL: do another addition --
  -- MUL: do another addition --
  mul_update: process(mul_product, mul_sign_cycle, mul_p_sext, opy_is_signed, opx)
  mul_update: process(mul_product, mul_sign_cycle, mul_p_sext, opx_is_signed, opx)
  begin
  begin
    if (mul_product(0) = '1') then
    if (mul_product(0) = '1') then
      if (mul_sign_cycle = '1') then -- for signed operation only: take care of negative weighted MSB
      if (mul_sign_cycle = '1') then -- for signed operation only: take care of negative weighted MSB
        mul_do_add <= std_ulogic_vector(unsigned(mul_p_sext & mul_product(63 downto 32)) - unsigned((opx(opy'left) and opx_is_signed) & opx));
        mul_do_add <= std_ulogic_vector(unsigned(mul_p_sext & mul_product(63 downto 32)) - unsigned((opx(opy'left) and opx_is_signed) & opx));
      else
      else

powered by: WebSVN 2.1.0

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