General CORDIC Description (1A)

Similar documents
DFT Frequency (9A) Each Row of the DFT Matrix. Young Won Lim 7/31/10

Fourier Analysis Overview (0A)

Fourier Analysis Overview (0A)

Digital Signal Octave Codes (0A)

CT Rectangular Function Pairs (5B)

Digital Signal Octave Codes (0A)

Digital Signal Octave Codes (0A)

Digital Signal Octave Codes (0A)

Group & Phase Velocities (2A)

Digital Signal Octave Codes (0A)

Discrete Time Rect Function(4B)

Digital Signal Octave Codes (0A)

Down-Sampling (4B) Young Won Lim 10/25/12

Phasor Young Won Lim 05/19/2015

Discrete Time Rect Function(4B)

Signal Functions (0B)

Down-Sampling (4B) Young Won Lim 11/15/12

Bandpass Sampling (2B) Young Won Lim 3/27/12

Expected Value (10D) Young Won Lim 6/12/17

Up-Sampling (5B) Young Won Lim 11/15/12

Fourier Analysis Overview (0B)

Group Delay and Phase Delay (1A) Young Won Lim 7/19/12

Matrix Transformation (2A) Young Won Lim 11/10/12

General Vector Space (2A) Young Won Lim 11/4/12

Background Trigonmetry (2A) Young Won Lim 5/5/15

Undersampling (2B) Young Won Lim 4/4/12

Capacitor in an AC circuit

Capacitor and Inductor

Capacitor and Inductor

Capacitor Young Won Lim 06/22/2017

Propagating Wave (1B)

Matrix Transformation (2A) Young Won Lim 11/9/12

Higher Order ODE's (3A) Young Won Lim 7/7/14

Group Velocity and Phase Velocity (1A) Young Won Lim 5/26/12

Complex Trigonometric and Hyperbolic Functions (7A)

Higher Order ODE's (3A) Young Won Lim 12/27/15

CLTI Differential Equations (3A) Young Won Lim 6/4/15

Relations (3A) Young Won Lim 3/27/18

Root Locus (2A) Young Won Lim 10/15/14

Hilbert Inner Product Space (2B) Young Won Lim 2/7/12

Magnetic Sensor (3B) Magnetism Hall Effect AMR Effect GMR Effect. Young Won Lim 9/23/09

Higher Order ODE's (3A) Young Won Lim 7/8/14

Background ODEs (2A) Young Won Lim 3/7/15

Introduction to ODE's (0A) Young Won Lim 3/9/15

Detect Sensor (6B) Eddy Current Sensor. Young Won Lim 11/19/09

Separable Equations (1A) Young Won Lim 3/24/15

Bayes Theorem (10B) Young Won Lim 6/3/17

Audio Signal Generation. Young Won Lim 1/29/18

Line Integrals (4A) Line Integral Path Independence. Young Won Lim 10/22/12

Complex Series (3A) Young Won Lim 8/17/13

Dispersion (3A) 1-D Dispersion. Young W. Lim 10/15/13

CT Correlation (2A) Young Won Lim 9/9/14

ODE Background: Differential (1A) Young Won Lim 12/29/15

DFT Octave Codes (0B) Young Won Lim 4/15/17

The Growth of Functions (2A) Young Won Lim 4/6/18

Spectra (2A) Young Won Lim 11/8/12

Capacitor in an AC circuit

Background LTI Systems (4A) Young Won Lim 4/20/15

FFT Octave Codes (1B) Young Won Lim 7/6/17

Capacitor in an AC circuit

CLTI System Response (4A) Young Won Lim 4/11/15

Bayes Theorem (4A) Young Won Lim 3/5/18

Utility Functions Octave Codes (0A) Young Won Lim 1/24/18

Capacitor in an AC circuit

Linear Equations with Constant Coefficients (2A) Young Won Lim 4/13/15

Capacitors in an AC circuit

Capacitor in an AC circuit

Capacitor in an AC circuit

Definitions of the Laplace Transform (1A) Young Won Lim 1/31/15

Capacitor in an AC circuit

Audio Signal Generation. Young Won Lim 2/2/18

Audio Signal Generation. Young Won Lim 2/2/18

Higher Order ODE's, (3A)

Line Integrals (4A) Line Integral Path Independence. Young Won Lim 11/2/12

Sequential Circuit Timing. Young Won Lim 11/6/15

Second Order ODE's (2A) Young Won Lim 5/5/15

Hyperbolic Functions (1A)

General Vector Space (3A) Young Won Lim 11/19/12

Hamiltonian Cycle (3A) Young Won Lim 5/5/18

Propositional Logic Logical Implication (4A) Young W. Lim 4/11/17

Complex Functions (1A) Young Won Lim 2/22/14

Differentiation Rules (2A) Young Won Lim 1/30/16

Signals and Spectra (1A) Young Won Lim 11/26/12

Background Complex Analysis (1A) Young Won Lim 9/2/14

Surface Integrals (6A)

Propositional Logic Resolution (6A) Young W. Lim 12/12/16

Introduction to ODE's (0P) Young Won Lim 12/27/14

FSM Examples. Young Won Lim 11/6/15

Propositional Logic Logical Implication (4A) Young W. Lim 4/21/17

Implication (6A) Young Won Lim 3/17/18

Propositional Logic Resolution (6A) Young W. Lim 12/31/16

Differentiation Rules (2A) Young Won Lim 2/22/16

Probability (10A) Young Won Lim 6/12/17

Resolution (7A) Young Won Lim 4/21/18

Signal Processing. Young Won Lim 2/20/18

Implication (6A) Young Won Lim 3/12/18

6.1 Reciprocal, Quotient, and Pythagorean Identities.notebook. Chapter 6: Trigonometric Identities

Signal Processing. Young Won Lim 2/22/18

Surface Integrals (6A)

CMOS Inverter. Young Won Lim 3/31/16

Transcription:

General CORDIC Description (1A)

Copyright (c) 2010, 2011, 2012 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". Please send corrections (or suggestions) to youngwlim@hotmail.com. This document was produced by using OpenOffice and Octave.

CORDIC Background 1. CORDIC FAQ, G. R. Griffin, www.dspguru.com/info/faqs/cordic2.htm 1A General 3

Complex Multiplication Given Complex Value Rotation Value Rotated Complex Value C = R = I r j Q r C ' = ' ' C ' = C R ' ' = I r j Q r = I r Q c Q r I r Q r I r j Q r C = r c ϕ c R = r r ϕ r C' = r c r r (ϕ c +ϕ c ) 1A General 4

Adding / Subtracting Phase To add R' phase to C C ' = C R ' ' = I r j Q r = I r Q c Q r I r Q r I r j Q r To sub R' phase to C C ' = C R ' ' = I r j Q r = I r Q c Q r I r Q r I r j Q r 1A General 5

Adding / Subtracting 90 Degrees To add R' phase to C C ' = C ( + j ) ' ' = 0 j = Q c j 0 j To sub R' phase to C C ' = C ( j ) ' ' = 0 j = Q c j 0 j 1A General 6

Elementary Angle: tan -1 (k l ) tan θ l = 1 2 l = k l θ l = tan 1 (2 l ) = tan 1 (k l ) j magnitude l = 0 1 j 2 0 θ 0 = tan 1 (2 0 ) = 45.00000 1+k l 2 = 1+2 2 l l = 1 1 j 2 1 θ 1 = tan 1 (2 1 ) = 26.56505 l = 2 l = 3 l = 4 1 1 j 2 2 1 j 2 3 1 j 2 4 θ 2 θ 3 θ 4 = tan 1 (2 2 ) = 14.03624 = tan 1 (2 3 ) = 7.12502 = tan 1 (2 4 ) = 3.57633 Represent arbitrary angle θ in terms of ±θ 0, ±θ 1, ±θ 2, ±θ 3,, ±θ l, ( k l = tan θ l = 1 2 l, l = 0,1, 2, ) 1A General 7

Adding / Subtracting tan -1 (k l ) To add R' phase to C C ' = C (1 + j k l ) 1 j k ' ' = (1 + j k l ) = ( k l Q c ) + j (Q c + k l ) = ( 2 l Q c ) + j (Q c + 2 l ) To sub R' phase to C C ' = C (1 j k l ) 1 j k ' ' = (1 j k l ) = ( + k l Q c ) + j (Q c k l ) = ( + 2 l Q c ) + j (Q c 2 l ) θ l = tan 1 (k l ) = tan 1 (2 l ) k l = 1 2 l, l = 0,1,2, 1A General 8

Phase and Magnitude of 1 + jk l (1) Cumulative Magnitude L k = 1 2 l R = 1 + j k Phase of R Magnitude of R CORDIC Gain 0 1.0 1 + j1.0 45º 1.41421356 1.414213562 1 0.5 1 + j0.5 26.56505º 1.11803399 1.581138830 2 0.25 1 + j0.25 14.03624º 1.03077641 1.629800601 3 0.125 1 + j0.125 7.12502º 1.00778222 1.642484066 4 0.0625 1 + j0.0625 3.57633º 1.00195122 1.645688916 5 0.03125 1 + j0.03125 1.78991º 1.00048816 1.646492279 6 0.015625 1 + j0.015625 0.89517º 1.00012206 1.646693254 7 0.007813 1 + j0.007813 0.44761º 1.00003052 1.646743507 1.647 R = 1 + j k l k l = 1/2 l l = 0,1, 2, R = 1 2 + k l 2 = 1+2 2 l > 1.0 1A General 9

Phase and Magnitude of 1 + jk l (2) Represent arbitrary angle θ in terms of ±θ 0, ±θ 1, ±θ 2, ±θ 3,, ±θ l, ( k l = tan θ l = 1 2 l, l = 0,1, 2, ) Binary Search Shift and Add No multiplier θ 0 = tan 1 (2 0 ) = θ 1 = tan 1 (2 1 ) = θ 2 = tan 1 (2 2 ) = θ 3 = tan 1 (2 3 ) = θ 4 = tan 1 (2 4 ) = θ 5 = tan 1 (2 5 ) = θ 6 = tan 1 (2 6 ) = θ 7 = tan 1 (2 7 ) = Phase of R 45º 26.56505º 14.03624º 7.12502º 3.57633º 1.78991º 0.89517º 0.44761º 1 2 1 2 1 2 1 2 1 2 1 2 1 2 > 92º θ θ [-180, +180] R = 0 ± j [-90, +90] R = 1 ± j k l 4 or more rotations 45º + 26.56505º + 14.03624º + 7.12502º = 92.726º > 92º 1A General 10

Phase and Magnitude of 1 + jk l (3) R = 1 ± j k l Magnitude of R 1 2 + k l 2 Cumulative Magnitude > 1.0 CORDIC Gain Iteration R 0 = 1 ± j (1/2 0 ) R 1 = 1 ± j (1/2 1 ) R 2 = 1 ± j (1/2 2 ) R 3 = 1 ± j (1/2 3 ) R 4 = 1 ± j (1/2 4 ) R 5 = 1 ± j (1/2 5 ) 1 2 + 1 2 = 1 2 + (1/2) 2 = 1 2 + (1/2 2 ) 2 = 1 2 + (1/2 3 ) 2 = 1 2 + (1/2 4 ) 2 = 1 2 + (1/2 5 ) 2 = 1.41421356 1.11803399 1.03077641 1.00778222 1.00195122 1.00048816 1.414213562 1.581138830 1.629800601 1.642484066 1.645688916 1.646492279 R 6 = 1 ± j (1/2 6 ) 1 2 + (1/2 6 ) 2 = 1.00012206 1.646693254 R 7 = 1 ± j (1/2 7 ) 1 2 + (1/2 7 ) 2 = 1.00003052 1.646743507 The actual CORDIC Gain depends on the number of iterations 1.647 For each iteration, the corresponding is always used (either +θ i or θ i ) θ i The magnitude is growing for correction, multiply by 0.6073 = 1 / 1.647 1A General 11

Vector Mode Calculating Magnitude vector magnitude? Vectoring Mode C = I C= + jq c + j0 c Rotate until accumulated angle is 0 Accumulator View mag x 1.647 Each iteration, the magnitude is increased by 1 2 + k l 2 CORDIC Gain (cumulative gain) 1.647 = 0.607 1 magnitude x 1.647 magnitude x 0.607 To compensate, multiply by 0.607 Can t perform this gain adjustment by simple shift and add This adjustment can be done in other part of a system when relative magnitude is enough 1A General 12

Vector Mode Calculating Phase vector phase? Vectoring Mode C = I C= + jq c + j0 c Rotate until accumulated angle is 0 0 = tan 1 2 0 = 1 = tan 1 2 1 = 2 = tan 1 2 2 = 3 = tan 1 2 3 = 4 = tan 1 2 4 = 5 = tan 1 2 5 = Phase of R 45º 26.56505º 14.03624º 7.12502º 3.57633º 1.78991º Accumulator View mag x 1.647 θ ±θ 0 ±θ 1 ±θ 2 ±θ 3 = 0 Accumulate each rotating angles then negate the result 1A General 13

Angle Update in Vector Mode ' ' = (1 + j k l ) Pre Q c > 0 Q c < 0 Rotate -90 Rotate +90 l = 0 l = 1 Q c > 0 Q c < 0 Q c > 0 Q c < 0 θ 0 +θ 0 θ 0 +θ 0 Q c > 0 Q c < 0 Q c > 0 Q c < 0 Q c > 0 Q c < 0 Q c > 0 Q c < 0 θ 1 +θ 1 θ 1 +θ 1 θ 1 +θ 1 θ 1 +θ 1 l = 2 θ 2 +θ 2 θ 90 θ 0 θ 1 θ 2 θ 90 + θ 0 θ 1 + θ 2 θ + 90 + θ 0 θ 1 θ 2 1A General 14

Multiplication of ±j Positive Phase (Q c > 0) Rotate by 90 degrees 0 j Q c j Negative Phase (Q c < 0) Rotate by +90 degrees 0 + j Q c j Resulting Phase [-90, +90] 1A General 15

Multiplication of 1 ± jk l Positive Phase (Q c > 0) Rotate by 1 j k l 1 j k l ( +2 l Q c ) + j (Q c 2 l ) Negative Phase (Q c < 0) Rotate by 1 + j k l 1 j k l ( 2 l Q c ) + j(q c +2 l ) After iterations, the result + j 0 1A General 16

Rotation Mode Calculating Sine and Cosine Rotation Mode C = + jq c C= + j0 Rotate until accumulated angle is θ Accumulator View I ' c Q ' c cosθ sin θ C= 0+ jq c θ > +90 cos θ Q c sin θ C= 0 jq c θ < 90 C = + jq c 1A General 17

Initial Vector Θ > +90 starting from 0 + j1 Θ < +90 starting from 1 + j0 Θ < 90 starting from 0 j1 Θ > 90 starting from 1 j0 Initialize the accumulate rotation -90, +90, 0 1A General 18

Angle Update in Rotation Mode In each iteration (Θ the accumulated rotation) < 0 then add the next angle (Θ the accumulated rotation) > 0 then subtract the next angle The final Q c cosine sine 1A General 19

1A General 20

References [1] http://en.wikipedia.org/ [2] J.H. McClellan, et al., Signal Processing First, Pearson Prentice Hall, 2003 [3] A graphical interpretation of the DFT and FFT, by Steve Mann [4] CORDIC FAQ, www.dspguru.com