LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabVIEW FPGA SGL Inverse Tangent

I am trying to implement an inverse tangent calculation on FPGA and I would ideally like to have the input and output be Single Precision (SGL) Floats. The input would be the Tangent and the output would be the angle in radians or PiRadians. Is there an available function to implement this in LabVIEW FPGA using SGL?  I know it does exist in FXP.

 

I'm trying to use the Xilinx CORDIC 6.0 LogicCORE function (something I'm not familiar with) and I'm not sure I'm using it right. I see that I can get an output (I assume the angle) in SGL but it seems the input has to be Fixed Point (FXP).  I'm using the Zynq on a cRIO-9068.

 

I've attached a VI snippet with the CORDIC node configured for pipelining.

 

I configured the Xilinx IP as follows:

 

Functional Selection:  Arc Tan

Architectural Configuration: Parallel

Pipelining Mode:  Maximum

Data Format:  SignedFraction (no choice allowed there)

Phase Format: Radians

 

Input Width: 32

Output Width: 32

Round Mode: Truncate

 

Advanced Configuration Parameters (not really sure what these do):

Iterations: 0

Precision: 0

Coarse Rotation: checked

Compensation Scaling: No Scale Compensation (no choices allowed there)

 

In the resultant VI (see Pipelined SGL Arctan.png) I thought  "s_axis_cartesian_tdata" was the tangent value and "m_axis_dout_tdata" was the angle in radians.  But that's not what I seem to be getting.  I punch in 1 for "s_axis_cartesian_tdata" and I expect to see 0.785398 for "m_axis_dout_tdata".  Instead I see -1.77293E+38.  I've set the Execution Mode of my FPGA target to Simulation (Simluated I/O). Don't know if I have to run this on an actual FPGA to see real values.

 

Thanks in advance for  any help.

Download All
0 Kudos
Message 1 of 4
(5,412 Views)

Why not use the FXP method that already exists and do a bit of processing with the float on the host side?  Convert to and from FXP on the host and let the algorithm remain optimized on the FPGA.  There aren't any real reasons to do what you're asking.  You want to take up more fabric on your FPGA to gain almost nothing. 

 

What is it about SGL that attracts you?

0 Kudos
Message 2 of 4
(5,362 Views)

Thanks for the response.  This code will form part of a larger VI.  I am not as comfortable with FXP as I would like.  As I understand it we need to know the expected ranges and desired precisions of given inputs and calculated outputs to effectively use FXP.  Unfortunately in the application we are building the ranges could vary quite a bit as could the desired precisions. Hence we thought SGL might be the best way to go.  I'll keep your suggestion in mind and give the FXP approach a deeper look.

 

Thanks!

0 Kudos
Message 3 of 4
(5,328 Views)

Hello, 

If you want to calculate Arctan in FPGA VI, I strongly suggest you use the 'Atan2' under 'high throughput math function'. It has two inputs, x and y, the output is the phase. You say that you want to use SGL number, however, for this function, you can only use FXP as your input. What you need to do is convert your SGL to FXP, and convert the output to SGL again. 

0 Kudos
Message 4 of 4
(4,845 Views)