Docsity

Cordic Algorithm and Logarithms: Equations and Methods, Slides of Electrical Engineering

Partial preview of the text

Download Cordic Algorithm and Logarithms: Equations and Methods and more Slides Electrical Engineering in PDF only on Docsity!

Computer Arithmetic Algorithms

and Hardware Design

Cordic Algorithm Idea

  • Coordinate Rotations Digital Computer
    • Rotate vector (x,y) to (x’,y’)

α

(x’,y’)

(x,y)

Cordic Algorithms

  • Key: Given cos α, sin α, tan α

we can derive

≈ (^) ∑ i

α si α i s ∈{+^1 ,^ −^1 }

i αi 0 45 1 26. 2 14 3 7. 4 3. 5 1. 6 0. 7 0. 8 0. 9 0.

i i

− tan α = 2

Cordic Algorithms (Example)

  • Find

i i

− tan α = 2

x (^) 0 = x − y tan 45 = x − y

y (^) 0 = x tan 45 − y = x + y

2 1 /^2 r 0 = 1 + tan 45

tan ( 30 )

Logarithms – Method 1

  • Find

ln x ( ) ( ) (^1) 1

= (^) ∏ ≈

m

i

x m^ x C i

( ) ( ) ( )  

  

 = −∏ = − ∏ = =

m

i

i

m

i

y m^ C i C 1 1

ln ln

( ) x

C

m

i

i^1 1

∏^ ≈

y (^ m^ ) ≈ ln x

Logarithms – Method 1

  • I.
  • II.
  • III. A table of

x ∈ [ 1 , 2 )

( ) i i

i C d − = 1 + 2 di ∈{−^1 ,^0 ,^1 }

( ) i d (^) i − ln 1 + 2

Logarithms – Method 1 (Example)

  • -ln x = (1.-1) + ln(1.01) + ln(1.0000-1)
    1. 0 0 0 0 0 1
    2. 0 0 0 0 0-
    3. 0 0 0 0 0 0 0 0 0 0

Logarithms – Method 2

  • Let define
  • Initially x<2, ie. y 0 =
  • If

x = 2 ln^2 x = 2 y^0. y^1 y^2 y^3

x^2 = 2 2 ln^2 x = 2 y^0 y^1. y^2 y^3

2 2 x ≥

  1. 2 3

2 2 2

x (^) y y

ln 2 x = y 0. y 1 y 2 y 3

Logarithms – Method 2 (Example)

  • Find ln 2 (x), x = 1.11 (1.75)

x^2 1.1 1 x 1.1 1 1 1 1 1 1 1

  • 1 1 1 __ 1 1 0 0 0 1

y 1 = 1

x^2 / 1.1 0 0 0 1 x 1.1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1

  • 1 1 0 0 0 1 _ 1 0.0 1 0 1 1 0 0 0 0 1

y 2 = 1

Logarithms – Method 2 (Example)

(x^2 /2) 2 /2 = 1.

y 3 = 0

ln 2 1.11 ≈ 0.

Exponentiation ex

( ) (^) ln ( ) (^0) 1

= −∑ ≈

m

i

x m^ x C i

( ) ( ) ∏ =

=

m

i

y m^ C i 1 ( ) ≈ (^) ∑ x ln C i

y^ (^ m^ )^ = e C ( ) i^ = e ∑ C ( ) i^ = ex ∏

ln ln

Exponentiation ex

  • I.
  • II.
  • min:
  • max:

x ∈ ( − 1 , 1 )

i Ci diZ − = 1 + di ∈{−^1 ,^0 ,^1 }

∑ ln^ (^1 −^2 )^ = −^1.^24

− i

∑ ln^ (^1 +^2 )^ =^1.^56

− i