CS/EE 181a 2010/11 Lecture 4

Similar documents
CS/EE 181a 2008/09 Lecture 4

Lecture 6: Gate Level Minimization Syed M. Mahmud, Ph.D ECE Department Wayne State University

E&CE 223 Digital Circuits & Systems. Lecture Transparencies (Boolean Algebra & Logic Gates) M. Sachdev

Digital Circuit And Logic Design I. Lecture 4

E&CE 223 Digital Circuits & Systems. Lecture Transparencies (Boolean Algebra & Logic Gates) M. Sachdev. Section 2: Boolean Algebra & Logic Gates

Week-I. Combinational Logic & Circuits

Contents. Chapter 3 Combinational Circuits Page 1 of 36

Lecture 6: Manipulation of Algebraic Functions, Boolean Algebra, Karnaugh Maps

ENG2410 Digital Design Combinational Logic Circuits

Digital Logic Design. Combinational Logic

Combinational Logic Fundamentals

Lecture 7: Karnaugh Map, Don t Cares

Number System conversions

Lecture 5: NAND, NOR and XOR Gates, Simplification of Algebraic Expressions

UNIT 5 KARNAUGH MAPS Spring 2011

Boolean Algebra, Gates and Circuits

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 2 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Introduction to Digital Logic Missouri S&T University CPE 2210 Karnaugh Maps

Signals and Systems Digital Logic System

Digital Circuit And Logic Design I. Lecture 3

CHAPTER 3 BOOLEAN ALGEBRA

Unit 2 Session - 6 Combinational Logic Circuits

14:332:231 DIGITAL LOGIC DESIGN

Gate-Level Minimization

Chapter 2 Combinational Logic Circuits

Binary Logic and Gates. Our objective is to learn how to design digital circuits.

CHAPTER 12 Boolean Algebra

Chapter 2 Combinational Logic Circuits

ELC224C. Karnaugh Maps

II. COMBINATIONAL LOGIC DESIGN. - algebra defined on a set of 2 elements, {0, 1}, with binary operators multiply (AND), add (OR), and invert (NOT):

Chapter 2 Combinational Logic Circuits

DIGITAL ELECTRONICS & it0203 Semester 3

ECE 20B, Winter 2003 Introduction to Electrical Engineering, II LECTURE NOTES #2

Chapter 2 Boolean Algebra and Logic Gates

Chapter 2 Combinational Logic Circuits

CHAPTER III BOOLEAN ALGEBRA

Chap 2. Combinational Logic Circuits

Combinational Logic Design Principles

EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive

Chapter-2 BOOLEAN ALGEBRA

CSE20: Discrete Mathematics for Computer Science. Lecture Unit 2: Boolan Functions, Logic Circuits, and Implication

Binary logic consists of binary variables and logical operations. The variables are

Outcomes. Spiral 1 / Unit 5. Logic Function Synthesis KARNAUGH MAPS. Karnaugh Maps

Spiral 1 / Unit 5. Karnaugh Maps

Digital Logic Design ENEE x. Lecture 12

Systems I: Computer Organization and Architecture

Chapter 2 Boolean Algebra and Logic Gates

Outcomes. Spiral 1 / Unit 5. Logic Function Synthesis KARNAUGH MAPS. Karnaugh Maps

CHAPTER III BOOLEAN ALGEBRA

Contents. Chapter 2 Digital Circuits Page 1 of 30

Standard Expression Forms

CS 121 Digital Logic Design. Chapter 2. Teacher Assistant. Hanin Abdulrahman

Binary Logic and Gates

EC-121 Digital Logic Design

Simplifying Logic Circuits with Karnaugh Maps

ELCT201: DIGITAL LOGIC DESIGN

Optimizations and Tradeoffs. Combinational Logic Optimization

Combinatorial Logic Design Principles

EEA051 - Digital Logic 數位邏輯 吳俊興高雄大學資訊工程學系. September 2004

Midterm1 Review. Jan 24 Armita

CHAPTER1: Digital Logic Circuits Combination Circuits

BOOLEAN ALGEBRA. Introduction. 1854: Logical algebra was published by George Boole known today as Boolean Algebra

DIGITAL TECHNICS I. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute 5. LECTURE: LOGIC SYNTHESIS

Boolean Algebra CHAPTER 15

control in out in out Figure 1. Binary switch: (a) opened or off; (b) closed or on.

Chapter 2 Boolean Algebra and Logic Gates

Functions. Computers take inputs and produce outputs, just like functions in math! Mathematical functions can be expressed in two ways:

MC9211 Computer Organization

Karnaugh Maps Objectives

2009 Spring CS211 Digital Systems & Lab CHAPTER 2: INTRODUCTION TO LOGIC CIRCUITS

Combinational Logic. Review of Combinational Logic 1

Combinational Logic Circuits Part II -Theoretical Foundations

Review. EECS Components and Design Techniques for Digital Systems. Lec 06 Minimizing Boolean Logic 9/ Review: Canonical Forms

Simplification of Boolean Functions. Dept. of CSE, IEM, Kolkata

Logic and Boolean algebra

Chapter 2: Switching Algebra and Logic Circuits

Chapter 2. Digital Logic Basics

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Fundamentals of Computer Systems

CS61c: Representations of Combinational Logic Circuits

Chapter 2 Boolean Algebra and Logic Gates

Possible logic functions of two variables

Boolean Algebra. Boolean Variables, Functions. NOT operation. AND operation. AND operation (cont). OR operation

Logic Design. Chapter 2: Introduction to Logic Circuits

Lecture 2 Review on Digital Logic (Part 1)

211: Computer Architecture Summer 2016

Chapter 2 Combinational logic

Ch 2. Combinational Logic. II - Combinational Logic Contemporary Logic Design 1

Fundamental Algorithms for System Modeling, Analysis, and Optimization

Discrete Mathematics. CS204: Spring, Jong C. Park Computer Science Department KAIST

CHAPTER 2 BOOLEAN ALGEBRA

Logic Design I (17.341) Fall Lecture Outline

Lecture 5. Karnaugh-Map

for Digital Systems Simplification of logic functions Tajana Simunic Rosing Sources: TSR, Katz, Boriello & Vahid

Review for Test 1 : Ch1 5

Boolean Algebra and Logic Gates

Section 4.1 Switching Algebra Symmetric Functions

The Karnaugh Map COE 202. Digital Logic Design. Dr. Muhamed Mudawar King Fahd University of Petroleum and Minerals

Principles of Computer Architecture. Appendix B: Reduction of Digital Logic. Chapter Contents

CHAPTER 5 KARNAUGH MAPS

Transcription:

CS/EE 181a 21/11 Lecture 4 General topic of today s lecture: Logic Optimization Karnaugh maps. Quine-McCluskey tabulation method (not in detail). Non series-parallel networks (some care is required). Reference for today s lecture: Kohavi s Switching and Finite Automata Theory CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 1

Logic Minimization Today, our starting point is some known boolean function expressed as a boolean expression f. We need a way to minimize the cost of implementing the function by stating it in a different, equivalent form f. In other words, f(x 1,...,x n ) = f (x 1,...,x n ) for all x 1,...,x n, but the way we write (and implement) f and f may be different. We want to optimize some criteria, usually a combination of area, power, and latency. At the logic level, this usually translates in terms of minimizing: number of appearances of a literal number of literals in s-o-p or p-o-s number of terms in s-o-p There is no general rule for this, so we will develop tools that can be useful as a guide. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 2

Logic Minimization To begin: Sum-of-products minimization. Minimizing the number of terms in a sum-of-products expression f. If f 1 and f 2 have the same number of terms, choose the one with fewer literals or variables. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 3

Are We Minimizing the Right Metrics? Sum-of-products minimization methods minimize number of terms in pulldown network. Not very helpful. Generating the p network as the dual of the n network leads to a minimum number of transistors in series. More important! This is actually a reasonable way to do things... minimize minimize Plus, later on we will see circuits that can handle large boolean expressions. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 4

Logic Minimization Vocabulary Consider the boolean function f(x, y, z) = (x y z). In terms of sum-of-product expression: f = xyz +xy z+xy z +x yz+x yz +x y z+x y z literal. A variable or its negation x, x minterm. A product term that includes x, y, and z all exactly once (complemented or uncomplemented). Example. x y z, x y z (There are eight.) implicant. A product of literals that implies the truth of f. Example. x y z is an implicant of f. It is also a minterm. x y is another implicant of f, but not a minterm. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 5

prime implicant. An implicant with a minimal number of literals, i.e. removing a literal results in a product that does not imply f. Example. x, y, z. Example. f1 = x y + xz + y z ; x y is a prime implicant of f1 essential prime implicant. A prime implicant that covers some minterm of f that is not covered by any other prime implicant. if f h then h covers f Example. In the case of f, x, y, z are all essential prime implicants. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 6

Minimization vocabulary, continued The disjunctive normal form (or canonical sum-ofproducts form) of a boolean expression is the disjunction ( or sum ) of the minterms for which it is true. Example. (in compact notation) f = xyz +xy z+xy z +x yz+x yz +x y z+x y z Theorem 1. The disjunctive normal form is unique. Theorem 2. Any boolean function can be expressed as the sum of its prime implicants. Theorem 3. A minimal sum-of-products expression of a switching function contains all its essential prime implicants. All the remaining terms are prime implicants, none of which are covered by the sum of its essential prime implicants. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 7

No substitute to being a little smart.... De Morgan s law f = (x y z) f = ( x y z). Now the hard way...(all minterms of f) f = xyz +xy z+x yz+x y z+x yz +xy z +x y z CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 8

The Map Method For small n, we can use a graphical method Karnaugh maps or K-maps. For n = 2: x 1 y x y xy 1 x y xy For n = 3, using decimal encodings for each minterm: z xy 1 11 1 2 6 4 1 1 3 7 5 CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 9

Easy to generalize up to four variables yz wx 1 11 1 4 12 8 1 1 5 13 9 11 3 7 15 11 1 2 6 14 1 And then on to five... vwx1111 yz 4 12 8 1 1 5 13 9 11 3 7 15 11 1 2 6 14 1 11111111 24 28 2 16 25 29 21 17 27 31 23 19 26 3 22 18 and six (two variables per dimension). Any more requires four-dimensional intuition! CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 1

K-maps in Practice Basic idea: Write out the function in the K-map. Find prime implicants. Include essential prime implicants in function. Cover the remainder minimally basically try all alternatives. (It s usually easy to figure out which ones are bad, at least if the map is reasonably small.) The last point seems bad, and it is! CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 11

How does it work? Example. (Kohavi) f(w, x, y, z) = Σ(, 4, 5, 7, 8, 9, 13, 15) First we build the K-map by placing 1 or in the appropriate min-term box: yz wx 1 11 1 1 1 1 1 1 1 1 11 1 1 1 Then we graphically find the minimal sum-of-products expression. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 12

This (irredundant): wx 1 11 1 yz 1 1 1 1 11 1 1 1 1 1 1 or this (minimal): wx 1 11 1 yz 1 1 1 1 11 1 1 1 1 1 1 There are choices! CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 13

Product-of-Sums Sometimes the minimal product-of-sums expression requires fewer literals. Example. (Kohavi again.) wx 1 11 1 yz wx 1 11 1 yz 1 1 1 1 11 11 1 1 1 1 f = Σ(5,6, 9,1) f = Π(,1,2,3,4, 7,8,11, 12,13,14, 15) As sum-of-products: w xy z + wx y z + w xyz + wx yz As product-of-sums: (y + z)(y + z )(w + x)(w + x ) CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 14

Don t cares Frequently, we know that some combination of inputs cannot occur. (E.g., in designing an FSM.) We can easily take advantage of that by adding φ symbols (don t cares) to the K-map. Example. BCD equal-to-9 circuit wx 1 11 1 yz φ 1 φ 1 11 φ φ 1 φ φ Naïve f = wx y z (the minterm). Less naïve f = wz. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 15

Quine-McCluskey Table Method K-maps break down after six variables unless you are very gifted. Alternative, more mechanical method: Quine-McCluskey tabulation. Basic idea (same as for K-map): (W x) (W x) = W (x x) = W. Wx + Wx = W. Example. xyz + xyz = xy If two minterms A and B can be combined, they differ in exactly one literal. Thus, the number of uncomplemented literals in A and B must differ by exactly one. The Quine-McCluskey algorithm generates candidates for combination by looking at the number of uncomplemented literals. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 16

Quine-McCluskey Minimization 1 To apply the Quine-McCluskey algorithm to f: 1. List the minterms that are implicants of f. (I.e., the minterms for which f is true.) On each line of this list, write the binary representation of the minterm, and sort the list into bins by the number of ones in the binary representation. 2. Scan the list from top to bottom, comparing minterms from adjacent bins. 3. If any two minterms differ in only one position, they can be combined. Write their combined implicant (with a dash in the position of the varying bit) in a new table, likewise sorted by the number of ones. 4. Check off combined minterms any minterms remaining need to be remembered as they cannot be combined. 5. Repeat until no further combinations are possible. This yields a prime implicant chart. Now we need to cover f in a minimal way using the prime implicants. (Equivalent to the subset-sum problem N P-complete. Heuristics can help here (see Kohavi).) CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 17

Q-McC Example for Step 1 f(w, x, y, z) = Σ(, 1, 2, 5, 7, 8, 9, 1, 13, 15) 1 1 2 1 8 1 5 11 9 11 1 11 7 111 13 111 15 1111 CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 18

Q-McC Example for Step 1, Cont d,1,2,8 1,5 1 1,9 1 2,1 1 8,9 1 8,1 1 5,7 1 1 5,13 11 9,13 1 1 7,15 111 13,15 11 1 Now we have the prime implicants: (Since no further absorptions are possible.),1,8,9 A = x y,2,8,1 B = x z 1,5,9,13 1 C = y z 5,7,13,15 1 1 D = xz CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 19

Quine-McCluskey Minimization 2 Find all essential p.i. s and include them in minimal expression Remove all p.i. s that are covered by the essential p.i. s If the set of essential p.i. s covers all minterms of f, done! Otherwise, select additional p.i. s to cover the rest minimally. (Not always straightforward!) CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 2

Quine-McCluskey Minimization 2, example continued Once we have the prime implicants, we need to check which of them are essential. minterm p. i. 1 2 5 7 8 9 1 13 15 A X X X X B X X X X C X X X X D X X X X Last step: Reduced p.i. chart (remove essential p.i. s and the minterms covered by them). p. i. 1 9 A X X C X X Minimal expressions: B + D + A, B + D + C. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 21

Q-McC and Don t Cares The Quine-McCluskey algorithm deals very well with don t care states. Use the don t cares (i.e., treat them as true states) to generate the prime implicants Do not include the don t cares as minterms in the prime implicant chart. This will ensure that you have all the possible prime implicants and that you do not choose more of them than you need. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 22

What we know so far Analyze pulldown and pullup networks separately, or... Product of sums pullup network by duality. Sometimes we can go between the two without redoing the analysis. Example. 2-input multiplexor. s b b s impossible path s a s a redundant path x x s s s s a b a b Can use redundant and impossible paths to simplify. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 23

Non Series-Parallel Networks No efficient analysis methods are known for general non series-parallel networks. Example. Bridge network. y z y z i v j i v j w x w x Tie set. Cut set. In this case, we have the two expressions T ij = wx + wvz + yvx + yz T ij = (w + y)(w + v + z)(x + v + y)(x + z). CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 24

Non Series-Parallel Networks An important use of non series-parallel networks is gate sharing (more correctly, transistor sharing). Example. Implement pulldown for f = wx + wy + xyz. _ f x y y w w x z CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 25

We can share the w operator between wx and wy: x _ f x y z w y If we are not careful, sneak paths may form: x _ f _ f w x z x y x y z w y xz was not in the original expression! CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 26

We can fix this by reintroducing a gate: _ f x x y w x z But this is often not a very good tradeoff (sometimes it doesn t matter). A final obvious(?) thing to mention is sharing gates between unrelated functions (unrelated in the sense that they go to different outputs). We can share the transistor connected to a: s x y a s x a s a s y CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 27

Summary Important points to remember: Only a few kinds of circuits have known algorithms for finding the minimal network. These problems are mostly N P-complete. Designing in small modules simplifies things a lot. A few moments of thought can often save hours of Karnaugh map work... Let the computer do it? CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 28

Next time Next time we start covering state-holding elements. Introduce the notion of time. Clocks. Registers. Lab 2 due. CS/EE181 Digital VLSI Design Laboratory L4 1/11/21 29