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

Subversion Repositories yac

[/] [yac/] [trunk/] [rtl/] [vhdl/] [cordic_iterative_int.vhd] - Diff between revs 2 and 3

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

Rev 2 Rev 3
Line 90... Line 90...
 
 
   constant MAX_A_WIDTH : natural := 34;
   constant MAX_A_WIDTH : natural := 34;
 
 
   -- Internal angle width
   -- Internal angle width
   constant A_WIDTH_I : natural := A_WIDTH+2;
   constant A_WIDTH_I : natural := A_WIDTH+2;
 
<<<<<<< HEAD
 
 
 
 
   constant SQRT2_REAL  : real    := 1.4142135623730951454746218587388284504413604;
   constant SQRT2_REAL  : real    := 1.4142135623730951454746218587388284504413604;
   constant PI_REAL     : real    := 3.1415926535897931159979634685441851615905762;
   constant PI_REAL     : real    := 3.1415926535897931159979634685441851615905762;
   constant PI          : integer := natural( PI_REAL    * real( 2**( A_WIDTH-1 ) ) + 0.5 );
   constant PI          : integer := natural( PI_REAL    * real( 2**( A_WIDTH-1 ) ) + 0.5 );
   constant PI_H        : integer := natural( PI_REAL    * real( 2**( A_WIDTH-2 ) ) + 0.5 );
   constant PI_H        : integer := natural( PI_REAL    * real( 2**( A_WIDTH-2 ) ) + 0.5 );
   constant SQRT2       : integer := natural( SQRT2_REAL * real( 2**( XY_WIDTH-1 ) ) + 0.5 );
   constant SQRT2       : integer := natural( SQRT2_REAL * real( 2**( XY_WIDTH-1 ) ) + 0.5 );
   constant XY_MAX      : integer := natural( 2**( XY_WIDTH-1)-1);
   constant XY_MAX      : integer := natural( 2**( XY_WIDTH-1)-1);
 
 
 
=======
 
 
 
   constant PI_REAL : real    := 3.1415926535897931159979634685441851615905762;
 
   constant PI      : integer := natural( PI_REAL * real( 2**( A_WIDTH-1 ) ) + 0.5 );
 
   constant PI_H    : integer := natural( PI_REAL * real( 2**( A_WIDTH-2 ) ) + 0.5 );
 
>>>>>>> initial commit
 
 
   constant XY_WIDTH_G : natural := XY_WIDTH + GUARD_BITS;
   constant XY_WIDTH_G : natural := XY_WIDTH + GUARD_BITS;
 
 
 
 
 
 
Line 222... Line 229...
               state.x        <= resize( signed( x_i ), state.x'length );
               state.x        <= resize( signed( x_i ), state.x'length );
               state.y        <= resize( signed( y_i ), state.y'length );
               state.y        <= resize( signed( y_i ), state.y'length );
               state.a        <= resize( signed( a_i ), state.a'length );
               state.a        <= resize( signed( a_i ), state.a'length );
               state.i        <= ( others => '0' );
               state.i        <= ( others => '0' );
 
 
 
<<<<<<< HEAD
            elsif state.st = ST_INIT then
            elsif state.st = ST_INIT then
               -- 
               -- 
               -- initialization state
               -- initialization state
               --    -> do initial rotation (alignment)
               --    -> do initial rotation (alignment)
               --    -> check special situations / miss-configurations (TODO)
               --    -> check special situations / miss-configurations (TODO)
               --
               --
 
 
 
=======
 
            -- 
 
            -- initialization state
 
            --    -> do initial rotation (alignment)
 
            --    -> check special situations / miss-configurations (TODO)
 
            --
 
            elsif state.st = ST_INIT then
 
>>>>>>> initial commit
               state.st       <= ST_ROTATE;
               state.st       <= ST_ROTATE;
               state.do_shift <= '1';
               state.do_shift <= '1';
 
 
 
 
 
<<<<<<< HEAD
               if state.mode( 1 downto 0 ) = VAL_MODE_HYP then
               if state.mode( 1 downto 0 ) = VAL_MODE_HYP then
                  -- if we do a hyperbolic rotation, we start with 1
                  -- if we do a hyperbolic rotation, we start with 1
 
=======
 
               -- if we do a hyperbolic rotation, we start with 1
 
               if state.mode( 1 downto 0 ) = VAL_MODE_HYP then
 
>>>>>>> initial commit
                  state.i(0) <= '1';
                  state.i(0) <= '1';
               end if;
               end if;
 
 
 
 
 
 
 
 
 
<<<<<<< HEAD
               if     state.mode( I_FLAG_VEC_ROT ) = '0'
               if     state.mode( I_FLAG_VEC_ROT ) = '0'
                  and state.mode( 1 downto 0 )   =  VAL_MODE_CIR  then
                  and state.mode( 1 downto 0 )   =  VAL_MODE_CIR  then
                  -- circular vector mode
                  -- circular vector mode
 
 
                  if state.a < - PI_H then
                  if state.a < - PI_H then
Line 252... Line 274...
                     state.a <= state.a + PI;
                     state.a <= state.a + PI;
                     state.x <= - state.x;
                     state.x <= - state.x;
                     state.y <= - state.y;
                     state.y <= - state.y;
                  elsif state.a > PI_H then
                  elsif state.a > PI_H then
                     -- move from second quadrant to fourth
                     -- move from second quadrant to fourth
 
=======
 
               -- circular vector mode
 
               if     state.mode( FLAG_VEC_ROT ) = '0'
 
                  and state.mode( 1 downto 0 )   =  VAL_MODE_CIR  then
 
 
 
                  -- move from third quadrant to first
 
                  if state.a < - PI_H then
 
                     state.a <= state.a + PI;
 
                     state.x <= - state.x;
 
                     state.y <= - state.y;
 
                  -- move from second quadrant to fourth
 
                  elsif state.a > PI_H then
 
>>>>>>> initial commit
                     state.a <= state.a - PI;
                     state.a <= state.a - PI;
                     state.x <= - state.x;
                     state.x <= - state.x;
                     state.y <= - state.y;
                     state.y <= - state.y;
                  end if;
                  end if;
 
 
 
<<<<<<< HEAD
               elsif   state.mode( I_FLAG_VEC_ROT ) = '1'
               elsif   state.mode( I_FLAG_VEC_ROT ) = '1'
                   and state.mode( 1 downto 0 )   = VAL_MODE_CIR then
                   and state.mode( 1 downto 0 )   = VAL_MODE_CIR then
                  -- circular rotation mode
                  -- circular rotation mode
 
 
                  if state.x = 0 and state.y = 0 then
                  if state.x = 0 and state.y = 0 then
Line 326... Line 362...
                  if state.x < 0 then
                  if state.x < 0 then
                     state.x <= - state.x;
                     state.x <= - state.x;
                     state.y <= - state.y;
                     state.y <= - state.y;
                  end if;
                  end if;
                  state.a <= to_signed( 0, state.a'length );
                  state.a <= to_signed( 0, state.a'length );
 
=======
 
               -- circular rotation mode
 
               elsif   state.mode( FLAG_VEC_ROT ) = '1'
 
                   and state.mode( 1 downto 0 )   = VAL_MODE_CIR then
 
 
 
                  -- move from second quadrant to fourth
 
                  if state.x < 0 and state.y > 0 then
 
                     state.x <= - state.x;
 
                     state.y <= - state.y;
 
                     state.a <= to_signed(  PI, state.a'length );
 
                  -- move from third quadrant to first
 
                  elsif state.x < 0 and state.y < 0 then
 
                     state.x <= - state.x;
 
                     state.y <= - state.y;
 
                     state.a <= to_signed( -PI, state.a'length );
 
                  -- y=0 condition
 
                  elsif state.x < 0 and state.y = 0 then
 
                     state.a <= to_signed( PI, state.a'length );
 
                     state.st<= ST_DONE;
 
                  else
 
                     state.a <= ( others => '0' );
 
                  end if;
 
               -- linear rotation mode
 
               elsif   state.mode( FLAG_VEC_ROT ) = '1'
 
                   and state.mode( 1 downto 0 )   = VAL_MODE_LIN then
 
 
 
                     if state.x < 0 then
 
                        state.x <= - state.x;
 
                        state.y <= - state.y;
 
                     end if;
 
                     state.a <= to_signed( 0, state.a'length );
 
>>>>>>> initial commit
 
 
               end if;
               end if;
 
 
 
 
 
 
Line 346... Line 414...
            --
            --
            --
            --
            elsif state.st = ST_ROTATE then
            elsif state.st = ST_ROTATE then
 
 
               -- get the sign
               -- get the sign
 
<<<<<<< HEAD
               if state.mode( I_FLAG_VEC_ROT )  = '0' then
               if state.mode( I_FLAG_VEC_ROT )  = '0' then
 
=======
 
               if state.mode( FLAG_VEC_ROT )  = '0' then
 
>>>>>>> initial commit
                  if state.a < 0 then
                  if state.a < 0 then
                     sign := '0';
                     sign := '0';
                  else
                  else
                     sign := '1';
                     sign := '1';
                  end if;
                  end if;
Line 415... Line 487...
 
 
                  end if;
                  end if;
                  state.do_shift <= '0';
                  state.do_shift <= '0';
 
 
                  -- abort condition
                  -- abort condition
 
<<<<<<< HEAD
                  if(   state.mode( I_FLAG_VEC_ROT ) = '0' and
                  if(   state.mode( I_FLAG_VEC_ROT ) = '0' and
                        state.a = 0 ) then
                        state.a = 0 ) then
                     state.st <= ST_RM_GAIN;
                     state.st <= ST_RM_GAIN;
                     state.i  <= ( others => '0' );
                     state.i  <= ( others => '0' );
                  elsif(   state.mode( I_FLAG_VEC_ROT ) = '0' and
                  elsif(   state.mode( I_FLAG_VEC_ROT ) = '0' and
Line 428... Line 501...
                  elsif(   state.mode( I_FLAG_VEC_ROT ) = '1' and
                  elsif(   state.mode( I_FLAG_VEC_ROT ) = '1' and
                        state.y = 0 ) then
                        state.y = 0 ) then
                     state.st <= ST_RM_GAIN;
                     state.st <= ST_RM_GAIN;
                     state.i  <= ( others => '0' );
                     state.i  <= ( others => '0' );
                  elsif(   state.mode( I_FLAG_VEC_ROT ) = '1' and
                  elsif(   state.mode( I_FLAG_VEC_ROT ) = '1' and
 
=======
 
                  if(   state.mode( FLAG_VEC_ROT ) = '0' and
 
                        ( state.a = 0 or state.a = -1 ) ) then
 
                     state.st <= ST_RM_GAIN;
 
                     state.i  <= ( others => '0' );
 
                  elsif(   state.mode( FLAG_VEC_ROT ) = '0' and
 
                        ( state.a = state.alst ) ) then
 
                     state.st <= ST_RM_GAIN;
 
                     state.i  <= ( others => '0' );
 
                  elsif(   state.mode( FLAG_VEC_ROT ) = '1' and
 
                        ( state.y = 0 or state.y = -1 ) ) then
 
                     state.st <= ST_RM_GAIN;
 
                     state.i  <= ( others => '0' );
 
                  elsif(   state.mode( FLAG_VEC_ROT ) = '1' and
 
>>>>>>> initial commit
                        ( state.y = state.ylst ) ) then
                        ( state.y = state.ylst ) ) then
                     state.st <= ST_RM_GAIN;
                     state.st <= ST_RM_GAIN;
                     state.i  <= ( others => '0' );
                     state.i  <= ( others => '0' );
                  end if;
                  end if;
 
 

powered by: WebSVN 2.1.0

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