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 signals ref. 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, Teaching Assistant: 고준범 선생 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 Circuits Chap 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: 300 Total: 1000 Communications: One minute quiz, 수업 전 / 후 면담 Note: Lecture-schedules may be adaptively changed.
5 One Minute Quiz Date: Name: Student ID #: Department: Important topic(s) learned today: Topic(s) hard to understand: Any comments to the professor:
6 CHAPTER 1 INTRODUCTION NUMBER SYSTEMS AND CONVERSION This chapter in the book includes: Objectives Study Guide 1.1Digital Systems and Switching Circuits 1.2Number Systems and Conversion 1.3Binary Arithmetic 1.4Representation of Negative Numbers 1.5Binary 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, 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 Combinational Circuit 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.2Number Systems and Conversion Decimal: Binary: Radix(Base),R to Decimal: Example: Any number system to Decimal * 基數
14 1.2Number Systems and Conversion Hexa-Decimal: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
15 1.2Number Systems and Conversion Decimal Number N to Base-R: integer part Continue until to get a n. Thus divide N by R until we have Q = 0, then we will get ( a n a n-1 … a 2 a 1 a 0 ) R.
16 1.2Number Systems and Conversion rem. = 1 = a 0 rem. = 0 = a 1 rem. = 1 = a 2 rem. = 0 = a 3 rem. = 1 = a 4 0 rem. = 1 = a 5 Example: Decimal to Binary Conversion: From to base 2?
17 1.2Number Systems and Conversion 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 -1 a -2 …a -m ) R.
18 1.2Number Systems and Conversion Process starts repeating here because.4 was previously obtained Example: Convert 0.7 to binary
19 1.2Number Systems and Conversion rem.6 rem.3 Example: Convert (231.3) 4 to base-7
20 1.2Number Systems and Conversion Conversion of Binary to Octal, Hexa-decimal ( ) 2 = ( ) 8, octal ( ) 2 = ( A F 2 9 ) 16, Hexadecimal
21 1.3Binary Arithmetic and carry 1 to the next higher column carries Addition Example:
22 1.3Binary Arithmetic and borrow 1 from the next higher column (indicates a borrow From the 3 rd column) borrows Subtraction Example:
23 *1.3Binary Arithmetic column 2 column 1 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.3Binary Arithmetic 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) MultiplicationMultiply: (13 x11) 10 *For easy hardware implementation, shifting and partial products are needed
25 1.3Binary Arithmetic The quotient is 1101 with a remainder of 10. Division
26 1.4Representation 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 Complement iii) 1’s Complement * only negative numbers are represented differently
27 1.4Representation of Negative Numbers: Integer b n1– b 1 b 0 Magnitude MSB (a) Unsigned number: for positive only b n1– b 1 b 0 Magnitude Sign (b) Signed number: for positive and negative both i) Sign and Magnitude b n2– 0 denotes 1 denotes + – MSB
28 for 4 bits, +0: 0000, +1: 0001,.., +7: : 1000, -1: 1001,.., -7: 1111 for n bits, 2 n-1 positive numbers, 2 n-1 negative numbers 2 zeros: and * Not good for arithmetic operations 1.4Representation of Negative Numbers: Integer i) Sign and Magnitude
29 [1’s and 2’s complement are used for subtraction by adder] ii) 2’s Complement Representation of N for Negative Numbers n: number of bits Ex: N=1100, n=6 Thus N * = 2 6 – 1100 = ) as they are last non zero, subtract from r (=2) subtract from r -1 (=1)
30 Signed Binary Integers (word size n=4) , 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 So only 1 zero in 2’s complement.
31 1.4Representation of Negative Numbers iii) 1’s complement representation for Negative Numbers Example: == 2’s complement: 1’s complement + ‘1’ Thus 1’s complement of N is obtained by complementing each bit of N. So 2’s complement of N is obtained by adding 1 to the 1’s complement of N.
32 1.4Representation of Negative Numbers Complement of N’s complement is N. In other words, magnitude of a negative number represented by a complement can be obtained by complementing it. Ex: : +5, its 2’ complement is – = : -5, its 2’ complement is – = 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 2 n 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= , 1’s com.-> ’s com.->
34 1.4Representation of Negative Number (correct answer) wrong answer because of overflow (+11 requires 5 bits including sign) (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 from the 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.4Representation of Negative Numbers correct answer when the last carry is ignored (this is not an overflow) wrong answer because of overflow (-11 requires 5 bits including sign) Case 5 Case 6 Addition of 2’s complement Numbers correct answer when the carry from the sign bit is ignored (this is not an overflow) Case 4 Discard the carry Care about overflow
36 Detection of Overflow in 2’s ^ ^ : Overflow = carry Cn EOR Cn (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.4Representation of Negative Numbers (correct answer) (end-around carry) (correct answer, no overflow) 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.4Representation of Negative Numbers (end-around carry) (wrong answer because of overflow) Case 6 Addition of 1’s complement Numbers (end-around carry) (correct answer, no overflow) Case 5
39 Addition of end-carry 2’s com. : B – A => B + A* = B+ (2 n – A) = 2 n + (B – A) = 2 n – (A - B) = (A – B)* Thus, when there is a carry 2 n, just ignore the carry (2 n ) 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 + (2 n – 1 – A) = 2 n + (B – A) – 1 = 2n – 1 – (A - B) = (A – B)’ Thus when there is a carry, we want to take (2 n – 1) from the result so that it becomes (B – A). To take the carry means we take 2 n. 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.4Representation of Negative Numbers (end-around carry) Addition of 1’s complement Numbers Addition of 2’s complement Numbers
41 1.5Binary Codes Decimal Digit Code (BCD) Code Excees-3 Code 2-out-of-5 Code Gray Code *To store and process decimal numbers in a computer, various types of coding are possible.
42 Binary Codes for Decimal Digits & 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.5Binary Codes S t a r t 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