# AR# 32021

|

## 描述

Why do the Translate function outputs appear to be incorrect?

## 解决方案

Several examples and improved information on the data formats are available in the data sheet for the CORDIC v4.0 and later.

This is typically because of a misunderstanding of the output format.

The following are several example calculations of the Translate function. These examples are based on a CORDIC configuration of a 20-bit input and output:

Example 1:

This example is a modified version of the example design that can be found in the data sheet for the CORDIC on pages 9-10.

B = 0.707+0.25j;

mag = abs(B) % Magnitude

0.7498993265765745

theta = angle(B) % Phase Angle

0.3398843741305139

CORDIC SIMULATION

x_in <= "00101101001111111000" = 00.101101001111111000 = 0.707 (Q1.N

Format)

y_in <= "00010000000000000000" = 00.010000000000000000 = 0.25 (Q1.N

Format)

x_out <= "00101101010000000000" = 00.101101010000000000 =

0.7499275207519531 (Q1.N Format)

P_out <= "00001010111000000100" = 000.01010111000000100 =

0.3398742675781250 (Q2.N Format)

Example 2:

This example uses integer input values:

C = 10+5j

mag = abs(C) % Magnitude

11.18033988749895

theta = angle(C) % Phase Angle

0.4636476090008061

This is where it becomes a bit tricky; the format and range are such that you might need to scale your data before inputting it into the core.

First, this is what the 20-bit input would look like if the input were all integer bits:

Decimal 10 = 00000000000000001010

Decimal 5 = 00000000000000000101

Scale by N-2, which in this case is 20-2 = 18 (this is only to reinterpret the numbers and show that the calculated output from the CORDIC is correct).

10 / 2^18 = 0.000038146972656250

5 / 2^18 = 0.000019073486328125

SCALED CALCULATIONS

D = 0.000038146972656250+0.000019073486328125j

mag = abs(D) % Magnitude

0.00004264961199760036

theta = angle(D) % Phase Angle

0.4636476090008061

Following is what the core would do if those values were put straight into the core and the data reinterpreted:

CORDIC SIMULATION

x_in <= "00000000000000001010" = 00.000000000000001010 =

0.00003814697265625000 (Q1.N Format)

y_in <= "00000000000000000101" = 00.000000000000000101 =

0.00001907348632812500 (Q1.N Format)

x_out <= "00000000000000001100" = 00.000000000000001100 =

0.0000457763671875 (Q1.N Format)

P_out <= "00001110101100110010" = 000.01110101100110010 =

0.4593658447265625 (Q2.N Format)

If you want to reinterpret the output in the original format, you will need to scale the Magnitude output. If you scale the output value by 2^18, which in this case is how the input was scaled, then you will find that the output does equal the expected value.

0.0000457763671875 * 2^18 = 12

Example 3:

Another example, using larger integer numbers:

E = 1024+512j

mag = abs(E) % Magnitude

1144.866804479892

theta = angle(E) % Phase Angle

0.4636476090008061

Decimal 1024 = 00000000010000000000

Decimal 512 = 00000000001000000000

Scale by N-2, which in this case is 20-2 = 18 (this is only to reinterpret the numbers and show that the calculated output from the CORDIC is correct).

1024 / 2^18 = 0.003906250

512 / 2^18 = 0.001953125

SCALED CALCULATIONS

F = 0.003906250+0.001953125j

mag = abs(F) % Magnitude

0.004367320268554277

theta = angle(F) % Phase Angle

0.4636476090008061

Following is what the core would do if those values were put straight into the core, and the data reinterpreted:

CORDIC SIMULATION

x_in <= "00000000010000000000" = 00.000000010000000000 =

0.003906250000000000 (Q1.N Format)

y_in <= "00000000001000000000" = 00.000000001000000000 =

0.001953125000000000 (Q1.N Format)

x_out <= "00000000010001111001" = 00.000000010001111001 =

0.004367828369140625 (Q1.N Format)

P_out <= "00001110110101011010" = 000.01110110101011010 =

0.4635772705078125 (Q2.N Format)

If you want to reinterpret the output in the original format, you will need to scale the Magnitude output. If you scale the output value by 2^18, which in this case is how the input was scaled, you will find that the output does equal the expected value.

0.004367828369140625 * 2^18 = 1145

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

AR# 32021

Type 综合文章
People Also Viewed