+ Post New Thread
Page 2 of 2 FirstFirst 1 2
Results 21 to 23 of 23
  1. #21
    Advanced Member level 5
    Points: 33,436, Level: 44
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,124
    Helped
    1790 / 1790
    Points
    33,436
    Level
    44

    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



    •   Alt7th February 2011, 13:09

      advertising

        
       

  2. #22
    Junior Member level 3
    Points: 497, Level: 4

    Join Date
    Oct 2010
    Posts
    26
    Helped
    1 / 1
    Points
    497
    Level
    4

    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?



    •   Alt7th February 2011, 16:30

      advertising

        
       

  3. #23
    Advanced Member level 5
    Points: 33,436, Level: 44
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,124
    Helped
    1790 / 1790
    Points
    33,436
    Level
    44

    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)



--[[ ]]--