Atan2 - 2024.1 English

Vitis Libraries

Release Date
2024-05-30
Version
2024.1 English

The Atan2LookupFP function finds the arctangent of y/x. It returns the angle made by the vector image155 with respect to origin. The angle returned by atan2 will also contain the quadrant information.

Atan2LookupFP is a fixed point version of the standard atan2 function. This function implements the atan2 using a lookup table approach. The values in the look up table are represented in Q4.12 format and so the values returned by this function are in Q4.12. A maximum error of 0.2 degrees is present in the range of 89 to 90 degrees when compared to the standard atan2 function available in glibc. For the other angles (0 to 89) the maximum error is in the order of 10-3. This function returns 0 when both xs and ys are zeroes.

API Syntax

short Atan2LookupFP(short xs, short ys, int M1,int N1,int M2, int N2)

Parameter Descriptions

The following table describes the template and the function parameters.

Table 756 Table . Atan2LookupFP Parameter Description
Parameter Description
xs 16-bit signed value x in fixed point format of QM1.N1
ys 16-bit signed value y in fixed point format of QM2.N2
M1 Number of bits to represent integer part of x.
N1 Number of bits to represent fractional part of y. Must be equal to 16-M1.
M2 Number of bits to represent integer part of y.
N2 Number of bits to represent fractional part of y. Must be equal to 16-N1.
Return Return value is in radians. Its range varies from -pi to +pi in fixed point format of Q4.12

..rubric:: Resource Utilization

The following table summarizes the resource utilization of the Atan2LookupFP function , generated using Vivado HLS 2019.1 tool for the Xilinx Xczu9eg-ffvb1156-1-i-es1 FPGA.

Table 757 Table . Atan2LookupFP Function Resource Utilization Summary

Operating Frequency

(MHz)

Utilization Estimate
BRAM_18K DSP_48Es FF LUT CLB
300 4 2 275 75 139

Performance Estimate

The following table summarizes the performance in different configurations, as generated using Vivado HLS 2019.1 tool for the Xilinx Xczu9eg-ffvb1156-1-i-es1 FPGA.

Table 758 Table . Atan2LookupFP Function Performance Estimate Summary

Operating Frequency

(MHz)

Latency Estimate
Min (cycles) Max (cycles)
300 1 15