Selecting a to Eliminate Carry Chain in SD For no carry, require.

14
Selecting a to Eliminate Carry Chain in SD For no carry, require {, 1, ,1,0,1, , 1, } 1 1 (1) , 1 i i i i i i i i i s aa a a s w t a worst case t restricting w a equation must be true for all x y where t

Transcript of Selecting a to Eliminate Carry Chain in SD For no carry, require.

Page 1: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Selecting a to Eliminate Carry Chain in SD

For no carry, require

{ , 1, ,1,0,1, , 1, }

1

1 (1)

, 1

i

i i i

i

i

i i i

s a a a a

s w t a

worst case t restricting

w a equation

must be true for all x y where t

Page 2: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Selecting a to Eliminate Carry Chain in SD1: 2

(2 ) (1) 2

(1)

2 1 1 ( )

2 :

( ) (1) 0

(1)

1

12 1 ( )

2

11

2

i i

i

i i

i

i

Case x y a

w a r a r

By

a r a or a r upper bound

Case x y a

w a r a r

w r a

By

r a a

ra r or a lower bound

ra r

Page 3: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Binary SD Addition

2 , 1, ( , 1,0,1 )

11 2 !

2

For r a only one digit set

rr a impossible for digit set

Implies no guarantee that si = wi + ti will not produce a carry

Looking at algorithm:Step 1:

1

1

( ) 2

1 1

1 1

0 0

i i i i

i i

i i i

i i

w x y t

if x y

t if x y

if x y

Page 4: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Unmodified Binary SD Addition Table

xi,yi

ti+1

wi

11 1111010100

10

0 0 0 0

01

1

11

1

Step 2: Based on calculation of wi and ti+1

10

1 1

0 1 0 1

i i is w t

Note: redundancy allows choices for wi and ti+1

Page 5: Selecting a to Eliminate Carry Chain in SD For no carry, require.

How Useful is Unmodified Table?

Works if operands do not contain If operands contain only 0’s and 1’s, no carry generated.

1

0 1 0 1or or

i i is w t

1 1 .... 1 1 1

0 0 .... 0 0 11 1 1 .... 1 1

1 1 .... 1 1 0

1 0 0 .... 0 0 0

i

i

i

t

w

s

Example

Why not use this approach to break carry chain for unsigned binary number?

Page 6: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Limitations of Table

1 1

1 01

1 01, 11

.

i i i

i i i

i

If w x y

and t x y

s has carry

0 1 1 1 1 1

1 0 0 1 0 1

1 1 1 1 1 1

1 1 1 0 1 0

* * * * 1 0 0

i

i

i

t

w

s

carries

Example (-9)10 + (29)10

Does not work if operands contain 1

Page 7: Selecting a to Eliminate Carry Chain in SD For no carry, require.

SD Addition Table Choices

11

01

01

1 0

0

1

1

1

1000

1011

11

11

01

01

00

00

ix iy

i it w

i it w

1 1 0,1i ix or y

1 1 1i ix or y

Takagi, 1985

Page 8: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Modified Binary SD Addition Table

xi,yi

xi-1,yi-1 -neither is at least

one is neither is at least

one is - -

ti+1

wi

1101 11010100,11

1

0

0

0

0 0

1

1 1

1

1

0 11

01

1

11

1

Page 9: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Repeating Example with Modified Table

Example (-9)10 + (29)10

0 1 1 1 1 1

1 0 0 1 0 1

0 0 0 1 1 1

1 1 1 0 1 0

1 1 0 1 0 0

i

i

i

t

w

s

no carries

Page 10: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Two SD Encodings

x

Encoding 1

xh xl

Encoding 2

xh xl

0 00 00

1 01 01

1 10 11

4!=24 possible encodingsOnly nine are distinct under permutation and logical negation two’s complement

Page 11: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Encoding 1

Satisfies simple relation

x = xl - xh

and 11 has a valid numerical value of 0.

SD to two’s complement conversion performed by two’s complement subtraction

1 2 0

1 2 0

, , ,

, , ,

l l ln n

h h hn n

x x x

x x x

Page 12: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Encoding 2

Satisfies relation

xi = -2xih + xi

l

This means that xil and xi-1

h have the same weight

Also simplified addition table possible by regrouping bits

1 ˆ, ,l hi i ix and x can be regrouped to form x

Page 13: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Two’s Complement/BSD Conversion

Two’s Complement to SDBits can be encoded directly with MSB negative one

BSD to Two’s Complement

1

0 0 0 0

0 1 1 1

1 0 1 0

1 1 0 0

1 0 1 1

1 1 0 1

i i i iy c z c

12i i i iy c z c

One algorithm simpler than complete binary adder zi is two’s complement result c0 = 0

0 1 0 1 01 1 1 1 0 0

1 0 1 1 0

i

i

i

yc

z

Example -1010

Page 14: Selecting a to Eliminate Carry Chain in SD For no carry, require.

Binary SD RepresentationsRepresentation of a value with the minimum number of non-zero digits – Important in multiplication and division since each zero eliminates an operation

 8 4 2 1

0 1 0 1

1 0 1 1 .

0 1 1 1

1 1 0 1

1 1 1 1

Minimal SD representation of X = 5

X = 5, n = 4, r = 2