Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Honored Contributor I
2,243 Views

Is There A Megafunction For Arctan ?

hi everyone, 

 

is there any megafunctşon that implements arctan ? 

 

is there anyone know about this? 

 

thanks..
0 Kudos
26 Replies
Highlighted
Honored Contributor I
5 Views

 

--- Quote Start ---  

Writing an integer equivalent for the arctan() function as given in the ieee_math_real is not that difficult. 

--- Quote End ---  

 

Thinking about this again, and the fact that Quartus only synthesizes real during "compile time" to generate LUTs and doesn't support varying reals during runtime, I think yes, writing an integer equivalent of arctan() would be the way to go. 

 

Do post it up when it's ready... :) Probably they might just include it in the next revision of VHDL. ;)
0 Kudos
Highlighted
Honored Contributor I
5 Views

As with any mathematical or signal processing problem, the intended value range and accuracy should be known to decide about a suitable number format. Fixed point ("integer") or floating point (either using IEEE standard or a user specific format) are possible as well. 

 

Personaly I would try a CORDIC implementation, as suggested.
0 Kudos
Highlighted
Honored Contributor I
5 Views

Hi, 

 

In ALTFP_ATAN core, I couldn't change data input and output width, it is 32 and 34 bits respectively. Is it unchangable or do I have something wrong? I want to use 16 bit width input and output. I also attached the screenshot of MegaWizard Plug-In Manager. 

 

Thanks in advance.. 

 

 

http://www.alteraforum.com/forum/attachment.php?attachmentid=10924&stc=1
0 Kudos
Highlighted
Honored Contributor I
5 Views

Hi, 

 

I want to use "ALTFP_ATAN" MegaWizard Plug-In MAnager for FM demodulation to get the phase diffrence of signal. In this core the width of input and output is 32 and 34 with respectively. I want to use 16 bit width both of them but ı couldn't change the bit width. I also attached the screen shot of MegaWizard Plug-In MAnager. Are these values unchangable? 

https://www.alteraforum.com/forum/attachment.php?attachmentid=10925
0 Kudos
Highlighted
Honored Contributor I
5 Views

ALTFP_ATAN has fixed bitwidth because it's using float number format. I believe you want fixed point atan algogorithm.  

 

You can use ALTFP_ATAN, but have to convert fixed point to float and vice-versa.
0 Kudos
Highlighted
Honored Contributor I
5 Views

@Demirayar. I also understand that you want to calculate arctan(x) using fixed point inputs x that is 16 bit wide. You have 2^16 possible inputs and 2^16 possible outputs.  

First of all note that your function is symmetric w.r.t. 0. Hence you need to calclaute it only for x>0. This simplifies the work. 

 

I suggest to use a look up table that store coarse values (as a an example 2^10 values that are the exact values when the 6 LSB of your input are zero). To get the final value interpolate between two adjacent points. Note that your function is quite linear around zero and almost flat far from zero. it should be easy to approximate.
0 Kudos
Highlighted
Honored Contributor I
5 Views

 

--- Quote Start ---  

I suggest to use a look up table that store coarse values (as a an example 2^10 values that are the exact values when the 6 LSB of your input are zero). To get the final value interpolate between two adjacent points. Note that your function is quite linear around zero and almost flat far from zero. it should be easy to approximate. 

--- Quote End ---  

 

Right. If youa also utilize the symmetry between x and y in arctan(x/y), you need a table over 45 degree only. An interpolated table with 256 points can achieve about 16 bit accuracy.
0 Kudos