**UPGRADE YOUR BROWSER**

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!

I want to use the CORDIC core v1.0 to calculate the square root of the input. What format do I need for the input and output data? How does this relate to the square root?

The inputs and outputs to the CORDIC core are Q1 format binary numbers. The Q1 format has an imaginary decimal one position from the left. The square root function of the CORDIC assumes unsigned input/output data. Examples of the Q1 number format are presented below.

There are two ways to interpret the results from the CORDIC core when the core is used for square root calculations:

For an 8-bit input, the format of the input is:

0.0001000 = (SQRT 1/16)

The format of the output is:

0.0100000 = (1/4)

For a 20-bit input, the format of the input is:

0.0001000000000000000 = (SQRT 1/16)

The format of the output is:

0.0100000000000000000 = (1/4)

Starting with the decimal one position from the left (Q1), if the input data is left-shifted by 2*N bits, the output data is left-shifted by N bits.

An 8-bit input to the square root is:

0000100.0 = (SQRT 4) ------>This input is shifted by 6 = 2*3, therefore N = 3.

0010.0000 = (2) ----------------->The output is shifted by 3.

One possible 20-bit input to the square root is:

0000000000000000010.0 = SQRT(2) ---------> The input is shifted by 18 = 2*9, therefore N = 9.

0000000001.0110101000 = 1.4140625 ------>The output is shifted by 9.

Another possible 20-bit input and result from the square root function is:

0000000000000000100.0 = SQRT(4)

0000000010.0000000000 = 2

The instantiation of an integer in and integer out for a CORDIC square root is illustrated below:

X_IN : STD_LOGIC_VECTOR(20-1 DOWNTO 0);

X_OUT : STD_LOGIC_VECTOR(20-1 DOWNTO 0);

Instantiate a 21-bit square root:

X_IN_SQRT : STD_LOGIC_VECTOR(21-1 DOWNTO 0);

X_OUT_SQRT : STD_LOGIC_VECTOR(21-1 DOWNTO 0);

Make the following assignments:

Inputs:

X_IN_SQRT <= X_IN & '0';

Outputs:

X_OUT(20-1 DOWNTO 11) <= (OTHERS=>'0');

X_OUT(10 DOWN TO 0) <= X_OUT_SQRT(21-1 DOWN to 10)

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

Was this Answer Record helpful?

AR# 15137 | |
---|---|

Date | 03/27/2009 |

Status | Active |

Type | General Article |