URL
https://opencores.org/ocsvn/cordic/cordic/trunk
Subversion Repositories cordic
[/] [cordic/] [web_uploads/] [index.shtml] - Rev 14
Compare with Previous | Blame | View Log
<!--# set var="title" value="CORDIC Core" --> <!--# include virtual="/ssi/ssi_start.shtml" --> <BODY> <B><FONT FACE="Helvetica,Arial" SIZE=+2 COLOR="#bf0000">Project Name: CORDIC core<BR> (COordinate Rotation on a DIgital Computer)</B></FONT> </P> <B><U><FONT SIZE=4><P>Description</B></U></FONT> </P> <P>The CORDIC algorithm is an iterative algorithm to evaluate many mathematical functions, such as trigonometrically functions, hyperbolic functions and planar rotations.</P> <B><U><FONT SIZE=4><P>Core Description</B></U></FONT> </P> <P>As the name suggests the CORDIC algorithm was developed for rotating coordinates, a piece of hardware for doing real-time navigational computations in the 1950's. The CORDIC uses a sequence like successive approximation to reach its results. The nice part is it does this by adding/subtracting and shifting only.<BR> <BR> Suppose we want to rotate a point(X,Y) by an angle(Z). The coordinates for the new point(Xnew, Ynew) are:</P><DIR> <P>Xnew = X * cos(Z) - Y * sin(Z)<BR> Ynew = Y * cos(Z) + X * sin(Z)</P></DIR> <P>Or rewritten:</P><DIR> <P>Xnew / cos(Z) = X - Y * tan(Z)<BR> Ynew / cos(Z) = Y + X * tan(Z)</P></DIR> <P>It is possible to break the angle into small pieces, such that the tangents of these pieces are always a power of 2. This results in the following equations: </P><DIR> <P>X(n+1) = P(n) * ( X(n) - Y(n) / 2^n)<BR> Y(n+1) = P(n) * ( Y(n) + X(n) / 2^n)<BR> Z(n) = atan(1/2^n)</P></DIR> <P>The atan(1/2^n) has to be pre-computed, because the algorithm uses it to approximate the angle. The P(n) factor can be eliminated from the equations by pre-computing its final result. If we multiply all P(n)'s together we get the aggregate constant.</P><DIR> <P>P = cos(atan(1/2^0)) * cos(atan(1/2^1)) * cos(atan(1/2^2))....cos(atan(1/2^n)) </P></DIR> <P>This is a constant which reaches 0.607... Depending on the number of iterations and the number of bits used. The final equations look like this:</P><DIR> <P>Xnew = 0.607... * sum( X(n) - Y(n) / 2^n)<BR> Ynew = 0.607... * sum( Y(n) + X(n) / 2^n)</P></DIR> <P>Now it is clear how we can simply implement this algorithm, it only uses shifts and adds/subs. Or in a program-like style:</P> <DIR> <P>For i=0 to n-1<DIR> <P>If (Z(n) >= 0) then<DIR> <P>X(n + 1) := X(n) – (Yn/2^n);<BR> Y(n + 1) := Y(n) + (Xn/2^n);<BR> Z(n + 1) := Z(n) – atan(1/2^i);</P></DIR> <P>Else</P><DIR> <P>X(n + 1) := X(n) + (Yn/2^n);<BR> Y(n + 1) := Y(n) – (Xn/2^n);<BR> Z(n + 1) := Z(n) + atan(1/2^i);</P></DIR> <P>End if;</P></DIR> <P>End for;</P></DIR> </DIR> <P>Where 'n' represents the number of iterations.</P> <P> </P> <B><U><FONT SIZE=4><P>Implementation:</B></U></FONT> </P><DIR> <P>See the on-line <A HREF="cordic.pdf">documentation</A> for more information about the available CORDIC cores.</P> <P> </P></DIR> <B><U><FONT SIZE=4><P>Current Status:</B></U></FONT> </P> <UL> <LI>Design is available in VHDL from OpenCores CVS via <A HREF="http://www.opencores.org/cvsweb.shtml/">cvsweb</A> or via <A HREF="http://www.opencores.org/cvsmodule.shtml">cvsget</A> </LI> <LI>ToDo: finish documentation</LI></UL> <P> </P> <B><U><FONT SIZE=4><P>Synthesis:</B></U></FONT> </P> <P>Synthesis using Leonard Spectrum VHDL compiler and Altera Max+PlusII:<BR> - Altera ACEX(EP1K50-1): 2190lcells@68MHz</P> <P>Synthesis using Xilinx WebPack v3.2:<BR> - Spartan-II (XC2S100-6): 704SLICES@93MHz </P> <P> </P> <B><U><FONT SIZE=4><P>Author & Maintainer(s):</B></U></FONT> </P><DIR> <P><A HREF="mailto:rherveille@opencores.org_NOSPAM">Richard Herveille</A></P> <P> </P></DIR> <B><U><FONT SIZE=4><P>Mailing-list:</B></U></FONT> </P><DIR> <P><A HREF="mailto:cores@opencores.org_NOSPAM">cores@opencores.org_NOSPAM</A></P></DIR> <P> </BODY> <!--# include virtual="/ssi/ssi_end.shtml" -->