We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

# AR# 24827

## Description

Keywords: CORDIC, atan, arctan, CORE Generator, negative v1.0, v1.1, v2.0, v3.0, 4.0

Why are the ATAN phase output results wrong when the X input is negative?

(That is, when x<0, why is the phase output wrong?)

## Solution

When coarse rotation is used, the results may appear to be in the wrong quadrant when compared to MATLAB atan function if X is negative. The reason for this is that the coarse rotation expands in allowable input to the full circle, which is equivalent to the MATLAB atan2 function.

With Coarse Rotation:
EX: Y=0.5, X=-0.625.
MATLAB atan Result ~= -0.67474
MATLAB atan2 Result ~= +2.4669
Core Results ~= +2.4669
This is because the Coarse Rotation puts the results in the 2nd quadrant when X is negative
i.e. pi-0.67474 = +2.4669.

You can work around this using the following steps:
1. Create a detection circuit to detect when X is negative.
2. Make X positive using a two's complement or other circuit.
3. Create a delay circuit to delay the detection of the negative X input to be passed to an output circuit.
4. Make the output negative, if necessary, using a two's complement or other circuit.

For a detailed list of LogiCORE CORDIC Release Notes and Known Issues, see (Xilinx Answer 29570).

AR# 24827
Date 10/23/2009
Status Active
Type General Article
Page Bookmarked