3 RedundantNumber
3 RedundantNumber
net/publication/262835822
CITATIONS READS
0 577
1 author:
Shadrokh Samavi
McMaster University
322 PUBLICATIONS 1,362 CITATIONS
SEE PROFILE
Some of the authors of this publication are also working on these related projects:
All content following this page was uploaded by Shadrokh Samavi on 04 June 2014.
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 1
Chapter Contents
3.1 Coping with the Carry Problem
3.2 Redundancy in Computer Arithmetic
3.3 Digit Sets and Digit-Set Conversions
3.4 Generalized Signed-Digit Numbers
3.5 Carry-Free Addition Algorithms
3.6 Conversions and Support Functions
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 3
Coping with the Carry Problem
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 4
Radix r = 10, digit set = [0, 18]
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 5
Adding radix-10 numbers with digit set [0, 18]
Convert
[0,36] to
[0,18].
Propagation
only in one
position
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 6
Position sum decomposition [0, 36] = 10 × [0, 2] + [0, 16]
Absorption of transfer digit [0, 16] + [0, 2] = [0, 18]
So, redundancy helps us achieve carry-free addition.
But how much redundancy is actually needed? [0,18] is
too much, [0,11] would do.
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 7
Ideal and practical carry-free addition schemes.
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 8
3.2. Redundancy in Computer
Arithmetic
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 9
Continue on next slide
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 10
Addition of 4 binary numbers with stored-carry
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 11
2-bit encoding for binary stored-carry digits
0 represented as 00
1 represented as 10 or 01
2 represented as 11
6 2 2 operand in [0, 2]
+3 1 1 operand in [0, 1 ]
9 3 3 sum in [0, 3]
1 1 1 1
1 1
01 1 1 1 0
1 2 1 =9
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 13
3.3. Digit Sets and Digit-Set
Conversions
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 14
Example 3.1: Convert from digit set [0, 18] to the digit
set [0, 9] in radix 10.
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 15
Example 3.2: Convert from digit set [0, 2]
to digit set [0, 1] in radix 2.
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 16
Example 3.3: Convert from digit set [0, 18]
to the digit set [–6, 5] in radix 10 (same as
Example 3.1, but with an asymmetric target
digit set)
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 17
Converting [0, 18] to [-6, 5]
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 18
Example 3.4: Convert from digit set [0, 2] to digit
set [–1, 1] in radix 2 (same as Example 3.2, but with
the target digit set [–1, 1] instead of [0, 1])
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 19
3.4. Generalized Signed-Digit
Numbers
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 20
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 21
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 22
Binary vs multivalue encoding of GSD digit sets
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 23
The hybrid example in Fig. 3.8, with a regular pattern of
binary (B) and BSD positions, can be viewed as an
implementation of a GSD system with r = 8
digit set [–4, 7] –1 0 0 to 1 1 1
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 24
3.5. Carry-Free Addition
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 25
Breaking the Carry Chain Using SD
si f ( xi , yi , xi 1 , yi 1 )
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 26
Carry-Free Addition Algorithm
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 27
Signed Digit Addition Hardware
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 28
SD Addition Example
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 29
SD Addition Example (Continued)
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 30
Converting Decimal to SD
Let r = 10, a = 6
Consider the value as xi + yi and use algorithm
xi yi 1 8 2 6
ti 0 1 0 1 0
wi 1 2 2 4
si 2 2 3 4
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 31
Selecting a to Eliminate Carry Chain in SD
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 32
Selecting a to Eliminate Carry Chain in SD
case 1: xi+yi=2a
case 2: xi+yi=a
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 33
Binary SD Addition
In general we have:
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 35
Usefulness of Unmodified Table
Works if operands do not contain 1
If operands contain only 0’s and 1’s, no carry generated.
si wi ti
0 or 1 0 or 1
Example 1 1 .... 1 1 1
0 0 .... 0 0 1
1 1 1 .... 1 1 ti
1 1 .... 1 1 0 wi
1 0 0 .... 0 0 0 si
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 36
Limitations of Table
yi 1 0 1
xi
10
11
00 xi 1 or yi 1 1
1
01
11 01 ti wi
0 00
01 11 ti wi
01
1 00 10 xi 1 or yi 1 0,1
11
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 38
Modified Binary SD Addition Table
xi,yi 00,11 01 01 01 01 11 11
xi-1,yi-1 neither
- neither at least
is
at - -
is one is 1 1 least
1 one is 1
ti+1
0 1 0 0 1 1 1
wi
0 1 1 1 1 0 0
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 39
Repeating Example with Modified Table
0 1 1 1 1 1
1 0 0 1 0 1
0 0 0 1 1 1 ti
1 1 1 0 1 0 wi
1 1 0 1 0 0 si
no carries
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 40
Singed Digit Encodings
two’s complement
Encoding 1 Encoding 2
x xh xl xh xl
0 00 00
1 01 01
1 10 11
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 41
Encoding 1
x h
n 1 ,x h
n2 , , x h
0
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 42
Encoding 2
Satisfies relation
xi = -2xih + xil
This means that xil and xi-1h have the same weight
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 43
Two’s Complement/BSD Conversion
Two’s Complement to SD
Bits can be encoded directly with MSB negative one
BSD to Two’s Complement
One algorithm simpler than complete binary adder
zi is two’s complement result c0 = 0
yi ci zi ci 1 yi ci zi 2ci 1
0 0 0 0 Example -1010
0 1 1 1
yi 0 1 0 1 0
1 0 1 0 ci 1 1 1 1 0 0
1 1 0 0 zi 1 0 1 1 0
1 0 1 1
1 1 0 1
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 44
Binary SD Representations
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 45
implementations for limited-carry addition
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 46
Signed-Digit Number Systems
xi { 1, 2,....,1,0,1,...., 1}
i i
This signed digit (SD) is a new definition of the digit
complement
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 47
Signed-Digit Example
10
xi {9,8,....,1,0,1,....,8,9}
for a total of 19 possible
digits X min 99, X max 99
If n = 2 X [99,99]
ulp 1
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 48
Signed-Digit Example - Redundancy
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 49
Restricting Redundancy
‹#›
Dr. Shadrokh Samavi Isfahan University of Technology 50
Signed-Digit Characteristics
• X = 0 is unique
• Easy to convert
‹#›
View publication stats
Dr. Shadrokh Samavi Isfahan University of Technology 51