Copyright 2008 Koren ECE666/Koren Part.9b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.

Slides:



Advertisements
Similar presentations
Function Evaluation Using Tables and Small Multipliers CS252A, Spring 2005 Jason Fong.
Advertisements

UNIVERSITY OF MASSACHUSETTS Dept
Engineering Mathematics Class #15 Fourier Series, Integrals, and Transforms (Part 3) Sheng-Fang Huang.
Copyright © Cengage Learning. All rights reserved. 6 Inverse Functions.
Copyright 2008 Koren ECE666/Koren Part.4b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
Copyright © 2009 Pearson Addison-Wesley Graphs of the Circular Functions.
ECIV 201 Computational Methods for Civil Engineers Richard P. Ray, Ph.D., P.E. Error Analysis.
UNIVERSITY OF MASSACHUSETTS Dept
Copyright 2008 Koren ECE666/Koren Part.6b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
TECHNIQUES OF INTEGRATION
CSE 246: Computer Arithmetic Algorithms and Hardware Design Instructor: Prof. Chung-Kuan Cheng Winter 2004 Lecture 10 Thursday 02/19/02.
1 Chapter 7 Transcendental Functions Inverse Functions and Their Derivatives.
Copyright 2008 Koren ECE666/Koren Sample Mid-term 2.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital.
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
Digital Kommunikationselektronik TNE027 Lecture 3 1 Multiply-Accumulator (MAC) Compute Sum of Product (SOP) Linear convolution y[n] = f[n]*x[n] = Σ f[k]
Copyright 2008 Koren ECE666/Koren Sample Mid-term 1.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital.
CSE 378 Floating-point1 How to represent real numbers In decimal scientific notation –sign –fraction –base (i.e., 10) to some power Most of the time, usual.
Distributed Arithmetic: Implementations and Applications
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Interpolation Chapter 18.
Copyright 2008 Koren ECE666/Koren Part.6a.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
Copyright 2008 Koren ECE666/Koren Part.5a.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
THE REAL NUMBERS College Algebra. Sets Set notation Union of sets Intersection of sets Subsets Combinations of three or more sets Applications.
Computer Arithmetic Integers: signed / unsigned (can overflow) Fixed point (can overflow) Floating point (can overflow, underflow) (Boolean / Character)
Ch. 21. Square-rootingSlide 1 VI Function Evaluation Topics in This Part Chapter 21 Square-Rooting Methods Chapter 22 The CORDIC Algorithms Chapter 23.
1. Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Rational Exponents, Radicals, and Complex Numbers CHAPTER 10.1Radical.
Section 5.5 Inverse Trigonometric Functions & Their Graphs
Copyright © 2005 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 7 Transcendental Functions.
CpE- 310B Engineering Computation and Simulation Dr. Manal Al-Bzoor
 We noticed in Section 2.3 that the limit of a function as x approaches a can often be found simply by calculating the value of the function at a.  Functions.
Rational Exponents, Radicals, and Complex Numbers
Copyright © 2005 Pearson Education, Inc.. Chapter 6 Inverse Circular Functions and Trigonometric Equations.
ECE232: Hardware Organization and Design
Partial-fraction Expansion
ECE 8053 Introduction to Computer Arithmetic (Website: Course & Text Content: Part 1: Number Representation.
Inverse Trigonometric Functions 4.7
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Chapter.
Chapter 4 Trigonometric Functions Inverse Trigonometric Functions Objectives:  Evaluate inverse sine functions.  Evaluate other inverse trigonometric.
June 2007 Computer Arithmetic, Function EvaluationSlide 1 VI Function Evaluation Topics in This Part Chapter 21 Square-Rooting Methods Chapter 22 The CORDIC.
In section 11.9, we were able to find power series representations for a certain restricted class of functions. Here, we investigate more general problems.
Inverse Trigonometric
H.Melikyan/12001 Inverse Trigonometric Functions.
5.5 – Day 1 Inverse Trigonometric Functions & their Graphs.
Inverse Trigonometric Functions Digital Lesson. Copyright © by Houghton Mifflin Company, Inc. All rights reserved. 2 Inverse Sine Function y x y = sin.
Copyright 2008 Koren ECE666/Koren Part.7b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer.
Recursive Architectures for 2DLNS Multiplication RESEARCH CENTRE FOR INTEGRATED MICROSYSTEMS - UNIVERSITY OF WINDSOR 11 Recursive Architectures for 2DLNS.
9.3 Taylor’s Theorem: Error Analysis yes no.
7 TECHNIQUES OF INTEGRATION. As we have seen, integration is more challenging than differentiation. –In finding the derivative of a function, it is obvious.
P.3 Functions & Their Graphs 1.Use function notation to represent and evaluate a function. 2.Find the domain and range of a function. 3.Sketch the graph.
Inverse Trigonometric Functions
UNIVERSITY OF MASSACHUSETTS Dept
Warm Up Let g(x) = {(1, 3), (2, 5), (4, 10), (-3, 7)}. What is g -1(x)? Write the inverse of the function: f(x) = 2x – 3 Determine whether the function.
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
CSE 575 Computer Arithmetic Spring 2003 Mary Jane Irwin (www. cse. psu
Class Notes 9: Power Series (1/3)
Unconventional Fixed-Radix Number Systems
Inverse Trigonometric Functions
UNIVERSITY OF MASSACHUSETTS Dept
6 The Circular Functions and Their Graphs
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
UNIVERSITY OF MASSACHUSETTS Dept
Presentation transcript:

Copyright 2008 Koren ECE666/Koren Part.9b.1 Israel Koren Spring 2008 UNIVERSITY OF MASSACHUSETTS Dept. of Electrical & Computer Engineering Digital Computer Arithmetic ECE 666 Part 9b Evaluation of Elementary Functions - II

Copyright 2008 Koren ECE666/Koren Part.9b.2 Inverse Trigonometric Functions  Multiplicative normalization  bi=(1+j s i 2 )  where  If g(b i )=  i =arctan(s i 2 ) & y 0 =0  x i complex variable = U i + jV i  Recursive formulas for real and imaginary parts:  (i) U i+1 + j V i+1 = (U i +jV i ) (1+j s i 2 )  (i) U i+1 = U i - s i 2 V i  (i)’ V i+1 = V i + s i 2 U i -i

Copyright 2008 Koren ECE666/Koren Part.9b.3 Final Values of Um and Vm  Relationship between U m, V m and y m :  Substituting b i and g(b i )  Replacing x m and x 0 by real and imaginary parts  (U m + jV m ) (cos  -j sin  ) = K (U 0 +jV 0 )  U m cos  +V m sin  =K U 0  -U m sin  +V m cos  =K V 0  Set V 0 =0 & U 0 =1/K : U m =cos  and V m =sin   K constant if s i  {-1, 1}

Copyright 2008 Koren ECE666/Koren Part.9b.4 Calculate  =arccos C for given C  Select s i 's - U m  C       obtained from y m = ,  Table of arctan(2 ) needed as for sine and cosine  To calculate  =arcsin D select s i 's so that V m  D and     arctan C: V m  0 - tan  =-V 0 /U 0 &  =-arctan(V 0 /U 0 )  Set V 0 =C, U 0 =1: arctan C=-   In summary  s i in {-1, 1} according to signs of V i and U i so that V i+1 is closer to 0 -i

Copyright 2008 Koren ECE666/Koren Part.9b.5 Example: arctan(1.0) in 10-bit Precision  Final result: y 11 =  Equal to “exact” result in 10-bit precision

Copyright 2008 Koren ECE666/Koren Part.9b.6 Approximation Error: Additive normalization  x 0 n-bit fraction - approaches x 0  Error - |  |  2  Evaluate y=F(x 0 ) by calculating  Taylor series expansion:   is of order 2 - last two terms negligible  Error  in y of order  dF/dx| x 0  Magnitude of error depends on function F(x 0 )  Example - exponential function F(x 0 )=e dF/dx| x 0 =e - thus |  |  2 e =2 for x 0  ln 2  Maximum error double size of error in argument  Can be reduced by increasing number of bits in xi -n -(n-1) ln 2 x0x0 x0x0

Copyright 2008 Koren ECE666/Koren Part.9b.7 Approx Error: Multiplicative Normalization  Instead of F(x 0 ) we calculate  Taylor series expansion  Natural logarithm F(x 0 )= ln x 0 Error is  y=F(x 0 )+  +0(  ²)  Error in y: |  |  |  |  2 - satisfactory precision -n-n

Copyright 2008 Koren ECE666/Koren Part.9b.8 Speed-up Techniques: Exponential Function  For i>n/2 - approximately s i 2  Smaller ROM & Replace last n/2 steps by a single operation  Previously canceled at least first (i-1) bits in x i :  z k (k=i, i+ 1, … ) - single bit  To cancel remaining nonzero bits in x i (i  n/2) select s k =z k (k>i)  All remaining s k 's can be predicted ahead of time  In last steps calculate  Since s k =z k - last term is (1+x i )  y m = y i (1+x i )  Called Termination Algorithm -i

Copyright 2008 Koren ECE666/Koren Part.9b.9 Termination Algorithm  Required - fast multiplier  If not available - can still benefit - perform all additions of products in carry-save manner  Also for F(x 0 )=ln x 0  x i has the form:  or  Formula for x i+1  For x i+1  1 select s k =z k for k  i  In parallel calculate  Based on Taylor series for ln (1+s k 2 ) - terminal approximation for i  n/2 : -k

Copyright 2008 Koren ECE666/Koren Part.9b.10 Accelerate Trigonometric Functions  Predict s i 's based on  To obtain constant K - s i restricted to {-1,1}  If replaced by  Deviation from exact value < 2  For i>n/2, may select s k (k  i) from {0,1} and predict s k =z k, where:  Can perform additions for x i, Zi and Wi in carry-save manner  Reexamining series expansion of arctan - may predict s l 's for i  l  3i at once  Corresponding terms added in carry-save adder  For l <n/2 - still use {-1,1} -n

Copyright 2008 Koren ECE666/Koren Part.9b.11 Speeding-Up First steps  0  i  n/2  Use radix > 2  Example: g(bi)=1+ s i r (r - power of 2, say r=2 ) s i  {-(r-1),-(r-2),…,-1,0,1,…,r-1}  q bits of x in a single step - but increased complexity of step - s i has larger range  Some improvement in speed is possible  Another method: allow s i to assume values in {-1, 0,1} - modify selection rule so that probability of s i =0 maximized  Similar to variations of SRT i q

Copyright 2008 Koren ECE666/Koren Part.9b.12 Other Techniques for Evaluating Elementary Functions  (1) Use rational approximations (commonly used in software)  When fast adder and multiplier available and high precision is required; e.g., extended double-precision IEEE floating-point  Hardware implementation of rational approximations can compete with continued summations and multiplications when execution time and chip area are considered  (2) Use polynomial approximations with look-up table

Copyright 2008 Koren ECE666/Koren Part.9b.13 Polynomial Approximations with look-up table  Domain of argument x of f(x) divided into smaller intervals (usually of equal size) - f(x i ) kept in look- up table  Value of f(x) at x calculated based on f(x i ), for x i closest to x, and a polynomial approximation p(x-x i ) for f(x-x i )  Distance (x-x i ) is small - simple polynomial requiring less time than a rational approximation  Overall algorithm has three steps:  (1) Find closest boundary point x i and calculate “reduction transformation” - usually distance d=x-x i  (2) Calculate p(d)  (3) Combine f(x i ) with p(d) to calculate f(x)

Copyright 2008 Koren ECE666/Koren Part.9b.14 Example - Calculating 2 in [-1,1]  32 boundary points x i =i/32, i=0,1,…,31  2 precalculated and stored in look-up table  Step 1: search for x i such that |x-m-x i |  1/64, where m=-1,0,1; calculate d=(x-m-x i ) ln 2  d satisfies e =2, and |d|  (ln 2)/64  Step 2: approximation for e -1 using a polynomial  p 2, p 3 … p k precalculated coefficients of polynomial approximation of e -1 on [-(ln 2)/64, (ln 2)/64 ]  Step 3: reconstruct 2 using  Error bounded by ulp (ulp=2 ) x d x x-m-x i xi d d -52