CSEE 3827: Fundamentals of Computer Systems. Standard Forms and Simplification with Karnaugh Maps



Similar documents
Karnaugh Maps. Circuit-wise, this leads to a minimal two-level implementation

Karnaugh Maps & Combinational Logic Design. ECE 152A Winter 2012

BOOLEAN ALGEBRA & LOGIC GATES

Simplifying Logic Circuits with Karnaugh Maps

Boolean Algebra Part 1

CSE140: Components and Design Techniques for Digital Systems

Logic in Computer Science: Logic Gates

CHAPTER 3 Boolean Algebra and Digital Logic

CSE140: Midterm 1 Solution and Rubric

CH3 Boolean Algebra (cont d)

Unit 3 Boolean Algebra (Continued)

Boolean Algebra (cont d) UNIT 3 BOOLEAN ALGEBRA (CONT D) Guidelines for Multiplying Out and Factoring. Objectives. Iris Hui-Ru Jiang Spring 2010

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Switching Algebra and Logic Gates

United States Naval Academy Electrical and Computer Engineering Department. EC262 Exam 1

Karnaugh Maps (K-map) Alternate representation of a truth table

Binary Adders: Half Adders and Full Adders

Logic Reference Guide

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

Boolean Algebra. Boolean Algebra. Boolean Algebra. Boolean Algebra

DESIGN OF GATE NETWORKS

CDA 3200 Digital Systems. Instructor: Dr. Janusz Zalewski Developed by: Dr. Dahai Guo Spring 2012

C H A P T E R. Logic Circuits

2.0 Chapter Overview. 2.1 Boolean Algebra

Chapter 2: Boolean Algebra and Logic Gates. Boolean Algebra

Two-level logic using NAND gates

Introduction. The Quine-McCluskey Method Handout 5 January 21, CSEE E6861y Prof. Steven Nowick

Combinational circuits

Digital Electronics Part I Combinational and Sequential Logic. Dr. I. J. Wassell

Basic Logic Gates Richard E. Haskell

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

FINDING THE LEAST COMMON DENOMINATOR

A Course Material on DIGITAL PRINCIPLES AND SYSTEM DESIGN

Digital circuits make up all computers and computer systems. The operation of digital circuits is based on

Class One: Degree Sequences

Sum-of-Products and Product-of-Sums expressions

Gates & Boolean Algebra. Boolean Operators. Combinational Logic. Introduction

Combinational Logic Design Process

Understanding Logic Design

Digital Logic Design

Digital Electronics Detailed Outline

Lecture 12: More on Registers, Multiplexers, Decoders, Comparators and Wot- Nots

FORDHAM UNIVERSITY CISC Dept. of Computer and Info. Science Spring, The Binary Adder

Section 1. Finding Common Terms

SIMPLIFYING SQUARE ROOTS

Simplification of Radical Expressions

3.Basic Gate Combinations

Combinational Logic Design

CHAPTER 8, GEOMETRY. 4. A circular cylinder has a circumference of 33 in. Use 22 as the approximate value of π and find the radius of this cylinder.

FACTORING ax 2 bx c. Factoring Trinomials with Leading Coefficient 1

NAND and NOR Implementation

Resolution. Informatics 1 School of Informatics, University of Edinburgh

earlier in the semester: The Full adder above adds two bits and the output is at the end. So if we do this eight times, we would have an 8-bit adder.

Sect Greatest Common Factor and Factoring by Grouping

COMPUTER SCIENCE. Paper 1 (THEORY)

exclusive-or and Binary Adder R eouven Elbaz reouven@uwaterloo.ca Office room: DC3576

ELEC EXPERIMENT 1 Basic Digital Logic Circuits

Lecture 5: Gate Logic Logic Optimization

Gates, Circuits, and Boolean Algebra

Elementary Logic Gates

Figure 8-1 Four Possible Results of Adding Two Bits

FACTORING OUT COMMON FACTORS

Computer Engineering 290. Digital Design: I. Lecture Notes Summer 2002

FORDHAM UNIVERSITY CISC Dept. of Computer and Info. Science Spring, Lab 2. The Full-Adder

Factoring (pp. 1 of 4)

Scilab Textbook Companion for Digital Electronics: An Introduction To Theory And Practice by W. H. Gothmann 1

Click on the links below to jump directly to the relevant section

Counters and Decoders

High School Geometry Test Sampler Math Common Core Sampler Test

Binary full adder. 2-bit ripple-carry adder. CSE 370 Spring 2006 Introduction to Digital Design Lecture 12: Adders

Lecture 8: Synchronous Digital Systems

Read-only memory Implementing logic with ROM Programmable logic devices Implementing logic with PLDs Static hazards

Factoring Flow Chart

DEPARTMENT OF INFORMATION TECHNLOGY

Using Logic to Design Computer Components

1.3 Polynomials and Factoring

Course Requirements & Evaluation Methods

Introduction to Digital Logic with Laboratory Exercises

IAEA Training Course on Safety Assessment of NPPs to Assist Decision Making. System Analysis. Lecturer. Workshop Information IAEA Workshop

COMBINATIONAL CIRCUITS

EE360: Digital Design I Course Syllabus

Determine If An Equation Represents a Function

SOLUTIONS MANUAL DIGITAL DESIGN FOURTH EDITION M. MORRIS MANO California State University, Los Angeles MICHAEL D.

A single register, called the accumulator, stores the. operand before the operation, and stores the result. Add y # add y from memory to the acc

Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

SAT Math Strategies Quiz

Design and Development of Virtual Instrument (VI) Modules for an Introductory Digital Logic Course

5.1 FACTORING OUT COMMON FACTORS

Math Review. for the Quantitative Reasoning Measure of the GRE revised General Test

Sistemas Digitais I LESI - 2º ano

RUTGERS UNIVERSITY Department of Electrical and Computer Engineering 14:332:233 DIGITAL LOGIC DESIGN LABORATORY

6.4 Special Factoring Rules

6. BOOLEAN LOGIC DESIGN

Radicals - Square Roots

SAT Math Facts & Formulas Review Quiz

Digital Circuit Design

Lecture 4: Binary. CS442: Great Insights in Computer Science Michael L. Littman, Spring I-Before-E, Continued

COLLEGE ALGEBRA. Paul Dawkins

FACTORING POLYNOMIALS

Math 53 Worksheet Solutions- Minmax and Lagrange

Transcription:

CSEE 3827: Fundamentals of Computer Systems Standard Forms and Simplification with Karnaugh Maps

Agenda (M&K 2.3-2.5) Standard Forms Product-of-Sums (PoS) Sum-of-Products (SoP) converting between Min-terms and Max-terms Simplification via Karnaugh Maps (K-maps) 2, 3, and 4 variable Implicants, Prime Implicants, Essential Prime Implicants Using K-maps to reduce PoS form Don t Care Conditions 2

Standard Forms There are many ways to express a boolean expression F = XYZ + XYZ + XZ = XY(Z + Z) + XZ = XY + XZ It is useful to have a standard or canonical way Derived from truth table Generally not the simplest form

Two principle standard forms Sum-of-products (SOP) Product-of-sums (POS)

Product and sum terms Product term: logical AND of literals (e.g., XYZ) Sum term: logical OR of literals (e.g., A + B + C) 5

PoS & SoP Sum of products (SoP): OR of ANDs e.g., F = Y + XYZ + XY Product of sums (PoS): AND of ORs e.g., G = X(Y + Z)(X + Y + Z) 6

Converting from PoS (or any form) to SoP Just multiply through and simplify, e.g., G = X(Y + Z)(X + Y + Z) = XYX + XYY + XYZ + XZX + XZY + XZZ = XY + XY + XYZ + XZ + XZY + XZ = XY + XZ 7

Converting from SoP to PoS Complement, multiply through, complement via DeMorgan, e.g., Note: X = X F = Y Z + XY Z + XYZ F' = (Y+Z)(X +Y+Z )(X +Y +Z) = YZ + X Y + X Z (after lots of simplification) F = (Y +Z )(X+Y )(X+Z ) 8

Minterms e.g., Minterms for 3 variables A,B,C A B C minterm 0 0 0 m0 ABC 0 0 1 m1 ABC 0 1 0 m2 ABC 0 1 1 m3 ABC 1 0 0 m4 ABC 1 0 1 m5 ABC 1 1 0 m6 ABC 1 1 1 m7 ABC A product term in which all variables appear once, either complemented or uncomplemented (i.e., an entry in the truth table). Each minterm evaluates to 1 for exactly one variable assignment, 0 for all others. Denoted by mx where X corresponds to the variable assignment for which mx = 1. 9

Minterms to describe a function sometimes also called a minterm expansion or disjunctive normal form (DNF) This term is TRUE when A=0,B=1,C=0 A B C F F 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 0 1 1 1 1 0 1 F = ABC + ABC + ABC + ABC + ABC F = ABC + ABC + ABC

Sum of minterms form The logical OR of all minterms for which F = 1. A B C minterm F 0 0 0 m0 ABC 0 0 0 1 m1 ABC 1 0 1 0 m2 ABC 1 0 1 1 m3 ABC 1 1 0 0 m4 ABC 0 F = ABC + ABC + ABC = m1 + m2 + m3 = m(1,2,3) 1 0 1 m5 ABC 0 1 1 0 m6 ABC 0 1 1 1 m7 ABC 0 11

Minterm form cont d (variables appear once in each minterm) A B C F F minterm 0 0 0 1 0 m0 ABC 0 0 1 1 0 m1 ABC 0 1 0 1 0 m2 ABC 0 1 1 0 1 m3 ABC 1 0 0 1 0 m4 ABC 1 0 1 1 0 m5 ABC 1 1 0 0 1 m6 ABC 1 1 1 0 1 m7 ABC F = ABC + ABC + ABC + ABC + ABC 0 m0 + m1 + m2 + m4 + m5 0 m(0,1,2,4,5) F = ABC + ABC + ABC 0 m3 + m6 + m7 0 m(3,6,7)

Minterms as a circuit A B C F = ABC + ABC + ABC + ABC + ABC 0 m0 + m1 + m2 + m4 + m5 0 m(1,0,2,4,5) F Standard form is not minimal form!

Maxterms A B C maxterm 0 0 0 M0 A+B+C 0 0 1 M1 A+B+C 0 1 0 M2 A+B+C 0 1 1 M3 A+B+C 1 0 0 M4 A+B+C 1 0 1 M5 A+B+C 1 1 0 M6 A+B+C 1 1 1 M7 A+B+C A sum term in which all variables appear once, either complemented or uncomplemented. Each maxterm evaluates to 0 for exactly one variable assignment, 1 for all others. Denoted by MX where X corresponds to the variable assignment for which MX = 0. 14

Maxterm description of a function sometimes also called a maxterm expansion or conjunctive normal form (CNF) This term is FALSE when A=1,B=1,C=0 A B C F F F = (A+B+C) (A+B+C) (A+B+C) 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 1 1 0 0 1 0 1 0 1 1 0 1 1 0 0 1 1 1 1 0 1 Force to 0

Product of maxterms form The logical AND of all maxterms for which F = 0. A B C maxterm F 0 0 0 M0 A+B+C 0 0 0 1 M1 A+B+C 1 0 1 0 M2 A+B+C 1 0 1 1 M3 A+B+C 1 1 0 0 M4 A+B+C 0 F = (A+B+C) (A+B+C) (A+B+C) (A+B+C) (A+B+C) = (M0) (M4) (M5) (M6) (M7) = M(0,4,5,6,7) 1 0 1 M5 A+B+C 0 1 1 0 M6 A+B+C 0 1 1 1 M7 A+B+C 0 16

One final example A B C F F 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 0 1 F F Minterms (SOP) Maxterms (POS)

Summary of Minterms and Maxterms F F Minterms (SOP) Maxterms (POS) m(f = 1) m(f = 0) M(F = 0) M(F = 1)

Relations between standard forms sum of products product of sums F DeMorgan s F sum of minterms product of maxterms all boolean expressions 19

Simplification with Karnaugh Maps

Cost criteria Literal cost: the number of literals in an expression Gate-input cost: the literal cost + all terms with more than one literal + (optionally) the number of distinct, complemented single literals Roughly proportional to the number of transistors and wires in an AND/OR/NOT circuits. Does not apply, to more complex gates, for example XOR. Literal cost Gate-input cost G = ABCD + ABCD 8 8 + 2 + (4) G = (A+B)(B+C)(C+D)(D+A) 8 8 + 5 + (4) 21

Karnaugh maps (a.k.a., K-maps) All functions can be expressed with a map There is one square in the map for each minterm in a function s truth table X Y F 0 0 m0 0 1 m1 1 0 m2 1 1 m3 X Y 0 1 0 1 m0 XY m2 XY m1 XY m3 XY 22

Karnaugh maps express functions Fill out table with value of a function X Y F 0 0 0 X Y 0 1 0 1 1 0 1 0 1 1 1 1 1 23

Simplification using a k-map Whenever two squares share an edge and both are 1, those two terms can be combined to form a single term with one less variable X Y 0 1 0 0 1 X Y 0 1 1 1 1 X Y 0 1 0 0 1 F = Y + XY 0 0 1 1 1 1 F = XY + XY + XY X Y 0 1 0 0 1 1 1 1 F = X + Y 1 1 1 F = X + XY 24

Simplification using a k-map (2) Circle contiguous groups of 1s (circle sizes must be a power of 2) There is a correspondence between circles on a k-map and terms in a function expression The bigger the circle, the simpler the term Add circles (and terms) until all 1s on the k-map are circled X Y 0 1 0 0 1 1 1 1 F = X + Y 25

3-variable Karnaugh maps Use gray ordering on edges with multiple variables Gray encoding: order of values such that only one bit changes at a time Two minterms are considered adjacent if they differ in only one variable (this means maps wrap ) X Y Z Y=1 0 0 0 1 1 1 1 0 0 m0 XYZ m1 XYZ m3 XYZ m2 XYZ X=1 1 m4 XYZ m5 XYZ Z=1 m7 XYZ m6 XYZ 26

4-variable Karnaugh maps Extension of 3-variable maps WX Y Z Y 0 0 0 1 1 1 1 0 WXYZ or W+X+Y+Z 0 0 m0 m1 m3 m2 W 0 1 m4 m5 m7 m6 1 1 m12 m13 m15 m14 1 0 m8 m9 m11 m10 Z X 27

Implicants Implicant: a product term, which, viewed in a K-Map is a 2 i x 2 j size rectangle (possibly wrapping around) where i=0,1,2, j=0,1,2 WX Y Z Y 0 0 0 1 1 1 1 0 WX Y Z Y 0 0 0 1 1 1 1 0 0 0 m0 m1 m3 m2 0 0 m0 m1 m3 m2 W 0 1 m4 m5 m7 m6 1 1 m12 m13 m15 m14 1 0 m8 m9 m11 m10 X W 0 1 m4 m5 m7 m6 1 1 m12 m13 m15 m14 1 0 m8 m9 m11 m10 X Z Z 28

Implicants Implicant: a product term, which, viewed in a K-Map is a 2 i x 2 j size rectangle (possibly wrapping around) where i=0,1,2, j=0,1,2 WX Y Z Y 0 0 0 1 1 1 1 0 WX Y Z Y 0 0 0 1 1 1 1 0 W 0 0 m0 m1 m3 m2 0 1 m4 m5 m7 m6 1 1 m12 m13 m15 m14 WZ WY WXY 1 0 m8 m9 m11 m10 X WXYZ W 0 0 m0 m1 m3 m2 W 0 1 m4 m5 m7 m6 WX 1 1 m12 m13 m15 m14 1 0 m8 m9 m11 m10 X Z Z WXZ Note: bigger rectangles = fewer literals 29

4-variable Karnaugh map example W X Y Z F 0 0 0 0 1 0 0 0 1 1 0 0 1 0 1 0 0 1 1 0 WX Y Z Y 0 0 0 1 1 1 1 0 0 1 0 0 1 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 0 1 0 0 0 1 1 0 0 1 1 1 0 1 0 1 W 0 1 1 1 1 0 X 1 0 1 1 0 Z 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 1 1 1 1 0 30

Implicant terminology implicant: a product term, which, viewed in a K-Map is a 2 i x 2 j size rectangle (possibly wrapping around) where i=0,1,2, j=0,1,2 prime implicant: An implicant not contained within another implicant. essential prime implicant: a prime implicant that is the only prime implicant to cover some minterm. 31

4-variable Karnaugh maps (3) List all all of the prime implicants for this function Is any of them an essential prime implicant? What is a simplified expression for this function? WX Y Z Y 0 0 0 1 1 1 1 0 0 0 0 0 1 0 W 0 1 1 1 1 0 1 1 0 1 1 1 1 0 0 1 0 0 Z X 32

Using K-maps to build simplified circuits Step 1: Identify all PIs and essential PIs Step 2: Include all Essential PIs in the circuit (Why?) Step 3: If any 1-valued minterms are uncovered by EPIs, choose PIs that are big and do a good job covering 1 1 1 0 0 1 1 0 1 1 1 1 1 1 0 1 1 1 0 0 0 1 1 0 0 0 1 1 1 0 0 1 33

Design example : 2-bit multiplier a1 a0 b1 b0 z3 z2 z1 z0 0 0 0 0 0 0 0 1 two 2-bit # s multiplied together to give a 4-bit solution e.g., a1a0 = 10, b1b0 = 11, z3z2z1z0 = 0110 0 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 0 0 1 0 0 1 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 34

K-Maps: Complements, PoS, don t care conditions

Finding F Find prime implicants corresponding to the 0s on a k-map Y Z Y Z WX WX 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 0 0 0 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 0 1 0 1 1 0 1 0 0 0 0 1 0 0 1 0 0 1 0 1 1 0 0 1 1 1 0 0 0 1 0 F = Y + XZ + WZ F = YZ + WXY 36

PoS expressions from a k-map Find F as SoP and then apply DeMorgan s WX Y Z 0 0 0 1 1 1 1 0 0 0 1 1 0 1 0 1 1 0 0 0 1 1 1 0 0 0 1 0 1 1 0 1 F = YZ + XZ + YX DeMorgan s F = (Y+Z)(Z+X)(Y+X) 37

Don t care conditions There are circumstances in which the value of an output doesn t matter For example, in that 2-bit multiplier, what if we are told that a and b will be non-0? We don t care what the output looks like for the input cases that should not occur Don t care situations are denoted by an X in a truth table and in Karnaugh maps. a1 a0 b1 b0 z3 z2 z1 z0 0 0 0 0 X X X X 0 0 0 1 X X X X 0 0 1 0 X X X X 0 0 1 1 X X X X 0 1 0 0 X X X X 0 1 0 1 0 0 0 1 0 1 1 0 0 0 1 0 Can also be expressed in minterm form: During minimization can be treated as either a 1 or a 0 z2 = m(10,11,14) d2 = m(0,1,2,3,4,8,12) 0 1 1 1 0 0 1 1 1 0 0 0 X X X X 1 0 0 1 0 0 1 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0 0 X X X X 1 1 0 1 0 0 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 0 0 1 38

2-bit multiplier non-0 multiplier a1 a0 b1 b0 z3 z2 z1 z0 0 0 0 0 X X X X 0 0 0 1 X X X X 0 0 1 0 X X X X 0 0 1 1 X X X X 0 1 0 0 X X X X 0 1 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 X X X X 1 0 0 1 0 0 1 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0 0 X X X X 1 1 0 1 0 0 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 0 0 1 a1 b0 X X X X X 0 0 0 X 0 1 0 X 0 0 0 1 s must be covered 0 s must not be covered X s are optionally covered b1 a0 a1 z3 = z2 = b0 X X X X X 0 0 0 X 0 0 1 X 0 1 1 b1 a0 39

2-bit multiplier non-0 multiplier (2) a1 a0 b1 b0 z3 z2 z1 z0 0 0 0 0 X X X X 0 0 0 1 X X X X 0 0 1 0 X X X X 0 0 1 1 X X X X 0 1 0 0 X X X X 0 1 0 1 0 0 0 1 0 1 1 0 0 0 1 0 0 1 1 1 0 0 1 1 1 0 0 0 X X X X 1 0 0 1 0 0 1 0 1 0 1 0 0 1 0 0 1 0 1 1 0 1 1 0 1 1 0 0 X X X X 1 1 0 1 0 0 1 1 1 1 1 0 0 1 1 0 1 1 1 1 1 0 0 1 a1 z1 = b0 X X X X X 0 1 1 X 1 0 1 X 1 1 0 b1 a0 a1 b0 X X X X X 1 1 0 X 1 1 0 X 0 0 0 z0 = b1 a0 40

Final thoughts on Don t care conditions Sometimes don t cares greatly simplify circuitry A D 1 X X X X 1 X X 0 0 1 X 0 0 X 1 C B ABCD + ABCD + ABCD + ABCD vs. A + C 41