EEE104 LOGIC CIRCUIT DESIGN Objectives and Outcomes of EEE104 Logic Circuit Design The aim of this course for students is to learn digital design principles, digital logic gates, design of combinational logic and circuits, circuit design with flip-flops, and flip-flops, circuit design with counters. • • • • • • • • Comprehend importance of digital systems in application and the computer architecture Comprehend the number systems and binary arithmetic operations Comprehend the basic theorems and axioms of boole algebra Comprehend the operations of the basic logic gates Gain experience on the realization of the boole algebra functions with basic logic circuits Comprehend structures of the basic storage elements Comprehend operation of the different type counters and to gain experience on the design Gain experience of the design of the combinational and sequential networks 2 1. Week 2. Week 3. Week 4. Week 5. Week 6. Week 7. Week 8. Week 9. Week 10. Week 11. Week 12. Week 13. Week 14. Week Schedule of the Course Introduction to computers and digital systems Binary Systems Boolean Algebra Logic Gates Simplification of Boolean Functions The Map Method, Don’t Care Conditions. The tabulation method, determination of prime Combinational Logic, Design procedure Adders, Subtractors, Code Conversion, Analysis Procedure Multilevel NAND circuits, multilevel NOR circuits, Exclusive-OR functions. Combinational Logic with MSI and LSI Decoders and encoders, multiplexer, read-only memory (ROM), programmable logic array (PLA). Synchronous Sequential Logic: Flip-flops, triggering of flipflops, analysis of clocked sequential circuits. State reduction and assignment. Synchronous Sequential Logic: Flip-flop excitation tables, design procedure, design of counters, design with state implements. 3 Assessment of the Course Quantity Midterm Exams Homework Percent of In-term Studies Percentage of Final Exam to Total Score 1 2 Total Weighting (%) 90 10 60 40 4 Text Book of The Course Digital Design, M. Morris Mano, Prentice-Hall, Inc., Third Edition . Foundamentals of Digital Systems Design, V. T. Rhyne, Prentice-Hall, Inc. Digital Foundamentals, Thomas L. Floyed, A. Bell & Howell Company. Principles of Digital Design, Daniel D. Gajski, Prentice-Hall, Inc. 5 Useful Softwares for the Course Online Simulators https://circuitverse.org/simulator https://logic.ly/demo Programs Isis (Proteus) 6 Motivation Microelectronic technologies have revolutionized our world: computers, cell phones, internet ect. The semiconductor industry has grown from $21 billion in 1985 to $433.3 billion in 2020. 7 The Digital Revolution ENIAC (1.6 x 11.1 mm) Integrated Circuit First PC Commodore PET 1947 1949 1983 8 Building Digital Circuits 9 Robert Noyce, 1927 - 1990 • Nicknamed “Mayor of Silicon Valley” • Cofounded Fairchild Semiconductor in 1957 • Cofounded Intel in 1968 • Co-invented the integrated circuit 10 Gordon Moore • Cofounded Intel in 1968 with Robert Noyce. • Moore’s Law: the number of transistors on a computer chip doubles every 1.5 years (observed in 1965) 11 Technology Trends: Moore’s Law • Since 1975, transistor counts have doubled every two years. 12 Scope The purpose of this section is: Learning the fundamentals of digital design Designing and building of digital systems Numbers and Number Systems Bitwise operations Introduction to Boelean Algebra 13 Number Systems Used number systems: binary, octal, and hexadecimal Conversions: combinations of binary, octal, and hexadecimal Signed/Unsigned Numbers & Characters: negative binary numbers floating point numbers character codes Dr. Uğurhan KUTBAY 14 Decimal-Octal-Binary-Hexadeciamal Number Systems Decimal: 10 symbols, from 0 to 9 Reached 9, add 1 to next digit and make 0 the digit: 0,1,2,3,4,5,6,7,8,9, 10,11,12,13, …, 19 Octal: 8 symbols, from 0 to 7 Reached 7, add 1 to next digit and make 0 the digit: 0,1,2,3,4,5,6,7, 10,11,12,13, …, 17 Binary: Only 2 distinct symbols: 0, 1 0,1, 10,11 Hexadecimal: 16 symbols: 0-9,A-F 0,1, …, 9,A,B,C,D,F, 10,11, …, 19,1A,1B,1C,1D,1E,1F Dr. Uğurhan KUTBAY 15 Why Different Number Systems Binary: Digital computer uses 0 and 1 Octal: Ease of use better for human Easily convert to/from binary 1 hex digit = 3 binary digits Hexadecimal Easily convert to/from binary 1 hex digit = 4 binary digits (power of 2: 1 byte = 2 hex) Dr. Uğurhan KUTBAY 16 Number System Conversions convert binary octal 3 bits = 1 octal digit use conversion table: O 0 1 2 3 B 000 001 010 011 4 5 6 7 100 101 110 111 Example: 101110100001102 = 10 111 010 000 1102 = 272068 It also works with a decimal point, e.g.: 50.38 = 101 000.0112 Dr. Uğurhan KUTBAY 17 Number System Conversions convert binary hex 4 bits = 1 hex digit use conversion table: H 0 B 1 4 5 6 7 0000 0001 0010 0011 0100 0101 0110 0111 H 8 C D E F B 1000 1001 1010 1011 1100 1101 1110 1111 9 2 A 3 B Example: 101110100001102 = 10 1110 1000 01102 = 2E8616 It also works with a decimal point, e.g.: 50.316 = 101 0000.00112 Dr. Uğurhan KUTBAY 18 Number System Conversions to/from decimal use basic principle of radix numbers: each digit corresponds to a power of the radix in decimal: 3205.3 = 3*1000 + 2*100 + 0*10 + 5*1 + 3*0.1 = 3*103 + 2*102 + 0*101+ 5*100 + 3*10-1 In general, a decimal number can be decomposed into: …d3*103 + d2*102 + d1*101 + d0*100 + d-1*10-1 + d-2*10-2… Dr. Uğurhan KUTBAY 19 Number System Conversions a binary number can be decomposed into: … +d3*23 + d2*22 + d1*21 + d0*20 + d-1*2-1 + d-2*2-2 + … … +d3*8 + d2*4 + d1*2 + d0*1 + d-1*0.5 + d-2*0.25 +… convert binary decimal learn powers of 2: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, … for each binary digit that is 1 add corresponding power Example: 1101012 = 25 + 24 + 22 + 20 = 32 + 16 + 4 + 1 = 5310 1.012 = 20 + 2-2 = 1 + ¼ = 1.2510 Dr. Uğurhan KUTBAY 20 Number System Conversions decimal binary: decompose number into powers of 2 How: repeatedly subtract the largest possible power for each component write a 1 in corresponding digit Example: convert 5310 53 – 25 = 53 – 32 = 21 21 – 24 = 21 – 16 = 5 5 – 22 = 5 – 4 = 1 1 – 20 = 1 – 1 = 0 the powers are: 5, 4, 2, 0 the binary number is: 1101012 Dr. Uğurhan KUTBAY 21 Number System Conversions summary binary octal/hex: grouping of 3 or 4 bits octal hex: via binary binary decimal: sum up powers of 2 decimal binary: decompose into powers of 2 octal/hex decimal: use powers of 8 or 16 easier: via binary Dr. Uğurhan KUTBAY 22 Negative Binary Numbers signed magnitude: left-most bit is a sign bit Example with 8 bits: 5 = 0000 0101, –5 = 1000 0101 11=0000 1011, -11=1000 1011 45=0010 1101, -45=1010 1101 0=0000 0000, -128=1000 0000 Dr. Uğurhan KUTBAY 23 ONE’S COMPLEMENT: flip all bits (0 becomes 1, 1 becomes 0) Example: 5 = 0000 0101, –5 = 1111 1010 Advantage: subtract by adding negative number Example: 12 – 5 = 12+(–5) add left-most carry to sum Problem: 2 forms of zero: 0000 0000 = 1111 1111 Dr. Uğurhan KUTBAY 24 Negative Binary Numbers two’s complement: one’s complement + 1 Example: 5 = 0000 0101, –5 = 1111 1010+1 = 1111 1011 add/subtract as before, but left-most carry is discarded 12 0000 1100 –5 + 1111 1011 7 1 0000 0111 Discarded drawback of two’s complement: extra negative number with 8 bits we have 28 = 256 possible combinations: 27 = 128 combinations have left-most bit = 0: represent zero and 127 positive integers 27 = 128 combinations have left-most bit = 1: represent 128 negative integers Dr. Uğurhan KUTBAY 25 Finite-Precision Numbers number of bits determines the max/min number Problem: assume 4 bits 4+5=9 4 0100 5 0101 ? 1001 1001 = -1 wrong result! 9 is too large for 4 bits (largest positive integer: 0111=7) overflow – must compare sign bits to detect: A and B have the same sign and A+B has a different sign Dr. Uğurhan KUTBAY 26 Negative Binary Numbers excess N representation basic idea: add N to every number (N=2m-1 or 2m-1-1) Example: 8 bits can represent 28 = 256 different combinations (0-255) add 27 = 128 (or 127) to every number to be represented number excess 128 representation excess 127 representation -128 -127 0 … -1 0 1 … 127 1 … 127 128 129 … 255 0 … 126 127 128 … 254 128 255 used in floating point formats Dr. Uğurhan KUTBAY 27 Floating-Point Numbers needed for very large or very small numbers express numbers as n = f * 10e Example: +213.1 = +2.131 * 102 = +0.2131 * 103 two forms of normalized notation represent number as: sign bit exponent e fraction f base is implicit, normally 2 fraction (mantissa) is normalized; common choices: 0.1 … 1. … sign bit applies to fraction (signed magnitude) exponent: signed integer (2’s complement, excess 2m-1) Dr. Uğurhan KUTBAY 28 Floating-Point Numbers exponent size vs. fraction size: max/min size of expressible numbers vs. accuracy Example: IEEE Standard single precision double precision Dr. Uğurhan KUTBAY 29 Floating-Point Numbers single precision standard: 32 bit word 1 sign bit (0 is positive, 1 is negative) 8 bits in exponent excess 127 system used: exponent ranges from -126 to +127 23 bits in fraction normalized to 1. … leading 1 is always present and thus implied (not represented) I.e.: precision is 24 bits max. positive number: fraction: 1.111 1111 … 1111 = 20 + 2-1 + 2-2 + 2-3 + … + 2-23 = 1 + 1/2 + 1/4 + 1/8 + … = ~2 max = +2 * 2127 = +2128 min. negative number: –2128 Dr. Uğurhan KUTBAY 30 Floating-Point Numbers min. positive number: smallest fraction: 1.000 … 0000 = 20 = 1 smallest exponent: -126 min pos number = 1 * 2-126 = 2-126 max. negative number: –2-126 expressible negative numbers negative overflow –2128 Dr. Uğurhan KUTBAY negative underflow –2-126 positive underflow 0 expressible positive numbers +2-126 positive overflow +2128 31 Floating-Point Numbers Examples: show 0.5 as floating point (hex bit pattern) change to binary and normalize: 0.510 = 0.12 = 1.0 * 2-1 leading 1 is implied, fraction: 000 0000 … 00002 exponent: -1 in decimal is -1+127 in excess 127, i.e. 126 126 = 64 + 32 + 16 + 8 + 4 + 2 = 0111 11102 1 8 bits 0 0111 1110 23 bits 000 0000 0000 0000 0000 0000 0011 1111 0000 0000 … 00002 = 3F00000016 show 42E48000 in decimal 42E4800016 = 0100 0010 1110 0100 1000 0000 0000 00002 exponent = 1000 01012 = 128 + 4 + 1 = 13310 133 is in excess 127 notation; in decimal: 133 – 127 = 6 mantissa: 1.110010012 result = 1.110010012 * 26 = 1110 010.012 = 114.2510 Dr. Uğurhan KUTBAY 32 Representing Characters ASCII: American Standard Code for Information Interchange 7-bit code: 128 characters Examples do not confuse chars with numbers, e.g. 6: 0011 0110 (char) 6: 0000 ... 0000 0110 (int) UNICODE 16-bits: 65,536 chars (symbols) cover foreign languages Dr. Uğurhan KUTBAY 33 Combinational Logic vs Sequential Network x1 . . . xn fi(x) Combinational logic: yi = fi(x1,..,xn) x1 . . . xn si fi(x,s) CLK Sequential Networks 1. Memory 2. Time Steps (Clock) yit = fi (x1t,…,xnt, s1t, …,smt) sit+1 = gi(x1t,…,xnt, s1t,…,smt) 34 Scope Subjects Building Blocks Theory Combinational Logic AND, OR, NOT, XOR Sequential Network AND, OR, NOT Finite State Machine Standard Modules Operators, Interconnects, Memory Data Paths, Control Paths System Design Boolean Algebra Arithmetics, Universal Logic Methodologies 35 What is a combinational circuit? • No memory • Realizes one or more functions • Inputs and outputs can only have two discrete values • Physical domain (usually, voltages) (Ground 0V, Vdd 1V) • Mathematical domain : Boolean variables (True, False) Differentiate between different representations: • physical circuit • schematic diagram • mathematical expressions 36 Boolean Algebra A branch of algebra in which the values of the variables belong to a set B (e.g. {0, 1}), has two operations {+, .} that satisfy the following four sets of laws. •Commutative laws: a+b=b+a, a·b=b·a •Distributive laws: a+(b·c)=(a+b)·(a+c), a·(b+c)=a·b+a·c •Identity laws: a+0=a, a·1=a •Complement laws: a+a’=1, a·a’=0 (x’: the complement element of x) <37> Representations of combinational circuits: The Schematic A Y B • What is the simplest combinational circuit that you know? 38 Representations of combinational circuits Truth Table: Enumeration of all combinations Example: AND id A B Y 0 1 2 0 0 1 0 1 0 0 0 0 3 1 1 1 A Y=AB B 39 Boolean Algebra Similar to regular algebra but defined on sets with only three basic ‘logic’ operations: 1. Intersection: AND (2-input); 2. Union: OR (2-input); 3. Complement: NOT ( 1-input); Operator: . ,& Operator: + ,| Operator: ‘ ,! “&, |, !” Symbols in C Programming <40> Boolean algebra and switching functions Two-input AND ( ∙ ) AND A B 0 0 0 1 1 0 1 1 OR Y 0 0 0 1 One-input NOT (Complement, ’ ) Two-input OR (+ ) AB 0 0 0 1 1 0 1 1 Y 0 1 1 1 NOT A Y 0 1 1 0 A 1 A A 1 1 A 0 0 A 0 A For an AND gate, 0 at input blocks the other inputs and dominates the output 1 at input passes signal A For an OR gate, 1 at input blocks the other inputs and dominates the output 0 at input passes signal A 41 So, what is the point of representing gates as symbols and Boolean expressions? • Given the Boolean expression, we can draw the circuit it represents by cascading gates (and vice versa) a b c d ab ab + cd y=e (ab+cd) cd e Logic circuit vs. Boolean Algebra Expression 42