FPGA Intellectual Property
PCI Express*, Networking and Connectivity, Memory Interfaces, DSP IP, and Video IP
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
5953 Discussions

Floating Point atan Megafunction

Altera_Forum
Honored Contributor II
1,230 Views

Hi everyone, 

I'm building a range finding system and i'm trying to build an I/Q demodulator in order to get the phase of an input signal. I'm using an Cyclone III FPGA on a developement Kit.  

In order to get the phase, the I- and Q-components have to be divided and I want to use the floating point atan Megafunction (altfp_atan) to calculate the arctan of the Q/I quotient. Which is way more convenient than using a large LUT with interpolation or CORDIC... 

 

Unfortunately the output of the atan megafunction is always ZERO no matter what input signal I apply to the atan megafunction block. 

 

I've tried already a lot of things, but nothing worked. Still zero at the output at all times. 

 

:confused: Does anybody know what i'm doing wrong or has the same problem?  

 

Really appreciate your help!
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
102 Views

have you taken a look to see if there is an example of the atan function in the design examples? 

 

http://www.altera.com/literature/ug/floating-point%20megafunctions%20design%20examples.zip
Altera_Forum
Honored Contributor II
102 Views

 

--- Quote Start ---  

Does anybody know what i'm doing wrong or has the same problem? 

--- Quote End ---  

 

You didn't show what you're doing, so how should we know what you did wrong? 

 

I don't expect, that you're I/Q values are floating point.
Altera_Forum
Honored Contributor II
102 Views

 

--- Quote Start ---  

You didn't show what you're doing, so how should we know what you did wrong? 

 

I don't expect, that you're I/Q values are floating point. 

--- Quote End ---  

 

 

That's right, I and Q are Integer values. In order to get the I and Q values I built a digital signal processing which multiplicates the input signal once with a sine-signal and once with a cosine-signal. The values for the sine and cosine are stored in lookup tables. Afterwards the two products that you get are low passed filtered with a CIC filter. In this way the system generates the I and Q values.  

To get the phase value the I and Q values have to be divided by each other and the arctan-function has to be applied to the quotient. 

before dividing the two values they are converted to floating point values. For the devision I use the division floating point megafunction.  

Until here everything works fine. The result of the divider is also correct.  

I tried to apply various values to the input of the atan megafunction but the result remains zero.  

For a better understanding I attached a block diagram of my IQ demodulator (the mathematical function is shown in blue) 

 

it almost seems like the atan megafunction just doesn't work.  

So i'm just curious if someone else faces the same problems? 

 

As this megafunction is still fairly new I could not find any design examples so far:(
Altera_Forum
Honored Contributor II
102 Views

I use this Floating Point atan Megafunction in Modelsim to simulate. 

 

I am entering float point format(IEEE 754 ) for data port and also have clock 

 

but still no signal. 

 

The result port still "zzzzzzzzzzzzzzzz" 

 

I don't know how to use this function. 

 

Have some one use this function can work. 

 

If you can . Please tell me. 

 

Maybe we can discuss together.
Altera_Forum
Honored Contributor II
102 Views

Not directly related to the atan() issue, but you could use the Goetzel generator to generate your sin (& cos) - uses the two previous values and a single multiply + add to get the next term. That would make it easier to change the frequency. Might just be a logic v memory tradeoff. 

 

The atan() function will just be expanding one of the power series, if you have bounds on the input and desired accuracy it might be worth doing it yourself - when you can probably do it all as fixed point.
Altera_Forum
Honored Contributor II
102 Views

I found, that the altfp_atan has a bug in Quartus V11.0, that clk_en erroneously defaults to '0'. So if you don't use and enable the clk_en port in the MegaFunction instance, the atan function is disabled.  

 

I agree however with dsl, that it seems more appropriate to write a fixed point implementation, due to the huge resource consumption of the float version.
Altera_Forum
Honored Contributor II
102 Views

FvM Thanks for reply it is working!!!!!!!!:)

Reply