Title: FixedPoint Negative Numbers
1Fixed-Point Negative Numbers
- Two Common Forms
- Signed-Magnitude Form
- Complement Forms
Signed-Magnitude Numbers
- First Digit is Sign Digit, Remaining n-1 are the
Magnitude - Convention (binary)
- 0 is a Positive Sign bit
- 1 is a Negative Sign bit
- Convention (non-binary)
- 0 is a Positive Sign digit
- ? -1 is a Negative Sign digit
- Only 2 ? n-1 Digit Sequences are Utilized
2Signed-Magnitude Example
Largest Representable Value is
3Signed-Magnitude Example (cont)
4Signed-Magnitude Ternary Example
Notice that fractional part is infinite in ?10
but finite in ?3
5Signed-Magnitude Ternary Bounds
Positive Numbers
Negative Numbers
Range
6Signed-Magnitude Comments
- Two Representations for zero, 0 and 0
- Addition of K and K is not zero
- EXAMPLE
- Disadvantage since algorithm requires comparison
of signs and, if different, comparison of
magnitudes
10001010.002 00001010.002 10010100.002
-10101010 Yields a Sum of 2010!!!!!
7Complement Representations
- Two Types of Complement Representations
- Radix Complement (binary 2s-complement)
- Diminished-Radix Complement (binary
1s-complement) - Positive Values Represented Same Way as Signed
Magnitude for Both Types - Negative Value, -Y, Represented as R-Y Where R is
a Constant - Obeys the Identity
- Advantage is No Decisions Needed Based on
Operand Sign Before Operations are Applied
8Complement Representation Example
- X is Positive, Y is Negative, Compute X Y
Using Complement Representation
- If Y gt X, Then the Answer is R - (Y - X)
- If X gt Y, Then the Answer Should be X - Y
- But X (R - Y) R (X - Y),
- Thus R Must be Discarded!
- Solution is to Choose the Value of R Carefully
9Requirements for Complementation Value, R
- Select R to Simplify (or Eliminate) Correction
for the X gt Y Case - Calculation of Complement of Y or (R-Y) Should be
Simple and Fast - Definition of Complement for Single Digit, xi
- Definition of Digit Complement for a Word, X
10Complementation Value, R
- Add Word and Complement Together
Answer to Addition
Now Add 1 ulp
11Radix-Complement Form
- The Radix Complement Form is Defined When
- Using ? k is Convenient Since Storing Result in
Register of Length n Causes MSD of 1 to be
Discarded due to Finite Register Length - Therefore, it is Easy to Compute the Complement
of X by - Take the Digit Complement of X
- Add 1ulp to Complement
12Radix-Complement Form (cont)
- No Correction is Needed When We have Positive X
and Negative Y Such That
- And ? k is discarded Due to Finite Register Length
13Radix-Complement Example
- Since n m k ? m 0
- Therefore 1 ulp 20 1
- Given X, the radix complement (2s complement) is
- Range of Positive Numbers is 0000,0111
- 2s Complement of Largest, 0111
- In Radix Complement, There is a Single
Representation of Zero(0000) and Each Positive
Number has Corresponding NegativeNumber With
MSB1
14Radix-Complement Example
- In Radix Complement, There is a Single
Representation of Zero(0000) and Each Positive
Number has Corresponding NegativeNumber With
MSB1 - Accounts for 1(zero)7(pos.)7(neg.), But Extra
Bit Pattern Left - One Additional Negative Number, 10002-810,
-810?X?710
15Diminished-Radix Complement
- In Diminished Radix Complement, the
Complementation Process is Easier Since the
Addition of 1 ulp is Avoided
- Range of Positive Numbers is 00002,01112010,
710 - 1s Complement of Largest is 10002 -710
- 1s Complement of Zero is 11112
- Two Representations of Zero!
- In All Cases MSB is Sign Bit
16Comparison of Twos Complement, Ones Complement
and Signed-Magnitude
17Signed-Number Arithmetic
- Signed Magnitude Only Use Magnitude Digits
Carry-out ? Overflow
18Radix-Complement Arithmetic
- Radix Complement In this case 2s Complement
Carry-out Does NOT Mean Overflow
192s-Complement Overflow
- If X, Y have opposite signs overflow never
occurs whether carry-out exists or not
No Carry-out
Carry-out
- If X, Y have same sign and result sign differs,
overflow occurs
No Carry-out,Overflow
Carry-out, Overflow
201s-Complement Overflow
- Ones complement carry-out indicates a
correction is needed
- If X gt Y, then answer should be X-Y however
registercontains X-Y-ulp since 2n is carry-out
bit, therefore mustcorrect by adding 1 ulp
21Example of 1s-Complement Overflow
NeedCorrectionSinceOverflow
So-called end-around carry
22End-Around Carry Design
Carry-out
- This is end-around carry always add
carry-out to LSD
23Other Number Systems
- Binary Number Systems are Most Common
- In terms of building fast systems, we should
consider - Negative Radix
- Signed Digit
- Log (logarithm)
- Signed Log
- Complex Radix
- Mixed Radix
- Residue Number Systems
24Negative-Radix Fixed-Position Systems
Nega-decimal example
25Nega-Decimal Number System
Largest Positive Value, Xmax
Smallest Value, Xmin
Finite Register Length, n3 digits
Asymmetric System!!! 10 times more positive
than negative values represented
26Nega-Decimal Number System
Finite Register Length, n4 digits
Now more Negative Values than Positive
Nega-decimal System Characteristics
- Arithmetic Operations Same Regardless of Sign of
Number - No Signed Digit/Complement Representation Needed
- Sign of X Determined by Position of First
Non-zero Digit
27Nega-Binary Number System
Negative Radix
Example
How is this Addition Operation Performed?????
28Nega-Binary Number System
wi Values
(5)10
(-3)10
(114-2)10
(000)10
(4416-8)10
(0-8-8)10
(5-32)-10
Carry-out
29Nega-Binary Adder Design
- Individual Adder Cells Produce Two Carry-out
Bits - Design a Circuit at Gate Level for a 4-Digit
Nega-Binary Adder - Hint Cout Functions Should Look Familiar!