# How to create lookup table for sin(4(pi)x) in VHDL?

1. ## Re: How to create lookup table for sin(4(pi)x) in VHDL?

It will depend what the max and min values are. If you need range -4 to almost +4, you already need 3 bits of integer. So to make up the other 5 you multiply your number by 2^5 = 32.
on paper, multiply by 32 and get rid of any remaining fractional bits.

so here, -3.9688 = -127 = 10000001. So in reality the number is 100.000001.

Inside in FPGA there is no need for any multiplying. 10000001 in 3.5 fixed point represents -3.9688

•

2. ## Re: How to create lookup table for sin(4(pi)x) in VHDL?

-3 for binary value is 111 and for .9688 of binary value is 11111, So the answer is 111.11111, is it correct ? How did calculate? How -3.9688 is equal to -127?

•

3. ## Re: How to create lookup table for sin(4(pi)x) in VHDL?

-3 binary value is 101.00000, not 111.000000 (-1). This is 2's compliment notation (to find a -ve number, take the +ve number, invert the bits and add 1)

0.9688 is 000.11111. But we want -0.9688, which is 111.00001.

So we have -3 - 0.9688 = 101.00000 + 111.00001 = 100.00001 = -127 (without the point)

--[[ ]]--