Professional Documents
Culture Documents
Chapter 1 - Digital Systems and Binary Numbers
Chapter 1 - Digital Systems and Binary Numbers
Chapter 1 - Digital Systems and Binary Numbers
Binary Numbers
1
Previously Done
Analog versus Digital Systems
Digitization of Analog Signals
Binary Numbers and Number Systems
Number System Conversions
Representing Fractions
2
Today’s Talk
Signed-Magnitude Representation
Signed-Compliment Representation
3
Signed Binary Numbers
Itis usual to represent the sign with a bit
placed in the leftmost position of the binary
number
Sign bit
The Most common notations are:
Signed-magnitude system. Sign
Signbit
bit 00 positive
positive
Sign
Signbit
bit 11 negative
negative
Signed-complement system.
Signed-Magnitude System
•The way we perceive in common arithmetic.
• + for positive and – for negative numbers
01001 +9
11001 –9
Example
Example22
Signed-Magnitude +0 +1 +2 +3 -0 -1 -2 -3
Decimal Value
Signed-Magnitude System
Signed and Unsigned numbers have different interpretations
Example
◦ (R-1) Complement
In Binary 1’s complement
In Decimal 9’s Complement
Diminished Radix (r-1) Complement
Decimal: (10n -1 ) - N
◦ If n=6 then 106-1=1000000-1=999999
◦ 9’s complement of 546700 is 999999-546700=453299
◦ In simple words subtract each digit from 9
Diminished Radix (r-1) Complement
9’s Complement
9 9 9 9 9 9
Find
Findthe
the9’s
9’scomplement
complementofof546700
546700and
and12389
12389
- 5 4 6 7 0 0
4 5 3 2 9 9
The
The9’s
9’scomplement
complementof
of546700
546700isis
999999
999999--546700=
546700=453299
453299
9 9 9 9 9
And
Andthe
the9’s
9’scomplement
complementof
of12389
12389isis
99999- 12389==87610.
99999-12389 87610. - 1 2 3 8 9
8 7 6 1 0
Diminished Radix (r-1) Complement
1’s Complement
Binary: (2n -1 )-N
◦ If n=4 then 24= (16)10= (10000)2
◦ 24 – 1 = (15)10= (1111)2
The
Thecomplement
complement1’s1’sof
of
- 1 0 1 1 0 0 1
1011001
1011001isis0100110
0100110 0 1 0 0 1 1 0
1 1 1 1 1 1 1
The
The1’s
1’scomplement
complementofof
- 0 0 0 1 1 1 1
0001111
0001111isis1110000
1110000 1 1 1 0 0 0 0
Radix (r) Complement
- 546700= 453300 4 5 3 3 0 0
and the 10’s complement of 12389 is
100000 - 12389 = 87611.
1 0 0 0 0 0
- 1 2 3 8 9
8 7 6 1 1
Notice
Noticethat
thatititisisthe
thesame
sameasas9’s
9’s
complement
complement++1.1.
Radix (r) Complement
2’s Complement
1 0 0 0 0 0 0 0
The
The2’s
2’scomplement
1011001
complementofof
1011001isis0100111
0100111
- 1 0 1 1 0 0 1
0 1 0 0 1 1 1
1 0 0 0 0 0 0 0
The
The2’s
2’scomplement
0001111
complementof
0001111isis1110001
1110001
of - 0 0 0 1 1 1 1
1 1 1 0 0 0 1
Fast Computation of 2’s Complement
Method
Method1: 1:
The
The2’s
2’scomplement
complementofofbinary
binarynumber
numberisisobtained
obtainedby
byadding
adding11totothe
thel’s
l’s
complement
complementvalue.
value.
Example:
1’s complement of 101100 is 010011 (invert the 0’s and 1’s)
2’s complement of 101100 is 010011 + 1 = 010100
Fast Computation of 2’s Complement
Method
Method22
The
The 2’s
2’s complement
complement can
can be
be formed
formed by by leaving
leaving all
all least
least significant
significant 0’s
0’s and
and the
the first
first 11
unchanged,
unchanged,and
andthen
thenreplacing
replacingl’s
l’sby
by0’s
0’sand
and0’s
0’sby
byl’s
l’sininall
allother
otherhigher
highersignificant
significantbits.
bits.
Example:
The 2’s complement of 1101100 is
0010100
Leave the two low-order 0’s and the first 1 unchanged, and then replacing 1’s by 0’s and 0’s
by 1’s in the four most significant bits.
Example
Assuming the representation of the number 9 in binary with 8-bits,
we have the following cases:
• However, for 3bit signed number, we can only represent less number of values
• For 000, 001, 010, 011, both 1’s and 2’s complement are correspondingly equal to +0, +1,+2,+3, we don’t
• For 100, its 1’s comp is 011 = -3; its 2’s comp is 100 = -4.
• For 101, its 1’s comp is 010 = -2; its 2’s comp is 011 = -3.
• For 110, its 1’s comp is 001 = -1; its 2’s comp is 010 = -2.
• For 111, its 1’s comp is 000 = -0; its 2’s comp is 001 = -1.
• Bit Pattern 000 001 010 011 100 101 110 111
• The signed-complement conversion table of a 3-bit binary pattern
Signed 1’s complement +0 +1 +2 +3 -3 -2 -1 -0
is value
decimal as follows:
Signed 2’s complement +0 +1 +2 +3 -4 -3 -2 -1
decimal value
Signed Complement System
4-bit system
Positive values Negative values
r’s
r’scomplement
complementof
ofNN==rrn––NN
n
Add
AddMMtoto((rrn––NN);); Result
n
Result==M
M++((rrn––N)
n
N)