CSE 246 Computer Arithmetic Algorithms and Hardware Design

  • Slides: 17
Download presentation
CSE 246: Computer Arithmetic Algorithms and Hardware Design Fall 2006 Lecture 11 Cordic, Log,

CSE 246: Computer Arithmetic Algorithms and Hardware Design Fall 2006 Lecture 11 Cordic, Log, Square, Exponential Functions Instructor: Prof. Chung-Kuan Cheng

Cordic Algorithm Idea • Coordinate Rotations Digital Computer (x’, y’) α (x, y) •

Cordic Algorithm Idea • Coordinate Rotations Digital Computer (x’, y’) α (x, y) • Rotate vector (x, y) to (x’, y’)

Cordic Algorithm Equations • • • Main equations Derived equations

Cordic Algorithm Equations • • • Main equations Derived equations

Cordic Algorithms • Key: Given cos α, sin α, tan α we can derive

Cordic Algorithms • Key: Given cos α, sin α, tan α we can derive i αi 0 45 1 26. 6 2 14 3 7. 1 4 3. 6 5 1. 8 6 0. 9 7 0. 4 8 0. 2 9 0. 1

Cordic Algorithms (Example) • • • Find

Cordic Algorithms (Example) • • • Find

Cordic Algorithm Example Continued • •

Cordic Algorithm Example Continued • •

Logarithms – Method 1 • Find • •

Logarithms – Method 1 • Find • •

Logarithms – Method 1 • III. A table of

Logarithms – Method 1 • III. A table of

Logarithms – Method 1 (Example) • Find ln(x), x = 1. 625 • 1+0.

Logarithms – Method 1 (Example) • Find ln(x), x = 1. 625 • 1+0. 5+0. 125=1. 625 1. 1 1. -1 -1 -1 x 1 1 0 0. 1 1 0 1 _ 0 -1 1 _ 0 1 0. 1 1. 0 0 1 x 0 1 1 1. 0 0 1 1 1 0 0 0 1 _ 0 1

Logarithms – Method 1 (Example) 1. 0 0 0 1 1. 0 0 0

Logarithms – Method 1 (Example) 1. 0 0 0 1 1. 0 0 0 -1 1. 0 0 0 0 0 • -ln x = (1. -1) + ln(1. 0000 -1)

Logarithms – Method 2 • Let define • • Initially x<2, ie. y 0=0

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

Logarithms – Method 2 for i = 1 to l do x = x

Logarithms – Method 2 for i = 1 to l do x = x 2 if x ≥ 2 then yi = 1 x = x/2 else yi = 0

Logarithms – Method 2 (Example) • Find ln 2(x), x = 1. 11 (1.

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 0 0 0 1 y 1 = 1 x 2/2 1. 1 x 1. 1 1 1 0 0 0 1 + 1 1 0 0 0 1 1 0 y 2 = 1 0 0 0 1 _ 0 0 0 1

Logarithms – Method 2 (Example) (x 2/2)2/2 = 1. 00101100001 y 3 = 0

Logarithms – Method 2 (Example) (x 2/2)2/2 = 1. 00101100001 y 3 = 0 ln 2 1. 11 ≈ 0. 110

Squarer X + + x 3 x 1 x 3 x 2 x 2

Squarer X + + x 3 x 1 x 3 x 2 x 2 x 2 x 3 x 3 x 2 x 3 x 1 x 3 x 3 x 2 x 3 x 1 x 3 x 0 x 3 x 2 x 1 x 2 x 3 x 3 x 0 x 2 x 1 x 1 x 2 x 0 x 3 x 2 x 0 x 2 x 1 x 0 x 2 x 0 x 1 x 0 x 0 x 0 x 1 x 1 x 0 x 2 _ x 1 x 0 x 1 _

Exponentiation • • x e

Exponentiation • • x e

Exponentiation ex • I. • II. • min: • max:

Exponentiation ex • I. • II. • min: • max: