Sinusoidal signal generation is very important in implementation of many signal or image processing algorithms. For example in order to generate the atoms of Fourier dictionary sinusoidal signal generator is very useful. Sinusoidal signals can be generated either by numerically controlled oscillator (NCO) or by look-up-tables (LUT) or by co-ordinate rotation digital computer (CORDIC). Here, verilog code for CORDIC Based Sine and Cosine Generator is given.
There are certain limitations in generating a sinusoidal signal using NCO or LUT. Like sinusoidal frequency of any frequency can not be generated using NCO. LUT method consumes huge memory space. Thus CORDIC is a very powerful method to compute cosine or sinusoidal signals of any frequency.
The detail theory of CORDIC is discussed in the blog of CORDIC. Sine or cosine of an angle can be computed by CORDIC in rotation mode along the circular path. Initially, and . The required angle is given to input as . After certain iterations the final output is produced as , and .
In the design of CORDIC Based Sine and Cosine Generator, 16-bit data width is used in which 10-bits are reserved for fraction and 6-bits are for integers. The two’s complement data representation is used. There are 14 stages in the CORDIC module. The angles are represented as which is equal to 45 degree. The two bits from MSB side decides the quadrant of the desired angle.
Note that CORDIC Based Sine and Cosine Generator introduces error in every iteration which is truncation error. As the iteration numbers go high, accuracy improves but latency increases. The change of quadrant is not shown in this design but the users are directed to incorporate it in order to get the correct result for every angle.