AR# 15137: LogiCORE CORDIC v3.0 - What format is used for the data in/out of the square root function?
LogiCORE CORDIC v3.0 - What format is used for the data in/out of the square root function?
Keywords: calculate, calculation
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?
Several examples and improved information on the data formats are available in the data sheet for the CORDIC v4.0 and later.
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:
CASE 1: Calculating the square root of a fractional number
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)
CASE 2: The input/output of the square root can be interpreted differently to "change" the input range
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: