Outline Digital CMOS Design Arithmetic Operators Adders Comparators Shifters Multipliers Square rooting Pirouz Bazargan Sabet Digital Design February 2010
Square root An real number � � using floating point representation � � Find a real number � � such as � � ( ) 2 + ε = x y o Calculation cannot be implemented in hardware o Need iterative operation Pirouz Bazargan Sabet Digital Design February 2010
Square root o Direct method digit-by-digit 2 o Indirect method − y = x 0 resolve Pirouz Bazargan Sabet Digital Design February 2010
Square root - direct Find x such as x = y [ [ ( ) 0 E ∈ M 1 , 2 = − × × 1 2 y M With E ( ) 0 = − × × 1 2 2 y M E odd ? ( ) 0 ′ [ [ 2 E ′ = − × × ′ y 1 M 2 ∈ M 1 , 4 With ( ) 0 ′ E ′ = = − × × x y 1 M 2 ( ) [ [ 0 ′ E = − × × x 1 X 2 ∈ 1 , 2 X With Pirouz Bazargan Sabet Digital Design February 2010
Square root - direct ( ) 0 ′ [ [ 2 E ′ = − × × ′ y 1 M 2 ∈ M 1 , 4 With x = Find x such as y ( ) [ [ 0 ′ E = − × × x 1 X 2 ∈ X 1 , 2 With − n � i = × X x 2 i = i 0 Iterate on i and evaluate x i Pirouz Bazargan Sabet Digital Design February 2010
Square root - direct Pirouz Bazargan Sabet Digital Design February 2010
Square root o Direct method digit-by-digit 2 o Indirect method − y = x 0 resolve Pirouz Bazargan Sabet Digital Design February 2010
Square root - indirect Resolving a non ( ) f x y linear equation tangent ( ) = f x 0 initial guess x new estimation Pirouz Bazargan Sabet Digital Design February 2010
Square root - indirect ( ) = f x 0 Resolving a non linear equation x Taylor series in the neighborhood of 0 1 ( ) ( ) ( )( ) ( )( ) 2 � ′ ′ ′ = + − + − + f x f x f x x x f x x x 0 0 0 0 0 2 ( ) ( ) ( )( ) 1 st order : ′ ≈ + − f x f x f x x x 0 0 0 Pirouz Bazargan Sabet Digital Design February 2010
Square root - indirect ( ) = f x 0 Resolving a non linear equation Iterative resolution starting from an initial guess x 0 ( ) ( ) ( )( ) ′ ≈ + − f x f x f x x x 0 0 0 ( ) ( ) ( )( ) ′ = + − = f x 0 f x f x x x 0 0 0 0 ( ) − f x 0 = + x x ( ) 0 ′ f x 0 Newton-Raphson method Pirouz Bazargan Sabet Digital Design February 2010
Square root - indirect Resolving x = y ( ) = f x 0 x = y Find a function f such as for ( ) 2 = − f x x y ( ) ( ) ( )( ) ′ ≈ + − f x f x f x x x 0 0 0 ( ) ( ) ( ) 2 ≈ − + − f x x y 2 x x x 0 0 0 ( ) � � 2 − y x 1 y ( ) � � = f x 0 0 = + = + x x x x � � 0 0 � � 2 x 2 x 0 0 Pirouz Bazargan Sabet Digital Design February 2010
Square root - indirect Resolving x = y � � 1 y � � Each iteration = + x x � � + i 1 i � � 2 x i division !! Hard to implement ( ) 2 = − f x x y Pirouz Bazargan Sabet Digital Design February 2010
Square root - indirect Resolving x = y 1 ( ) ( ) = = = f f u x 0 0 u x = y Find a function f such as for y ( ) − 2 = − f u u y ( ) ( ) ( )( ) ′ ≈ + − f u f u f u u u 0 0 0 ( ) ( ) − − ( ) 2 3 ≈ − − − f u u y 2 u u u 0 0 0 ( ) − 2 − u y 1 ( ) ( ) 2 = f u 0 0 = + u u = − u u 0 3 u y 0 − 3 0 2 u 2 0 Pirouz Bazargan Sabet Digital Design February 2010
Square root - indirect Resolving x = y 1 ( ) 2 Each iteration = − u u 3 u y + i 1 i i 2 multiply !! 1 y = = = = ⋅ u x y u y y y Pirouz Bazargan Sabet Digital Design February 2010
Square root - indirect 1 Resolving x = = y u y [ [ ( ) 0 E ∈ M 1 , 2 = − × × 1 2 y M with E ( ) 0 = − × × 1 2 2 y M E odd ? ( ) 0 ′ [ [ 2 E ′ = − × × ′ y 1 M 2 ∈ M 1 , 4 with ( ) 0 ′ E ′ = − × × y 1 M 2 ′ M ( ) 0 ′ E = − × × 1 2 y ′ M Pirouz Bazargan Sabet Digital Design February 2010
Square root - indirect 1 Resolving x = = y u y Initial guess 1 [ [ ′ ∈ M 1 , 4 = u with M ′ ′ M ] ] ∈ u 0 . 5 , 1 4 2 u 1 1 0.5 0.707 Pirouz Bazargan Sabet Digital Design February 2010
Recommend
More recommend