1 digital convergence! smart phone: it + telecommunication + consumer electronics + entertainment...
TRANSCRIPT
1
Digital Convergence!• Smart Phone: IT + Telecommunication + Consumer Electronics + Entertainment
• Analog vs Digital system Ex: Watch, LP vs CD, Camera
- Why Digital?- Representation? Continuous vs Discrete Signals (value, time)
continuous: discrete-time, analog: digital- Noise?, Accuracy?Resolution: # of digits used to represent the signals
• Digital circuits: process digital input signals and output digital signalsref. Analog to Digital Converter, D/A Converter
• Digital logic: fundamental theories and practices for designing the digital circuits
• Course Objectives:- Learn to analyze and design digital circuits; namely, combinational circuits and sequential circuits.
2
Digital Logic
• Professor:김 재희 교수B619, [email protected]
• Teaching Assistant:고준범 선생
2123-4537 B618
• Homepage:cherup.yonsei.ac.kr
3
Digital Logic• Text: Fundamentals of Digital Logic, by Charles H. Roth, Jr., 6th Edition
Reference: Computer Engineering: Hardware Design, by Mano more..
• Course Objective: 컴퓨터를 포함한 여러 디지탈 시스템의 구성 요소가 되는 , 다양한 디지탈 회로를 이해하고 설계할 수 있는 기법을 익힘 .
• Summary of Course:Boolean Algebra, Logic Gates, Design of Combinational Circuits, Multiplexers, Programmable Logic Devices, Latches and Flip-Flops, Registers and Counters, Design of Sequential CircuitsChap 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 13, 14, 15, 16
• Related Courses (H/W): Digital Electronics, Computer Architectures, Operating System Digital Logic Experiments, Digital System Design
4
Digital Logic
• Evaluation: 수업계획서의 일정을 원칙으로 실시 , 조정 가능
Exams (3 hrs.) : 300 (mid), 400(final)Homework, etc: 300Total: 1000
• Communications: One minute quiz, 수업 전 / 후 면담
• Note:Lecture-schedules may be adaptively changed.
5
One Minute Quiz
• Date: 2012. Name: Student ID #:• Department:
• Important topic(s) learned today:
• Topic(s) hard to understand:
• Any comments to the professor:
6
CHAPTER 1
INTRODUCTIONNUMBER SYSTEMS AND CONVERSION
This chapter in the book includes:ObjectivesStudy Guide
1.1 Digital Systems and Switching Circuits1.2 Number Systems and Conversion1.3 Binary Arithmetic1.4 Representation of Negative Numbers1.5 Binary Codes
7
Objectives
Topics introduced in this chapter:
• Difference between Analog and Digital Systems
• 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, ASCII code etc
8
1.1 Digital Systems and Switching Circuits
• Digital systems: used in computation, data processing, control, communication, measurement, etc
- Accurate, Reliable, Integration• 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
9
Binary Digit?
• Binary:- Two values(0, 1)
- Each digit is called as a “bit”
- Number representation with only two values (0,1)
- Can be implemented with simple electronics devices
(ex: Voltage High(1), Low(0) ; positive logic <-> negative
Switch On (1) Off(0)…)
Good things in Binary Number
10
Switching Circuit
• Combinational Circuit :
outputs depend on only present inputs, not on past inputs
Boolean algebra in Unit 2 & 3 used to describe I/O relations.
*takes on discrete values
11
Sequential Circuit
Memory
CombinationalCircuit
Sequential Circuit: - outputs depend on both present inputs and past inputs - have “memory” function
12
Design Levels of Digital Systems
• System Design:Memory unit, ALU, I/O devices, etc(Computer System Architectures)
• Logic Design:Logic gates, F/F, etc for a specific function(Digital Logic)
• Circuit Design:Resistors, diodes, transistors to form a gate, F/F, or other logic building block(Digital Electronics)Refer to Appendix A
13
1.2 Number Systems and Conversion
33
22
11
00
11
22
33
44
32101234
).(
RaRaRa
RaRaRaRaRa
aaaaaaaaN R
10
10128
375.1038
373264838784813.147
2101210 10810710310510978.953
10
2101232
75.114
311
4
1
2
11208
21212121202111.1011
Decimal:
Binary:
Radix(Base),R
to Decimal:
Example:
Any number system to Decimal
*基數
14
1.2 Number Systems and Conversion
10012
16 260715322560161516216102 FAHexa-Decimal:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
15
1.2 Number Systems and Conversion
01
12
21
10121 )( aRaRaRaRaaaaaaN nn
nnRnn
0111
22
11 remainder , aQaRaRaRa
R
N nn
nn
1221
33
121 remainder , aQaRaRaRa
R
Q nn
nn
2334
132 remainder , aQaRaRa
R
Q nn
nn
Decimal Number N to Base-R: integer part
Continue until to get an. Thus divide N by R until we have Q = 0, then
we will get (anan-1 … a2a1a0)R.
16
1.2 Number Systems and Conversion
532
262
132
62
32
12
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: From 5310 to base 2?
17
1.2 Number Systems and Conversion
1 2 31 2 3 1 2 3(0. ) m
m R mF a a a a a R a R a R a R
1112
31
21 FaRaRaRaaFR mm
2221
321 FaRaRaaRF mm
333
32 FaRaaRF mm
)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 F to Base-R
Example: From .625 to base 2
Thus multiplying F by R continuously, we will get (.a-1a-2…a-m)R.
18
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 previouslyobtained
10 20.7 0.1 0110 0110 0110
Example: Convert 0.7 to binary
19
1.2 Number Systems and Conversion
24 10
3231.3 2 4 3 4 1 45.75
4
457
67
0 rem.6
rem.3
75).1(
7
25).5(
7
75).1(
7
25).5(
7
75.
710 5151.6375.45
Example: Convert (231.3)4 to
base-7
20
1.2 Number Systems and Conversion
Conversion of Binary to Octal, Hexa-decimal
• (101 011 010 111 )2
= ( 5 3 2 7 )8, octal
• (1010 1111 0010 0101)2
= ( A F 2 9 )16, Hexadecimal
{ { { {2 1654
1001101.010111 0100 1101 . 0101 1100 4 .5CD
D C
21
1.3 Binary Arithmetic
01 1
10 1
11 0
00 0
and carry 1 to the next higher column
10
10
10
1 1 1 1
13 1 1 0 1
11 1 0 1 1
1 1 0 0 0 24
carries
Addition
Example:
22
1.3 Binary Arithmetic
01 1
10 1
11 0
00 0
and borrow 1 from the next higher column
1010
00111
11101
1
(indicatesa borrowFrom the3rd column)
1101
11
10000
11 1 1
borrows
101110
0111
111001
11 1
borrows
Subtraction
Example:
23
*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;
* borrow 1 from column n means subtract 1 from n and add 10 to column n-1
24
1.3 Binary Arithmetic
111
001
010
000
1014310001111
1101
0000
1101
1101
1011
1101
1111
1101
1111
0000
(01111)
1111
(1001011)
1111
11000011
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
product)
Multiplication Multiply: (13 x11)10
*For easy hardwareimplementation,shifting andpartial productsare needed
25
1.3 Binary Arithmetic
10
1011
1101
1011
1110
1011
10010001 1011
1101
The quotient is 1101 with a remainderof 10.
Division
26
1.4 Representation of Negative Numbers: Integer
(a) Unsigned number: for positive only
(b) Signed number: for positive and negative both i) Sign and Magnitude
ii) 2’s Complementiii) 1’s Complement
* only negative numbers are represented differently
27
1.4 Representation of Negative Numbers: Integerbn 1– b1 b0
Magnitude
MSB
(a) Unsigned number: for positive only
bn 1– b1 b0
MagnitudeSign
(b) Signed number: for positive and negative both i) Sign and Magnitude
bn 2–
0 denotes1 denotes
+
–MSB
28
• for 4 bits,+0: 0000, +1: 0001, .. , +7: 0111
-0: 1000, -1: 1001, .. , -7: 1111• for n bits,
2n-1 positive numbers, 2n-1 negative numbers
2 zeros: 000..0 and 100..0
* Not good for arithmetic operations
1.4 Representation of Negative Numbers: Integer
i) Sign and Magnitude
29
[1’s and 2’s complement are used for subtraction by adder]
NN n 2*
ii) 2’s Complement Representation of N for Negative Numbers
n: number of bits
Ex:
N=1100, n=6
Thus N* = 26 – 1100 = 1000000 -) 001100
-------------- 110100
as they arelast non zero, subtract from r (=2)subtract from r -1 (=1)
30
Signed Binary Integers (word size n=4)
1111
1110
1101
1100
1011
1010
1001
1000
-
- , 1)*
1111
1110
1101
1100
1011
1010
1001
1000
1000
1001
1010
1011
1100
1101
1110
1111
-
-0
-1
-2
-3
-4
-5
-6
-7
-8
0000
0001
0010
0011
0100
0101
0110
0111
+0
+1
+2
+3
+4
+5
+6
+7
1’s complement 2’s complement N*
Sign and
magnitude
Negative integers
-N
Positive
integers
(all systems)+N N
1)* There is no – 0, but + 0 is 000..0. So only 1 zero in 2’s complement.
31
1.4 Representation of Negative Numbers
2 1 111111
001100
110011
n
N
N
11)12(2* NNNN nn
iii) 1’s complement representation for Negative Numbers
NN n )12(
Example:
== 2’s complement: 1’s complement + ‘1’
Thus 1’s complement of N isobtained by complementingeach bit of N.
So 2’s complement of N is obtained by adding1 to the 1’s complementof N.
32
1.4 Representation of Negative Numbers
2 * = 2 - (2 ) N
(2 1) (2 1) ((2 1) )
n n n
n n n
N N
N N N
Complement of N’s complement is N.In other words, magnitude of a negativenumber represented by a complement can be obtained by complementing it.
Ex: 0 0101 : +5, its 2’ complement is 100000 – 00101 = 11011 1 1011 : -5, its 2’ complement is 100000 – 11011 = 00101
Thus, Complement is not just to represent negative of positive numbers, but to represent negative of negative numbers.
33
2’s complement of N
• Subtract from 2n
• Add 1 to 1’s complement of N• Starting from the right-most bit,
change the first 1 to 0 and complement all the left-side remaining.
for N=010011000, 1’s com.->101100111 2’s com.->101101000
34
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 requires5 bits including sign)
6
5
1111
1010
0101
(correct answer)
Case 1
Case 2
Case 3
Addition of 2’s complement Numbers
* Addition is carried out just as if all the numbers were positive, and any carry fromthe sign position is ignored. Subtraction is done by taking the complement of the Minuend. Overflow occurs when correct sum requires one more bit.
35
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)
Case 5
Case 6
Addition of 2’s complement Numbers
6
5
0001)1(
0110
1011
correct answer when the carry from the sign bitis ignored (this is not an overflow)
Case 4
Discard the carryCare about overflow
36
Detection of Overflow in 2’s
^ ^ : Overflow = carry Cn EOR Cn-1+5 0 1 0 1 -5 1 0 1 1+6 0 1 1 0 -6 1 0 1 0--------------------- -------------------+11 1 0 1 1 -11 (1) 0 1 0 1
1. Overflow occurs when the sign of sum is different from the sign of the two positive or negative numbers.
2. Overflow can be also detected by observing the carry bits:
=> Overflow = (Carry at Cn) EOR (Carry at Cn-1)
37
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
Case 3
Case 4
Addition of 1’s complement Numbers
Instead of discarding the last carry, carry is added to the n-bit sum. => end-around carry
38
1.4 Representation of Negative Numbers
(end-around carry)(wrong answer because of overflow)
6
5
0100
1
0011 )1(
1001
1010Case 6
Addition of 1’s complement Numbers
(end-around carry)(correct answer, no overflow)
3
4
1000
1
0111 )1(
1011
1100Case 5
39
Addition of end-carry
2’s com. : B – A => B + A* = B+ (2n – A) = 2n + (B – A) = 2n – (A - B) = (A – B)* Thus, when there is a carry 2n, just ignore the carry (2n) and the result becomes (B – A), correctly. Otherwise if there is no carry, result is 2’s complement of (A - B) which is - (A - B) = (B-A) It occurs when A > B.
1’s com. : B – A => B + A’ = B + (2n – 1 – A) = 2n + (B – A) – 1 = 2n – 1 – (A - B) = (A – B)’
Thus when there is a carry, we want to take (2n – 1) from the result so that it becomes (B – A). To take the carry means we take 2n.
So, we want to add 1 (end-carry) to the result.If there is no carry, result is (A – B) represented by
1’s complement form. It occurs when A >= B.
40
1.4 Representation of Negative Numbers
)20(
)11(
11110100
11101011
(1) 11011111
1
11100000 31 (end-around carry)
11
19
)8(
00010110)1(
00010011
11110001
(end-around carry)
Addition of 1’s complement Numbers
Addition of 2’s complement Numbers
41
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
Excees-3
Code
2-out-of-5
Code
Gray
Code
0
1
2
3
4
5
6
7
8
9
0000
0001
0010
0011
0100
0101
0110
0111
1000
1001
0000
0001
0011
0100
0101
0111
1000
1001
1011
1100
0011
0100
0101
0110
0111
1000
1001
1010
1011
1100
00011
00101
00110
01001
01010
01100
10001
10010
10100
11000
0000
0001
0011
0010
0110
1110
1010
1011
1001
1000
*To store and process decimal numbers in a computer, various types of coding arepossible.
42
Binary Codes for Decimal Digits
• 8-4-2-1 & 6-3-1-1 are weighted.• Excess-3 is self-complemented.• 2-out-of-5 is non-weighted and error
checked for only two bits are 1’s.• Gray code is for minimal change of
‘1’ bits to increase and also used for error correction.
43
1.5 Binary Codes
00112233 awawawawN
811110316 N
1010011 1110100 1100001 1110010 1110100
S t a r t
6-3-1-1 Code:
ASCII Code
Graphic Characters: 94 as in Table 1-3.Control Characters: 34 including ESC, DEL, SP, BS, etc.
Table 1-6 in Ref. Mano
44
Homework
• HW. Unit 1: 4, 7, 8. 13, 15, 25, 27