Upload
others
View
7
Download
1
Embed Size (px)
Citation preview
1/29
Fundamentals of Logic Design Chap. 1
INTRODUCTION
NUMBER SYSTEMS AND CONVERSION
This chapter in the book includes:
Objectives
Study Guide
1.1 Digital Systems and Switching Circuits
1.2 Number Systems and Conversion
1.3 Binary Arithmetic
1.4 Representation of Negative Numbers
1.5 Binary Codes
Problems
CHAPTER 1
2/29
Fundamentals of Logic Design Chap. 1
Topics introduced in this chapter:
• Difference between Analog and Digital System
• Difference between Combinational and Sequential Circuits
• Binary number and digital systems
• Number systems and Conversion
• Add, Subtract, Multiply, Divide Positive Binary Numbers
• 1’s Complement, 2’s Complement for Negative binary number
• BCD code, 6-3-1-1 code, excess-3 code
Objectives
3/29
Fundamentals of Logic Design Chap. 1
1.1 Digital Systems and Switching Circuits
computation, data processing, control, communication, measurement
Reliable, Integration
Digital systems
Analog – Continuous
- Natural Phenomena
(Pressure, Temperature, Speed…)
- Difficulty in realizing, processing using electronics
Digital – Discrete
- Binary Digit Signal Processing as Bit unit
- Easy in realizing, processing using electronics
- High performance due to Integrated Circuit Technology
4/29
Fundamentals of Logic Design Chap. 1
Binary Digit?
•Two values(0, 1)
•Each digit is called as a “bit”
Binary
•Number representation with only two values (0,1)
•Can be implemented with simple electronics devices
(ex: Voltage High(1), Low(0) ; Switch On (1) Off(0)…)
Good things in Binary Number
5/29
Fundamentals of Logic Design Chap. 1
Switching Circuit
•Combinational Circuit :
•outputs depend on only present inputs, not on past inputs
•Sequential Circuit:
•outputs depend on both present inputs and past inputs
•have “memory” elements
Figure 1-1: Switching circuit
6/29
Fundamentals of Logic Design Chap. 1
1.2 Number Systems and Conversion
3
3
2
2
1
1
0
0
1
1
2
2
3
3
4
4
32101234
).(
RaRaRa
RaRaRaRaRa
aaaaaaaaN R
10
1012
8
375.103
8
373264838784813.147
21012
10 10810710310510978.953
10
210123
2
75.114
311
4
1
2
11208
21212121202111.1011
10
012
16 260715322560161516216102 FA
Decimal:
Binary:
Radix(Base):
Octal-Decimal:
Hexa-Decimal:
7/29
Fundamentals of Logic Design Chap. 1
1.2 Number Systems and Conversion
0
1
1
2
2
1
10121 )( aRaRaRaRaaaaaaN n
n
n
nRnn
011
1
2
2
1
1 remainder , aQaRaRaRaR
N n
n
n
n
122
1
3
3
1
21 remainder , aQaRaRaRaR
Q n
n
n
n
233
4
1
32 remainder , aQaRaRaR
Q n
n
n
n
Conversion of Decimal to Base-R
8/29
Fundamentals of Logic Design Chap. 1
1.2 Number Systems and Conversion
53 2
26 2
13 2
6 2
3 2
1 2
rem. = 1 = a0
rem. = 0 = a1
rem. = 1 = a2
rem. = 0 = a3
rem. = 1 = a4
0 rem. = 1 = a5
210 11010153
Example: Decimal to Binary Conversion
9/29
Fundamentals of Logic Design Chap. 1
1.2 Number Systems and Conversion
m
mRm RaRaRaRaaaaaF
3
3
2
2
1
1321 )(.
11
12
3
1
21 FaRaRaRaaFR m
m
22
21
321 FaRaRaaRF m
m
33
3
32 FaRaaRF m
m
)1(
250.1
2
625.
1
a
F
)0(
500.0
2
250.
2
1
a
F
)1(
000.1
2
500.
3
2
a
F
210 101.625.
Conversion of a decimal fraction to Base-R
Example:
10/29
Fundamentals of Logic Design Chap. 1
1.2 Number Systems and Conversion
8).0(
2
4).0(
2
2).1(
2
6).1(
2
8).0(
2
4).1(
2
7.
Process starts repeating here because .4 was previously
obtained
210 0110 0110 0110 1.07.0
Example: Convert 0.7 to binary
11/29
Fundamentals of Logic Design Chap. 1
1.2 Number Systems and Conversion
104 75.454
31431623.231
45 7
6 7
0 rem.6
rem.3
75).1(
7
25).5(
7
75).1(
7
25).5(
7
75.
710 5151.6375.45
16
54
2 5.41100 0101 1101 0100010111.1001101 CDCD
Example: Convert 231.34 to base-7
Conversion of Binary to Hexa
12/29
Fundamentals of Logic Design Chap. 1
1.2 Number Systems and Conversion
(101011010111 )2
= ( )8, octal
(10111011)2
= ( )8, octal
(1010111100100101)2
= ( )16, Hexadecimal
(1101101000)2
= ( )16, Hexadecimal
Conversion of Binary to Octal, Hexa-decimal
13/29
Fundamentals of Logic Design Chap. 1
1.3 Binary Arithmetic
01 1
10 1
11 0
00 0
and carry 1 to the next column
10
10
10
24 11000
1011 11
1011 13
1111
carries
Addition
Example:
14/29
Fundamentals of Logic Design Chap. 1
1.3 Binary Arithmetic
01 1
10 1
11 0
00 0
and borrow 1 from the next column
1010
00111
11101
1
(indicates
a borrow
From the
3rd column)
1101
11
10000
11 1 1
borrows
101110
0111
111001
11 1
borrows
Subtraction
Example:
15/29
Fundamentals of Logic Design Chap. 1
1.3 Binary Arithmetic
187
18
205
column 2 column 1
187]107 108 101[
]108 101) [
]101510)1010(10)12[(
]108 101 [
]10)510(10)10(102[
]108101 [
]105100102[18205
012
01
012
01
012
01
012
note borrow from column 1
note borrow from column 2
Subtraction Example with Decimal
16/29
Fundamentals of Logic Design Chap. 1
1.3 Binary Arithmetic
111
001
010
000
1014310001111
1101
0000
1101
1101
1011
1101
11000011
1111
)1001011(
1111
)01111(
0000
1111
1101
1111 multiplicand
multiplier
first partial product
second partial product
sum of first two partial products
third partial product
sum after adding third partial product
fourth partial product
final product (sum after adding fourth partial prodoct)
Multiplication Multiply: 13 x11(10)
17/29
Fundamentals of Logic Design Chap. 1
1.3 Binary Arithmetic
10
1011
1101
1011
1110
1011
10010001 1011
1101
The quotient is 1101 with a remainder
of 10.
Division
18/29
Fundamentals of Logic Design Chap. 1
1.4 Representation of Negative Numbers
b n 1 – b 1 b 0
Magnitude
MSB
(a) Unsigned number
b n 1 – b 1 b 0
Magnitude Sign
(b) Signed number
b n 2 –
0 denotes
1 denotes
+
–
MSB
19/29
Fundamentals of Logic Design Chap. 1
1.4 Representation of Negative Numbers
NN n 2*
2’s complement of a positive integer N
Table 1-1: Signed Binary Integers (word length n = 4)
20/29
Fundamentals of Logic Design Chap. 1
1.4 Representation of Negative Numbers
101010
010101
11111112
N
N
n
11)12(2* NNNN nn
NNNN nn )12( and *2
11 222 nnn
NN n )12(
== 2’s complement: 1’s complement + ‘1’
Example:
1’s complement of a positive integer N
21/29
Fundamentals of Logic Design Chap. 1
1.4 Representation of Negative Number
7
4
3
0111
0100
0011
(correct answer)
6
5
1011
0110
0101
wrong answer because of overflow (+11 requires
5 bits including sign)
6
5
1111
1010
0101
(correct answer)
6
5
0001)1(
0110
1011
correct answer when the carry from the sign bit
is ignored (this is not an overflow)
Addition of 2’s complement Numbers
Case 1
Case 2
Case 3
Case 4
22/29
Fundamentals of Logic Design Chap. 1
1.4 Representation of Negative Numbers
7
4
3
1001)1(
1100
1101
correct answer when the last carry is ignored
(this is not an overflow)
6
5
0101)1(
1010
1011
wrong answer because of overflow
(-11 requires 5 bits including sign)
Addition of 2’s complement Numbers
Case 5
Case 6
23/29
Fundamentals of Logic Design Chap. 1
1.4 Representation of Negative Numbers
1
6
5
1110
1001
0101
(correct answer)
(end-around carry)
(correct answer, no overflow)
6
5
0001
1
0000 )1(
0110
1010
(end-around carry)
(correct answer, no overflow)
4
3
1000
1
0111 )1(
1011
1100
Addition of 1’s complement Numbers
Case 3
Case 4
Case 5
24/29
Fundamentals of Logic Design Chap. 1
1.4 Representation of Negative Numbers
(end-around carry)
(wrong answer because of overflow)
6
5
0100
1
0011 )1(
1001
1010
1)(2)12(
) (where :4
ABBABA
ABBACase
nn
1)](12[2)12()12(
)2( :5 1
BABABA
BABACase
nnnn
n
Addition of 1’s complement Numbers
Case 6
25/29
Fundamentals of Logic Design Chap. 1
1.4 Representation of Negative Numbers
)20(
)11(
3111100000
1
11011111 )1(
11101011
11110100
(end-around carry)
11
19
)8(
00010110)1(
00010011
11110001
(discard last carry)
Addition of 1’s complement Numbers
Addition of 2’s complement Numbers
26/29
Fundamentals of Logic Design Chap. 1
1.5 Binary Codes
5 2 . 7 3 9
0101 0010 . 0111 0011 1001
Decimal Digit
8-4-2-1 Code (BCD)
6-3-1-1 Code
Excess-3 Code
2-out-of-5 Code
Gray Code
0 0000 0000 0011 00011 0000
1 0001 0001 0100 00101 0001
2 0010 0011 0101 00110 0011
3 0011 0100 0110 01001 0010
4 0100 0101 0111 01010 0110
5 0101 0111 1000 01100 1110
6 0110 1000 1001 10001 1010
7 0111 1001 1010 10010 1011
8 1000 1011 1011 10100 1001
9 1001 1100 1100 11000 1000
27/29
Fundamentals of Logic Design Chap. 1
1.5 Binary Codes
6-3-1-1 Code:
00112233 awawawawN
811110316 N
ASCII Code
1010011 1110100 1100001 1110010 1110100
S t a r t
28/29
Fundamentals of Logic Design Chap. 1
1.5 Binary Codes
Table 1-3
ASCII code
(incomplete)