3.01k likes | 3.13k Views
Digital Logic Design. Nguyen Thanh Kien Department of Computer Engineering Faculty of Information Technology Hanoi University of Technology. About. Author: Nguyen Thanh Kien Office: Department of Computer Engineering Faculty of Information Technology Hanoi University of Technology
E N D
Digital Logic Design Nguyen Thanh KienDepartment of Computer EngineeringFaculty of Information TechnologyHanoi University of Technology
About • Author: Nguyen Thanh Kien • Office: Department of Computer Engineering Faculty of Information Technology Hanoi University of Technology • Mobile: +84 983 588 135 • Email: kiennt-fit@mail.hut.edu.vn thanhkien84@yahoo.com ftp://dce.hut.edu.vn/kiennt
Content 1. Introduction 2. Function Minimization Methods 3. Larger Combinational Systems 4. Sequential Systems 5. Hardware Design Languages
Acknowledge • The following materials are used as reference for this slide: • “Logic Circuits” slide, Dr. Trinh Van Loan. • Introduction to Logic Design, 2nd Ed, Alan B. Marcovitz, Mc. Graw Hill,2005 • Foundation of Digital Logic Design, G.Langholz, A. Kandel, J. Mott, World Scientific, 1998
Reference textbooks • Introduction to Logic Design, 2nd Ed,, Alan B, Marcovitz, Mc. Graw Hill,2005 • Foundation of Digital Logic Design, G.Langholz, A. Kandel, J. Mott, World Scientific, 1998
Grading policy • Homework: 20% • Lab work: 20% • Midterm: 30% • Final Exam (multichoice and writing): 30%
1. Introduction 1.1. Review of Number Systems 1.2. Switching Algebra and Logic Circuits
1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes
1.1. Review of Number Systems • 1.1.1 Number Representation • 1.1.2 Binary Addition • 1.1.3 Signed Numbers • 1.1.4 Binary Subtraction • 1.1.5 Binary Coded Decimal (BCD) • 1.1.6 Other Codes
1.1.1. Number Representation • Numbers are normally written using a positional number system: • Base/radix: b (the number of digits) • Digits: 0..(b-1) • 0 ≤ ai ≤ (b-1) • Binary: b=2, digits:0,1 • Decimal: b=10, digits: 0,1,2,3,4,5,6,7,8,9 • Octal: b=8, digits: 0,1,2,3,4,5,6,7 • Hexadecimal: b=16, digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
1.1.1. Number Representation 11101.11(2) = 1x24+1x23+1x22+0x21+1x20+1x2-1+1x2-2= 29.75(10)
1.1.1. Number Representation • Decimal: • b=10 • Digits: 0,1,2,3,4,5,6,7,8,9 • Eg: 539.45(10) = 5x102+3x101+9x100+4x10-1+5x10-2 ai = 0..9
1.1.1. Number Representation • Binary: • b=2 • Digits: 0,1 • Eg: 1011.011(2) = 11 + 0*2-1 + 1*2-2+1*2-3=11 + 0 + 0.25 + 0.125 = 11.375(10) bit – binary digit ai = 0,1
1.1.1. Number Representation • Binary (cnt’) • n-bit binary number can represent which range? • an-1...a1a0 from 0 to 2n-1 • MSB – Most Significant Bit • LSB – Least Significant Bit 0001 = 1 1001 = 9 0010 = 2 1010 = 10 0011 = 3 1011 = 11 0100 = 4 1100 = 12 0101 = 5 1101 = 13 0110 = 6 1110 = 14 0111 = 7 1111 = 15 1000 = 8
1.1.1. Number Representation • Octal: • b=8 • Digits: 0,1,2,3,4,5,6,7 • Eg: 503.071(8) = 5x82 + 0x81 + 3x80 + 0x8-1 + 7x8-2 + 1x8-3 ai = 0..7 • Hexadecimal: • b=16 • Digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F • Eg: 1010 0011(2)= A3(16) 503.071(16) = 5x162 + 0x161 + 3x160 + 0x16-1 + 7x16-2 + 1x16-3 ai = 0..F
Convert from base b to base 10 • Base b to base 10 conversion • Eg:0 • 1010.11(2)= 10.75 • 1010.11(8)= 0*80+1*81+0*82+1*83 + 1*8-1+1*8-2 = 0+8+0+512+0.125+0.015625 • A12(16)= 10572 = 2*160 + 1*161 + 10*162 = 2 + 16 + 2560= 2578
110.011(2)=?(10) 6.375 110.011(8)=?(10) 72.0175 110.011(16)=?(10) 272.039...
Convert from base 10 to base b • Base 10 to base b conversion • For integer part: • Divide integer part by b until the result is 0 • Write remainders in reverse order to get the converted result. • For the odd part after “.” • Multiply by b until the result is 0
Convert from base 10 to base 2 • The odd part after “.” • 0.625 x 2 = 1.25 • 0.25 x 2 = 0.5 • 0.5 x 2 = 1.0 • Eg1: 6.625(10) = ?(2) • The integer part • Eg2: 20.75(10) = ?(2) 6.625(10) = 110.101(2)
20.75(10) = ?(2) 10100.11(2) • 20 2 0.75 * 2 = 1.5 • 0 10 2 0.5 * 2 = 1.0 • 0 5 2 • 1 2 2 • 0 1 2 • 1 0
20.75(10)=?(8) =10100.11(2) = 24.6(8) • 20 8 0.75 * 8 = 6.0 • 4 2 8 • 2 0
Convert from base 2 to base 2n • Group from right to left n-bit groups and replace the equivalent values in base 2n • Eg: • 101011(2) = ?(8) 1010.110(2)=12.6(8) • 101011(2) = ?(16) 1010.110(2)=A.C(16)
Convert from base 2n to base 2 • Each digit in base 2n is replaced by n bit in base 2. • Eg: • 37A.B(16)=?(2) = 0011 0111 1010 . 1011(2)
Convert from base i to base j • If both i and j are powers of 2, use base 2 as an intermediate base: • Eg: base 8 base 2 base 16 • 735.37(8)= 000111011101.01111100(2) = 1DD.7C ?(16) • Else, use base 10 as an intermediate base: • Eg: base 5 base 10 base 2
1.1. Review of Number Systems • 1.1.1 Number Representation • 1.1.2 Binary Addition • 1.1.3 Signed Numbers • 1.1.4 Binary Subtraction • 1.1.5 Binary Coded Decimal (BCD) • 1.1.6 Other Codes
1.1.2 Binary Addition • Binary long addition similar to decimal long addition. decimalbinary carry 110 11110 A 2565 10110 B 6754 11011 sum 9319 110001 Eg: 10101(2) + 11011(2) = 110000 ? (2)
1.1.2 Binary Addition • Overflow: • Occur when the result of addition is out of range of representation (the result can not be stored in the predefined number of bits) • In 8-bit computer, the result of addition of two binary numbers 10101010 and 11010011 is 9-bit binary number which can not be stored in 8-bit => overflow
1.1.2 Binary Addition • n-bit adder in computer: • A = an-1an-2...a1a0 • B = bn-1bn-2...b1b0
1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes
1.1.3 Signed Numbers • Represent sign and amplitude • Use the most-left-bit to represent sign: • 0: positive, 1: negative • Eg: represent signed numbers using 4 bit: • +5 = 0101, -5 = 1101, -3 = 1011 • Using 3 right bits to represent amplitude, we can represent from -7 to +7. • Drawbacks: • +0 = 0000, -0 = 1000 => complex when calculating => need an other representation
2’s complement representation • Most left bit is still sign bit • Positive and 0 numbers are expressed in usual binary format. • The largest number can be represented is 2n-1-1 • n=8 => largest signed number: 28-1-1 = 127 • Negative number a is stored as the binary equivalent of 2n-a in a n-bit system. • -3 is stored as 28-3=11111101 in a 8-bit system • The most negative number can be stored is -2n-1
2’s complement representation • +10 = 0000 1010 • - 10 = 28-10 = 1 0000 0000 – 0000 1010 1111 0110 - 10 = 1111 0110 • +10 + (-10) = ? 0000 1010 • 1111 0110 • 1 0000 0000
2’s complement representation • Procedure to find binary representation of negative number in 2’s complement: • Find the binary equivalent of the magnitude • Complement each bit (0=>1, 1=>0) • Add 1 • Eg: find representation of -13 in 8-bit signed number system using 2’s complement: • Magnitude: 13 = 0000 1101 • Complement: 1111 0010 • Add 1: 1 • -13 = 1111 0011 +
2’s complement representation • Range of representation: • Use n bit to represent 2’s complement numbers • Range: -2n-1 => 2n-1-1
4 bit representation of unsigned and signed (2’s complement)
2’s complement representation • To find the magnitude of a negative number: • Complement each bit • Add 1 • Eg: 1001 0110(2) = -106? • 0110 1001 • + 1 • 01101010 = 106
Addition of signed numbers • The reason that 2’s complement is so popular is the simplicity of addition. • To add any two numbers, no matter what the sign of each is, we just do binary addition on their representation.
Addition of signed numbers • Overflow • Occur when? • Add two numbers of the opposite sign? • Add two positive numbers? • Add two negative numbers? maybe • Overflow occurs when adding two numbers with the same sign and the result is in different sign 0110 0101 = 101 + 0101 0010 = 82 1011 0111
1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes
1.1.4 Binary Subtraction • Find the 2’s complement of the second operand, then add. • a – b = a + (-b) • Eg: 7 – 5 = ?
1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes
Binary-Coded Decimal - BCD • BCD: • Use four bits (a nibble) to represent each of the decimal digits 0 through 9. • Eg: 375 = 0011 0111 0101(BCD)
1.1. Review of Number Systems 1.1.1 Number Representation 1.1.2 Binary Addition 1.1.3 Signed Numbers 1.1.4 Binary Subtraction 1.1.5 Binary Coded Decimal (BCD) 1.1.6 Other Codes
ASCII • American Standard Code for Information Interchange - ASCII • Use seven bits to represent various characters on the standard keyboard as well as a number of control signal
Problems 1. Convert the following unsigned numbers: • 98.625(10)=?(2) • 11011.011(2)=?(10) • 6A1.1E(16)=?(8) 2. Represent the following signed numbers: a. -74 in 8-bit signed 2’s complement. b. -74 in 16-bit signed 2’s complement.
1. Introduction 1.1. Review of Number Systems 1.2. Switching Algebra and Logic Circuits
1.2. Switching Algebra and Logic Circuits 1.2.1 Definition of Switching Algebra 1.2.2 Basic Properties of Switching Algebra 1.2.3 Manipulation of Algebraic Functions 1.2.4 Representations of Algebraic Functions 1.2.5 Implementation of Functions with AND, OR, NOT, NAND, NOR, XOR Gates
1.2. Switching Algebra and Logic Circuits 1.2.1 Definition of Switching Algebra 1.2.2 Basic Properties of Switching Algebra 1.2.3 Manipulation of Algebraic Functions 1.2.3 Representations of Algebraic Functions 1.2.4 Implementation of Functions with AND, OR, NOT, NAND, NOR, XOR Gates