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

Subversion Repositories neorv32

[/] [neorv32/] [trunk/] [rtl/] [core/] [neorv32_cpu_cp_muldiv.vhd] - Diff between revs 19 and 22

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

Rev 19 Rev 22
Line 66... Line 66...
 
 
  -- advanced configuration --
  -- advanced configuration --
  constant dsp_add_reg_stage_c : boolean := false; -- add another register stage to DSP-based multiplication for timing-closure
  constant dsp_add_reg_stage_c : boolean := false; -- add another register stage to DSP-based multiplication for timing-closure
 
 
  -- controller --
  -- controller --
  type state_t is (IDLE, DECODE, INIT_OPX, INIT_OPY, PROCESSING, FINALIZE, COMPLETED);
  type state_t is (IDLE, DECODE, INIT_OPX, INIT_OPY, PROCESSING, FINALIZE, COMPLETED, FAST_MUL);
  signal state         : state_t;
  signal state         : state_t;
  signal cnt           : std_ulogic_vector(4 downto 0);
  signal cnt           : std_ulogic_vector(4 downto 0);
  signal cp_op         : std_ulogic_vector(2 downto 0); -- operation to execute
  signal cp_op         : std_ulogic_vector(2 downto 0); -- operation to execute
  signal start         : std_ulogic;
  signal start         : std_ulogic;
  signal operation     : std_ulogic;
  signal operation     : std_ulogic;
Line 143... Line 143...
            opy_is_zero <= '1';
            opy_is_zero <= '1';
          else
          else
            opy_is_zero <= '0';
            opy_is_zero <= '0';
          end if;
          end if;
          --
          --
          if (operation = '1') then -- division
 
            cnt   <= "11111";
            cnt   <= "11111";
 
          if (operation = '1') then -- division
            state <= INIT_OPX;
            state <= INIT_OPX;
          else -- multiplication
          else -- multiplication
            if (FAST_MUL_EN = false) then
 
              cnt <= "11111";
 
            else
 
              cnt <= "00001";
 
            end if;
 
            start <= '1';
            start <= '1';
 
            if (FAST_MUL_EN = true) then
 
              state <= FAST_MUL;
 
            else
            state <= PROCESSING;
            state <= PROCESSING;
          end if;
          end if;
 
          end if;
 
 
        when INIT_OPX =>
        when INIT_OPX =>
          if ((opx(opx'left) and opx_is_signed) = '1') then -- signed division?
          if ((opx(opx'left) and opx_is_signed) = '1') then -- signed division?
            opx <= div_sign_comp; -- make positive
            opx <= div_sign_comp; -- make positive
          end if;
          end if;
Line 175... Line 174...
          cnt <= std_ulogic_vector(unsigned(cnt) - 1);
          cnt <= std_ulogic_vector(unsigned(cnt) - 1);
          if (cnt = "00000") then
          if (cnt = "00000") then
            state <= FINALIZE;
            state <= FINALIZE;
          end if;
          end if;
 
 
 
        when FAST_MUL =>
 
          state <= FINALIZE;
 
 
        when FINALIZE =>
        when FINALIZE =>
          state <= COMPLETED;
          state <= COMPLETED;
 
 
        when COMPLETED =>
        when COMPLETED =>
          valid_o <= '1';
          valid_o <= '1';

powered by: WebSVN 2.1.0

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