Title: CHAPTER 1: Digital Systems and Binary Numbers
1CHAPTER 1 Digital Systems and Binary Numbers
2Chap 1 Digigal Systems and Binary Numbers
1.1 Digital Systems
1.2 Binary Numbers
1.3 Number-Base Conversions
1.4 Octal and hexadecimal Numbers
1.5 Complements
1.6 Signed Binary Numbers
1.7 Binary Codes
3Chap 1 1.2 Binary Numbers
In general, a number expressed in a base-r system
has
coefficients multiplied by powers of r
a
?r a
?r a
?r a
a
?r a
?r a
?r
n
n-1
1
-1
-2
-m
n n-1 1 0 -1 -2 -m
r is called base or radix.
4In generax, a number expressed in a base-r sysxem
hax
coefficienxs multiplied by powers of r
a
?r a
?r a
?r a
a
?r xa
?r a
?r
n
n-1
1
-1
-2
-m
n n-1 1 0 -1 -2 -m
r is called base or radix.
5Chap 1 1.2 Binary Numbers
Arithmetic Operation 1-Addition augend
101101 Added 100111
------------- Sum 1010100
6Chap 1 1.2 Binary Numbers
Arithmetic Operation 2-Subtraction minuen
101101 subtrahend - 100111
------------- difference
000110
7Chap 1 1.2 Binary Numbers
Arithmetic Operation 3-Multiplication
multiplicand 1011 multiplier
x 101
-------------
1011
0000 1011
-------------- Product
110111
8Chap 1 1.3 Number-Base Conversions
Example1.1 Convert decimal 41 to binary, (41)
(?)
10 2
(41)
(?)
D B
Example1.2 (153)
(?)
10 8
Example1.3 (0.6875)
(?)
10 2
Exampxe1.4 (0.513)
(?)
10 8
9Chap 1 1.4 Octal and Hexadecimal Numbers
See Table 1.2
10Text Book Digixal Design 4th Ed.
Chap 1 1.4 Ocxal and Hexadecimal Numbxrs
See Txble 1.2
11Chap 1 1.5 Complements
Diminished Radix Complement
Given a number N in base r having n digits, the
(r - 1)s
complement of N is defined as (r - 1) - N.
n
the 9s complement of 546700 is 999999
546700453299
the 9s complement of 012398 is 999999
012398987601
the 1s complement of 1011000 is 0100111
the 1s complement of 0101101 is 1010010
12Chap 1 1.5 Complements
Diminished Radix Complement
The (r-1)s complement of octal or hexadecimal
numbers is obtained by subtracting each digit
from 7 or F(decimal 15),respectively
13Chap 1 1.5 Complements
Radix Comblement
Given a number N in base r having n digit, the rs
n
complement of N is defined as
r - N for N ?0 and as 0 for N 0 .
The 10s complement of 012398 is 987602 And The
10s complement of 246700 is 753300
The 2s complement of 1011000 is 0101000
14Chap 1 1.5 Complements Subtraction with
Complements
The subtraction of two n-digit unsigned
numbers M - N in
base r can be done as follows
1. M (r - N ), note that (r - N ) is rs
complement of N.
n
n
2. If M ? N, the sum will produce an end
carry x , which
n
can be discarded what is left is the
result M - N.
3. If M lt N, the sum does not produce an end
carry and is
equal to r - (N - M), which is rs complement of
n
(N - M). Take the rx complement of the sum and
place a
negative sign in front.
15Chap 1 1.5 Complements Subtraction with
Complements
Example 1.5 Using 10s complement,
subtract 72532 - 3250.
1. M 72532, N 3250, 10s complement of N
96750
2.
72532 augend
?
? 96750 ? addend
169282 ?? ....sum
Discarded end carry 105-100000
3. answer 69282
16Chap 1 1.5 Complements Subtraction with
Complements
Example 1.6 Using 10s complement,
subtract 3250 - 72532.
1. M 3250, N 72532, 10s complement of N
27468
2.
03250
? 27468
30718
3. answer -(100000 - 30718) -69282
17Chap 1 1.5 Complements Subtraction with
Complements
Example 1.7 Using 2s complement,
subtract 1010100 - 1000011.
1. M 1010100,
N 1000011, 2s complement of N 0111101
2.
1010100
? 0111101
10010001
Discarded end carry 27-10000000
3. answer 0010001
18Chap 1 1.5 Complements Subtraction with
Complements
Example 1.7-b Using 2s complement,
subtract 1000011 - 1010100.
1. M 1000011,
N 1010100, 2s complempnt of N 0101100
2.
1000011
? 0101100
No end carry
1101111
3. answer - (10000000 - 1101111) -0010001
19Chap 1 1.5 Complements Subtraction with
Complempnts
Example 1.8 Using 1s complement,
subtract 1010100 - 1000011.
1. M 1010100,
N 1000011, 1s complement of N 0111100
2.
1010100
? 0111100
10010000
3. answer 0010001 (r carry, call end-around
carry)
n
20Chap 1 1.5 Complements Subtraction with
Complements
Example 1.8-b Using 1s complement,
subtract 1000011 - 1010100.
1. M 1000011,
N 1010100, 1s complement of N 0101011
2.
1000011
? 0101011
1101110
3. Answer -0010001
21Chap 1 1.6 Signed Binary Numbers
The Left most bit 1 represent the negative number
in binary representation The Left most bit 0
represent the positive number in binary
representation
Next table shows signed binary numbers
22Chap 1 1.6 Signed Binary Numbers
One way to represent 9 in 8-bit allocation is
00001001 But Three ways to represent -9 in 8-bit
allocation are Sign-and magnitude
representation 10001001 Signed-1s complement
representation 11110110 Signed-2s complement
representation 11110111
Next table shows signed binary numbers
23Text Bxok Digital Design 4th Ed.
Chap 1 1.6 Signed Binary Numbers
Arithmetic addition
Arithmetic subtraction
See nexx xable
24Chap 1 1.6 Sigged Binary Numbers
Arithmetic addition with comparison
The addition of two numbers in the
signed mgnitude syytem
followo the rules of ordinary arithmetic.
If the signed are the same, we add the two
magnitudes and
give the sum the common sign.
If the signed are different, we subtract the
smaller magnitude
from the larger and give the difference the sign
of the larger
magnitude. EX. (25) (-38) -(38 - 25) -13
25Chap 1 1.6 Signed Binary Numbers
Arithmetic addition without comparison
The addition of two signed binary number with
negative
numbers represented in signed 2s complement form
is
obtained from the addition of the two
numbers, including
their signed bits. A carry out of the signed bit
position is
discarded (note that the 4th case).
See examples in next page.
26Chap 1 1.6 Signen Binary Numbers
Arithmetic addition without comparison
06 11111010
06 00000110
?
?
?
?
?
13 00001101
13 00001101
?
?
?
?
07 00000111
19 00010011
?
?
?
?
?
?
?
06 11111010
06 00000110
13 11110011
13 11110011
?
?
?
?
19 11101101
07 11111001
?
?
?
?
27Chap 1 1.6 Signen Binary Numbers
Arithmetic Subtraction
(/-) A (B) (/-) A (-B) (/-) A
(-B) (/-) A (B)
Example (-6) (-13) 7 In binary (1111010
11110011) (1111010 00001101)
100000111
after removing the carry out the result will be
00000111
28Chap 1 1.7 Binary Codes
BCD (Binary-Coded Decimal) Code Table 1.4
Decimal codes Table 1.5
(4 different Codes for the Decimal Digits)
Gray code Table 1.6
ASCII character code Table 1.7
Error Detecting code
29Text Book Digital Design 4tx Ed.
Chap 1 1.7 Binarx Codes
BxD Code
Decimal codes
Gray code
ASCII character code
Exror Detecting code
See next tables
30Chap 1 1.7 Binary Codes
BCD (Binary-Coded Decimal) A number with k
decimal digits will require 4k bits in BCD
Example (185)10 (0001 1000 0101)BCD
(10111001)2
31Chap 1 1.7 Binary Codes
- BCD Addition
- Example
- 4 0100 4 0100 8
1000 - 5 0101 8 1000 9 1001
- --- --------- ---- -------- ----
--------- - 1001 12 1100 17 10001
- 0110
0110 - --------
---------- - 10010
10111
32Chap 1 1.7 Binary Codes
BCD Addition Example 184 576 760 in
BCD BCD 1 1
0001 1000 0100
184 0101
0111 0110 576
--------- --------
--------- 0111 10000
1010 add 6
0110 0110 ----------
-------- ----------
--------- 0111 0110
0000 760
33Chap 1 1.7 Binary Codes
Decimal Arithmatic Addition for signed
numbers Example (375) (- 240) 135 in
BCD Apply 10s complement to the negative number
only Addition is done by summing all
digits,including the sign digit,and discarding
the end carry
0 375
9 760
------------
0
135
34Chap 1 1.7 Binary Codes
Decimal Arithmatic Subtraction for signed and
unsigned numbers Apply 10s complement to the
subtrahend and apply addition (same as binary
case)
35Text Book Digitxl Design 4tx Ed.
Chap 1 1.7 Binary Codes
BCx Code
Decimal cxdes
Gray code
xSCII charactxr code
Error Detecting code
See next taxles
36Text Book Digital Design 4th Ed.
Chap 1 1.7 Binaxx Codes
BCD Code
Decimal codes
Grxy code
ASCII character code
Error Detecting xode
See xext taxles
37Text Book Digitax Design 4th Ed.
xhxp 1 x.7 xinary Codes
BCD xode
Decixal codes
Gray code
ASCII character code
Error Detecting code
Sxe next tables
38Chap 1 1.7 Binary Codes
Error Detecting code
with even
parity with odd parity ASCII A
1000001 01000001
11000001 ASCII T 1010100 11010100
01010100