User Tools

Site Tools


projects:cordic_algorithm

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
projects:cordic_algorithm [2013/12/19 22:45]
cbarnes
projects:cordic_algorithm [2013/12/19 22:49]
cbarnes
Line 18: Line 18:
 Finally, I was ready (or at least, as ready as I ever would be) to make CORDIC in verilog. Fortunately,​ people had done similar things and shared their work on the internet, so even though I am on a team by myself, I certainly didn't have no help. I started by making the simple module, defining x, y, and angle inputs and sine/cosine outputs. ​ Finally, I was ready (or at least, as ready as I ever would be) to make CORDIC in verilog. Fortunately,​ people had done similar things and shared their work on the internet, so even though I am on a team by myself, I certainly didn't have no help. I started by making the simple module, defining x, y, and angle inputs and sine/cosine outputs. ​
  
-Then I had to produce a 31-entry long table of atan values to be my look-up-table. Each value in the table is equivalent to atan(2<​sup>​-i</​sup>​) where i starts at 0 and ends at 30. But, to create a 32-bit scaled value so that all the unsigned, fixed-point arithmetic would work out, every value was multiplied by 2<​sup>​32</​sup>​ and divided by 360. Thus the atan table was created. {{ :​projects:​atan_table2.png?​500 |}}+Then I had to produce a 31-entry long table of atan values to be my look-up-table. Each value in the table is equivalent to atan(2<​sup>​-i</​sup>​) where i starts at 0 and ends at 30. But, to create a 32-bit scaled value so that all the unsigned, fixed-point arithmetic would work out, every value was multiplied by 2<​sup>​32</​sup>​ and divided by 360. Thus the atan table was created. {{ :​projects:​atan_table2.png?​700 |}}
  
-The CORDIC algorithm only works for values between -90 and 90 degrees. This is why my next step was to check if these conditions were true, and make the necessary changes if not. Because of the way I scaled the angles, I could simply check the leading 2 bits to see what quadrant the angle was in. PICTURE+The CORDIC algorithm only works for values between -90 and 90 degrees. This is why my next step was to check if these conditions were true, and make the necessary changes if not. Because of the way I scaled the angles, I could simply check the leading 2 bits to see what quadrant the angle was in. {{ :​projects:​quadrant.png?​700 |}}
  
-The last part was to finally implement the meat of the CORDIC algorithm where all the iterations take place that produce cosine and sine values. The number of iterations that need to be implemented depends on how many bits wide the input is. Since my inputs were 16-bits wide, I only needed 16 iterations before I wouldn'​t be getting any more precision. So the entire algorithm is contained in a for loop that goes though, assigns the bit-shifted X and Y variables of the current iteration, finds the sign of the current Z angle, then calculates the next values of X, Y, and Z. PICTURE+The last part was to finally implement the meat of the CORDIC algorithm where all the iterations take place that produce cosine and sine values. The number of iterations that need to be implemented depends on how many bits wide the input is. Since my inputs were 16-bits wide, I only needed 16 iterations before I wouldn'​t be getting any more precision. So the entire algorithm is contained in a for loop that goes though, assigns the bit-shifted X and Y variables of the current iteration, finds the sign of the current Z angle, then calculates the next values of X, Y, and Z. {{ :​projects:​cordic.png?​700 |}}
  
  
projects/cordic_algorithm.txt ยท Last modified: 2013/12/19 23:19 by cbarnes