ELCT2: DIGITAL LOGIC DESIGN Dr. Eng. Haitham Omran, haitham.omran@guc.edu.eg Dr. Eng. Wassim Alexan, wassim.joseph@guc.edu.eg Lecture 2 Following the slides of Dr. Ahmed H. Madian ذو الحجة 438 ه Winter 27
COURSE OUTLINE. Introduction 2. Gate-Level Minimization 3. Combinational Logic 4. Synchronous Sequential Logic 5. Registers and Counters 6. Memories and Programmable Logic
BASIC LOGIC GATES We have defined three basic logic gates and operators We could build any digital circuit from those basic logic gates In digital logic, we are not using normal mathematics, we are using Boolean algebra 3
PRACTICAL EXAMPLES OF AND & OR GATES A seat belt alarm system An intrusion detection system Floyd th edition 4
Z Y X Z Y X Z Y X Z Y X DERIVED GATES NAND AND-Invert NOR OR-Invert XOR Odd XNOR Even 5
PRACTICAL ICS FOR LOGIC GATES 74 Series Logic Gate Functions 6
PRACTICAL ICS FOR LOGIC GATES 74 Series Logic Gate Functions 7
MEASUREMENT DEVICES How to practically monitor the output of a gate? Oscilloscope 8
MEASUREMENT DEVICES Probe Logic State Analyzer Floyd th edition 9
EXPRESSIONS AND LOGIC CIRCUITS Any Boolean expression can be converted into a circuit by combining basic gates in a relatively straightforward way. The diagram below shows the inputs and outputs of each gate. The precedencies are explicit in a circuit. Clearly, we have to make sure that the hardware does the operations in the right order!
SIMPLIFICATION OF THE LOGIC FUNCTION F(A,B)=A B + A B + AB = A * (B + B) + A * B (Distributivity) = A * (B + B ) + A * B (Commutativity) = A * + A * B (x + x = ) = A + (A * B ) (x +x y)=(x+x )(x+y)(distributivity) = (A + B ) (De Morgan s) = (A B) GATE (NAND) ONLY From 7 gates, using simplification rules could be optimized to one gate
EXPRESSIONS AND LOGIC CIRCUITS Now that we are familiar with Boolean algebra and logic gates, how would that help us build logic circuits? If you want to build a logic circuits, you must have a Boolean expression to represent it with logic gates! 2
ALGEBRAIC FORMS OF REPRESENTING BOOLEAN FUNCTIONS Sum of Products (SOP) Product of Sums (POS) 3
SUM OF PRODUCTS (SOP) Switching functions formed by: SUMMING (ORing) PRODUCT (ANDed) terms. Example: sum terms F A, B, C, D A BC B D AC D literals (product terms) 4
SUM OF PRODUCTS (SOP) Product terms are known as minterms F = F = + A'BC + AB'C + ABC' + ABC A'B'C A B C F The apostrophe here means invert 5
SUM OF PRODUCTS (SOP) Product term (or minterm) ANDed product input combination for which output is true Each variable appears exactly once, in true or inverted form (but not both) From the pervious example: A B C F minterms A'B'C m A'B'C m A'BC' m2 A'BC m3 AB'C' m4 AB'C m5 ABC' m6 ABC m7 Short-hand notation for minterms of 3 variables F(A, B, C) = m(,3,5,6,7) = m + m3 + m5 + m6 + m7 = A'B'C + A'BC + AB'C + ABC' + ABC This form is called the canonical form F(A, B, C) = A'B'C + A'BC + AB'C + ABC + ABC' = (A'B' + A'B + AB' + AB)C + ABC' = ((A' + A)(B' + B))C + ABC' = C + ABC' = ABC' + C = AB + C This form is called the minimal form 6
HOW TO BUILD A CIRCUIT FROM THE SOP FUNCTION? F = A'B'C + A'BC + AB'C + ABC' + ABC Answer: SOP AND/OR Two-level Implementation 7
PRODUCT OF SUMS (POS) Switching functions formed by taking the: PRODUCT (ANDing) of SUM (ORed) terms. Example: Literals (Sum terms),,, F A B C D A B C B D A C D Products 8
PRODUCT OF SUMS (POS) Sum terms are known as Maxterms A B C F F = F = (A + B + C) (A + B' + C) (A' + B + C) 9
PRODUCT-OF-SUMS (CONT D) Sum term (or maxterm) ORed sum of literals input combination for which output is false each variable appears exactly once in a sum term, in true or inverted form (but not both) A B C maxterms A+B+C M A+B+C' M A+B'+C M2 A+B'+C' M3 A'+B+C M4 A'+B+C' M5 A'+B'+C M6 A'+B'+C' M7 F(A, B, C) = M(,2,4) = M M2 M4 = (A + B + C) (A + B' + C) (A' + B + C) This form is called the canonical form F(A, B, C) = (A + B + C) (A + B' + C) (A' + B + C) = (A + C) (B + C) This form is called the minimal form short-hand notation for Maxterms of 3 variables 2
HOW TO BUILD A CIRCUIT FROM THE POS FUNCTION? F(A, B, C) = (A + B + C) (A + B' + C) (A' + B + C) Answer: POS OR/AND Two-level Implementation 2
SOP AND POS REPRESENT THE SAME FUNCTION A B C F F= m(,3,5,6,7) F= M(,2,4) 22
POS VERSUS SOP Any expression can be written either way We can convert from one from to the other using theorems Sometimes SOP looks simpler AB + CD = ( A + C )( B + C )( A + D )( B + D ) Other times POS looks simpler (A + B)(C + D) = BD + AD + BC + AC However, SOP will be most commonly used 23
MINIMIZATION OF LOGIC FUNCTIONS We have chips with millions of gates Why care about minimizing a function? What do a few gates matter? Basic logic functions are replicated thousands of times Saving one gate for a memory cell pays off What is the criterion for minimization Should we minimize Number of product terms? Number of logic operations? Number of variables (literals)? Number of wires?? For implementation: minimize number of gates! 24
HOW TO MINIMIZE THE GATE COUNT? Example: F=A BC +AB C +AB C+ABC = Σm(2,4,5,6) How many gates do we need for implementation? If AND gates have 3 inputs and OR gates have 4 inputs? If all gates are binary (2 inputs)? Are there any tricks we can use? Combine minterms: A BC +ABC =BC AB C +AB C=AB F = BC +AB How many gates does F need now? This mainly depends on your experience but we need a systematic approach to minimize Boolean expressions Answer: Karnaugh maps (K-maps) 25
KARNAUGH MAPS Karnaugh maps (K-maps) are graphical representations of Boolean functions One map cell corresponds to a row in the truth table Also, one map cell corresponds to a minterm or a maxterm in the Boolean expression Multiple-cell areas of the map correspond to standard terms x y minterm m m m 2 m 3 26
2-VARIABLE K-MAP x y m 2 3 m 2 m m 3 OR y x 2 m 3 m m 2 m 3 The ordering of variables is IMPORTANT forf(x, y), x is the row, y is the column For the K map on the left, cell represents x y ; cell represents x y, etc If a minterm is present in the function, then a is placed in the corresponding cell 27
BOOLEAN FUNCTIONS IN A K-MAP Thes and s represent a function in a K-map A represents the On-set (F=), while a represents the Off-set (F=) Similar to the truth table s are typically not shown x y f x y f 28
2-VARIABLE K-MAP Any two adjacent cells in the map differ by ONLY one variable, which appears complemented in one cell and uncomplemented in the other Example m (= x y ) is adjacent to m (= x y), this means that x y + x y = x y + y = x Also m (= x y ) is adjacent to m 2 (= xy ) x y + xy = y x + x = y but m (= x y ) is NOT adjacent m 3 (= xy)! 29
2-VARIABLE K-MAP: AN EXAMPLE F x, x 2 = x x 2 + x x 2 + x x 2 = m + m + m 2 = x + x 2 The s are placed in the K-map for specified minterms: m, m and m 2 Grouping (ORing) of s allows for simplification What (simpler) function is represented by each dashed rectangle? x = m + m x 2 = m + m 2 Note that m is covered twice! 3
3-VARIABLE MAP Note the order of the minterms Gray code is used, so that the difference between any adjacent cells is still ONLY one literal 3
3-VARIABLE MAP: EXAMPLE I Simplify the Boolean expression: F x, y, z = Σ(2,3,4,5) F x, y, z = xy + x y 32
3-VARIABLE MAP: EXAMPLE II Simplify the Boolean expression: F x, y, z = Σ(3,4,6,7) F x, y, z = yz + xz 33
3-VARIABLE MAP: EXAMPLE III Simplify the Boolean expression: F x, y, z = Σ(,2,4,5,6) F x, y, z = z + xy 34
3-VARIABLE MAP: EXAMPLE IV Let the Boolean function F(A, B, C) = A C + A B + AB C + BC (a) Express this function as a sum of minterms (b) Find the minimal SOP expression F A, B, C = Σ(,2,3,5,7) F A, B, C = C + A B 35
NOTES ON A 3-VARIABLE MAP The number of adjacent squares that may be combined must always represent a number that is a power of two, such as, 2, 4 and 8 As more adjacent squares are combined, we obtain a product term with fewer literals One square represents one minterm, giving a term with 3 literals Two adjacent squares represent a term with 2 literals Four adjacent squares represent a term with literal Eight adjacent squares encompass the entire map and produce a function that is always equal to logic 36