vhdl code to calculate sine using cordic
for small table of sines/cosines you can use look-up table, for values more precise you can use CORDIC.
CORDIC is very simple in fact, if you take any complex number, let it be overal length of 1, then if you multiply with another complex number with length 1 then you in fact just rotates the first one.
for example take Z*e^ia where a is angle (let it be 0) and i is SQRT(-1);imaginary unit and Z is nonzero constant. this is complex number laying on real axe (cos a + i sin a)-Euler's rule.
then if you multiply it with e^ib, where b is also angle (nonzero for example), you get
Z*e^î(a+b). as you see you have rotated vector Z around center for angle b. :idea:
with this in mind you can make sin/cos generator (but you need very small look table - very eficient method is by principle of succesive aproximation). the resut is precise as you want it
Use pipeline multiplier, becouse you need four multipliers (if' it's pipelined, you can multiplex imput data and then demultiplex result)