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