210 likes | 345 Views
CSE 8351 Computer Arithmetic Fall 2005 Instructor: Peter-Michael Seidel. Other than Basic Functions. We have discussed basic arithmetic operations. What about other arithmetic operations? sin(x) x^(1/3) log(x) …. Function Evaluation. Lookup Tables
E N D
CSE 8351Computer ArithmeticFall 2005Instructor:Peter-Michael Seidel
Other than Basic Functions • We have discussed basic arithmetic operations. • What about other arithmetic operations? • sin(x) • x^(1/3) • log(x) • … Seidel - Fall 2005
Function Evaluation • Lookup Tables • Tables with Function values • Linear Approximations • Polynomial Approximations • reduces Function evaluation to • Table Lookup (ROM,RAM) • Additions • Multiplications • Can also help reduce calculation cost/delay for small sets of operands Seidel - Fall 2005
Taylor Series Approximation • Suppose we have a function which we want to write as: • The coefficients can be determined from the function itself • To determine , let's evaluate the function and the series at : • This shows us that the first coefficient . • Correspondingly, Seidel - Fall 2005
Taylor Series Approximation • Suppose we have a function which we want to write as: • The coefficients can be determined from the function itself • Correspondingly, helps us determine: Seidel - Fall 2005
Taylor Series Approximation • Suppose we have a function which we want to write as: • The coefficients can be determined from the function itself • if we can determine all derivatives at x=0 Seidel - Fall 2005
Taylor Series Approximation • Choosing a subset of terms of the Taylor approximation • leads to polynomial approximations • It is important to bound the error contribution of the remaining terms. • Helps to reduce function evaluation to • Lookups, • multiplication and • additions • Can make differentiation/ • integration easy: Seidel - Fall 2005
CORDIC - History • CORDIC – • COordinate Rotation Digital Computer (Volder, 1956&1959) • References • J.S. Walter, A unified algorithm for elementary functions, Spring Joint Computer Conference, 1971, Proc, pp.379-385. • R. Andraka, A survey of CORDIC algorithms for FPGA based computers, ACM/SIGDA sixth Int.Symp. on Field Programmable Gate Arrays, 1998, pp.191–200. Seidel - Fall 2005
cotana tana 1 sina a cosa Coordinate Rotations • Consider circle functions on the unit circle: Seidel - Fall 2005
Coordinate Rotations • Consider rotation of a point P by the angle Seidel - Fall 2005
Using Addition Theorems • for sine and cosine: Seidel - Fall 2005
Pseudo-Rotations • Coordinates after • - Real rotation: • - Pseudo rotation: K tan 1 1 K sin(a+) a K cos(a+) Seidel - Fall 2005
Iterative Computation Process • Iteration: Initialization: • Goal: get ito 0 • Approximation of • cos a by sin a by tan a by • Tabulated values of • and • allow one iteration to be computed with • 3 multiplications • 3 additions • Which and how many values of should be stored ? Seidel - Fall 2005
Simplified Iterations • Consider • Then iteration • become: Seidel - Fall 2005
Simplified Iterations • Iteration i: determine di in {-1,1} to • be of same sign as i • allow one iteration to be computed with • 3 multiplications • 3 additions • For fixed number of t iterations: • initialize with xi = 1/Rt =1/1.64676025 = 0.60725293 Seidel - Fall 2005
Simplified Iterations • Iteration i: determine di in {-1,1} to • be of same sign as i • Computation sequence for a = 30 • 30 ~ 45.0–26.6+14.0-7.1+3.6+1.8-0.9+0.4-0.2+0.1 • = 30.1 Seidel - Fall 2005
Simplified Iterations • Computation sequence for a = 30 • 30 ~ 45.0–26.6+14.0-7.1+3.6+1.8-0.9+0.4-0.2+0.1 • = 30.1 Seidel - Fall 2005
CORDIC Hardware Seidel - Fall 2005
Generalized CORDIC • Generalized CORDIC iteration: • Choose di in {-1,1} for iteration i: • Choices for : = 1 Circular rotations (basic CORDIC) e(i)= tan-1 2-i = 0 Linear rotations e(i)= 2-i = -1 Hyperbolic rotations e(i)= tanh-1 2-i Seidel - Fall 2005
Generalized CORDIC • can compute: • sin a • cos a • tan-1a • multiplication • division • sinh a • cosh a • tanh-1a Circular mode linear mode hyperbolic mode Seidel - Fall 2005