FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
6355 Discussions

Is There A Megafunction For Arctan ?

Altera_Forum
Honored Contributor II
3,426 Views

hi everyone, 

 

is there any megafunctşon that implements arctan ? 

 

is there anyone know about this? 

 

thanks..
0 Kudos
26 Replies
Altera_Forum
Honored Contributor II
270 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
Altera_Forum
Honored Contributor II
270 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
Altera_Forum
Honored Contributor II
270 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
Altera_Forum
Honored Contributor II
270 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
Altera_Forum
Honored Contributor II
270 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
Altera_Forum
Honored Contributor II
270 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
Reply