Literal Cost F = BD + A B C + A C D F = BD + A B C + A BD + AB C F = (A + B)(A + D)(B + C + D )( B + C + D) L = 10

Similar documents
Chapter 2 Combinational Logic Circuits

Chapter 2 Combinational

Chapter 2 Combinational Logic Circuits

Boolean Function Simplification

Chapter 2 Part 5 Combinational Logic Circuits

CSCI 220: Computer Architecture I Instructor: Pranava K. Jha. Simplification of Boolean Functions using a Karnaugh Map

Specifying logic functions

Gate Level Minimization Map Method

Gate Level Minimization

Combinational Logic Circuits

DKT 122/3 DIGITAL SYSTEM 1

Combinational Logic Circuits

Chapter 3. Gate-Level Minimization. Outlines

Assignment (3-6) Boolean Algebra and Logic Simplification - General Questions

ELCT201: DIGITAL LOGIC DESIGN

A B AB CD Objectives:

Combinational Logic Circuits Part III -Theoretical Foundations

Simplification of Boolean Functions

Simplification of Boolean Functions

IT 201 Digital System Design Module II Notes

Chapter 2. Boolean Expressions:

Experiment 3: Logic Simplification

Gate-Level Minimization

ELCT201: DIGITAL LOGIC DESIGN

Points Addressed in this Lecture. Standard form of Boolean Expressions. Lecture 4: Logic Simplication & Karnaugh Map

CMPE223/CMSE222 Digital Logic

Chapter 3 Simplification of Boolean functions

Gate-Level Minimization

2008 The McGraw-Hill Companies, Inc. All rights reserved.

CHAPTER-2 STRUCTURE OF BOOLEAN FUNCTION USING GATES, K-Map and Quine-McCluskey

UNIT II. Circuit minimization

ECE380 Digital Logic

Digital Design. Chapter 4. Principles Of. Simplification of Boolean Functions

Gate-Level Minimization. BME208 Logic Circuits Yalçın İŞLER

Chapter 2 Boolean algebra and Logic Gates

Switching Circuits & Logic Design

Experiment 4 Boolean Functions Implementation

Module -7. Karnaugh Maps

Digital Logic Lecture 7 Gate Level Minimization

B.Tech II Year I Semester (R13) Regular Examinations December 2014 DIGITAL LOGIC DESIGN

Karnaugh Map (K-Map) Karnaugh Map. Karnaugh Map Examples. Ch. 2.4 Ch. 2.5 Simplification using K-map

Gate-Level Minimization

Gate-Level Minimization. section instructor: Ufuk Çelikcan

ENGINEERS ACADEMY. 7. Given Boolean theorem. (a) A B A C B C A B A C. (b) AB AC BC AB BC. (c) AB AC BC A B A C B C.

Contents. Chapter 3 Combinational Circuits Page 1 of 34

X Y Z F=X+Y+Z

Ch. 5 : Boolean Algebra &

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

BOOLEAN ALGEBRA. Logic circuit: 1. From logic circuit to Boolean expression. Derive the Boolean expression for the following circuits.

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

Unit-IV Boolean Algebra

CS8803: Advanced Digital Design for Embedded Hardware

Graduate Institute of Electronics Engineering, NTU. CH5 Karnaugh Maps. Lecturer: 吳安宇教授 Date:2006/10/20 ACCESS IC LAB

數位系統 Digital Systems 朝陽科技大學資工系. Speaker: Fuw-Yi Yang 楊伏夷. 伏夷非征番, 道德經察政章 (Chapter 58) 伏者潛藏也道紀章 (Chapter 14) 道無形象, 視之不可見者曰夷

Introduction to Microprocessors and Digital Logic (ME262) Boolean Algebra and Logic Equations. Spring 2011

Chapter 6. Logic Design Optimization Chapter 6

Summary. Boolean Addition

MODULE 5 - COMBINATIONAL LOGIC

2.6 BOOLEAN FUNCTIONS

EEE130 Digital Electronics I Lecture #4_1

University of Technology

Code No: R Set No. 1


LSN 4 Boolean Algebra & Logic Simplification. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

Chapter 2: Combinational Systems

Dr. S. Shirani COE2DI4 Midterm Test #1 Oct. 14, 2010

4 KARNAUGH MAP MINIMIZATION

2.1 Binary Logic and Gates

Computer Science. Unit-4: Introduction to Boolean Algebra

To write Boolean functions in their standard Min and Max terms format. To simplify Boolean expressions using Karnaugh Map.

Code No: R Set No. 1

Code No: 07A3EC03 Set No. 1

DIGITAL CIRCUIT LOGIC UNIT 5: KARNAUGH MAPS (K-MAPS)

Review: Standard forms of expressions

LOGIC CIRCUITS. Kirti P_Didital Design 1

MUX using Tri-State Buffers. Chapter 2 - Part 2 1

Digital Logic Design. Outline

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 04. Boolean Expression Simplification and Implementation

Presentation 4: Programmable Combinational Devices

Incompletely Specified Functions with Don t Cares 2-Level Transformation Review Boolean Cube Karnaugh-Map Representation and Methods Examples

Boolean Analysis of Logic Circuits

1. Mark the correct statement(s)

Digital Logic Design (CEN-120) (3+1)

Mid-Term Exam Solutions

R.M.D. ENGINEERING COLLEGE R.S.M. Nagar, Kavaraipettai

PALs, GALs & CUPL. What is Programmable Logic?

QUESTION BANK FOR TEST

S1 Teknik Telekomunikasi Fakultas Teknik Elektro FEH2H3 2016/2017

Philadelphia University Faculty of Information Technology Department of Computer Science. Computer Logic Design. By Dareen Hamoudeh.

Outcomes. Unit 9. Logic Function Synthesis KARNAUGH MAPS. Implementing Combinational Functions with Karnaugh Maps

CS6201-DIGITAL PRINCIPLE AND SYSTEM DESIGN I YEAR/II SEM PART-B UNIT-I BOOLEAN ALGEBRA AND LOGIC GATES.

Combinational Logic & Circuits

UNIT-4 BOOLEAN LOGIC. NOT Operator Operates on single variable. It gives the complement value of variable.

CprE 281: Digital Logic

SWITCHING THEORY AND LOGIC CIRCUITS

Combinational Circuits Digital Logic (Materials taken primarily from:

SIDDHARTH GROUP OF INSTITUTIONS :: PUTTUR Siddharth Nagar, Narayanavanam Road QUESTION BANK (DESCRIPTIVE)

Switching Theory And Logic Design UNIT-II GATE LEVEL MINIMIZATION

A graphical method of simplifying logic

NODIA AND COMPANY. GATE SOLVED PAPER Computer Science Engineering Digital Logic. Copyright By NODIA & COMPANY

Transcription:

Circuit Optimization Goal: To obtain the simplest implementation for a given function Optimization is a more formal approach to simplification that is performed using a specific procedure or algorithm Optimization requires a cost criterion to measure the simplicity of a circuit Distinct cost criteria we will use: Literal cost (L) Gate input cost (G) Gate input cost with NOTs (GN)

Literal Cost Literal a variable or it complement Literal cost the number of literal appearances in a Boolean epression corresponding to the logic circuit diagram Eample, which solution is best? F = BD + A B C + A C D L = 8 F = BD + A B C + A BD + AB C L = F = (A + B)(A + D)(B + C + D )( B + C + D) L = 0 2

Gate Input Cost Gate input costs - the number of inputs to the gates in the implementation corresponding eactly to the given equation or equations. (G - inverters not counted, GN - inverters counted) For SOP and POS equations, it can be found from the equation(s) by finding the sum of: all literal appearances the number of terms ecluding single literal terms,(g) and optionally, the number of distinct complemented single literals (GN). Eample, which solution is best? F = BD + A B C + A C D G =, GN = 4 F = BD + A B C + A BD + AB C G = 5, GN = 8 F = (A + B)(A + D)(B + C + D )( B + C + D) G = 4, GN = 7 3

Cost Criteria (continued) Eample : F = A + B C + B C L = 5 GN = G + 2 = 9 G = L + 2 = 7 B C A F L (literal count) counts the AND inputs and the single literal OR input. G (gate input count) adds the remaining OR gate inputs GN(gate input count with NOTs) adds the inverter inputs 4

Cost Criteria (continued) Eample 2: F = A B C + A B C L = 6 G = 8 GN = F = (A + C )( B + C)( A+ B) L = 6 G = 9 GN = 2 Same function and same literal cost But first circuit has better gate input count and better gate input count with NOTs A B C A B C F F 5

Boolean Function Optimization Minimizing the gate input (or literal) cost of a (a set of) Boolean equation(s) reduces circuit cost. We choose gate input cost. Boolean Algebra and graphical techniques are tools to minimize cost criteria values. Some important questions: When do we stop trying to reduce the cost? Do we know when we have a minimum cost? Treat optimum or near-optimum cost functions for two-level (SOP and POS) circuits first. Introduce a graphical technique using Karnaugh maps (K-maps, for short) 6

Karnaugh Maps (K-map) A K-map is a collection of squares Each square represents a minterm The collection of squares is a graphical representation of a Boolean function Adjacent squares differ in the value of one variable Alternative algebraic epressions for the same function are derived by recognizing patterns of squares (corresponding to cubes) The K-map can be viewed as A reorganized version of the truth table or a particular cube representation 7

Some Uses of K-Maps Provide a means for: Finding optimum SOP and POS standard forms, and two-level AND/OR and OR/AND circuit implementations for functions with small numbers of variables Visualizing concepts related to manipulating Boolean epressions Demonstrating concepts used by computer-aided design programs to simplify large circuits 8

The Boolean Space B n B = { 0,} B 2 = {0,} X {0,} = {00, 0, 0, } Karnaugh Maps: B 0 B B 2 Boolean Cubes: B 3 B 4 9

Two Variable Maps A 2-variable Karnaugh Map: Note that minterm m 0 and minterm m are adjacent and differ in the value of the variable y Similarly, minterm m 0 and minterm m 2 differ in the variable. y = 0 y = = 0 m 0 = m = = m 2 = m 3 = Also, m and m 3 differ in the variable as well. Finally, m 2 and m 3 differ in the value of the variable y y y y y y 0

K-Map and Truth Tables The K-Map is just a different form of the truth table. Eample Two variable function: We choose a,b,c and d from the set {0,} to implement a particular function, F(,y). Function Table Input Values (,y) Function Value F(,y) 0 0 a 0 b 0 c d y K-Map y = 0 y = = 0 a b = c d

K-Map Function Representation Eample: F(,y) = F = y = 0 y = = 0 0 0 = For function F(,y), the two adjacent cells containing s can be combined using the Minimization Theorem: F (, y ) = y + y = 2

K-Map Function Representation Eample: G(,y) = y + y + y G=+y y = 0 y = = 0 0 = For G(,y), two pairs of adjacent cells containing s can be combined using the Minimization Theorem: ( y + y ) + ( y + y ) = y G (, y ) = + Duplicate y 3

Three Variable Maps A three-variable K-map: X yz yz=00 yz=0 yz= yz=0 =0 m0 m m3 m2 = m4 m5 m7 m6 Where each minterm corresponds to the product terms: X =0 yz yz=00 yz=0 yz= yz=0 y z y z y z y z = y z y z y z y z Note that if the binary value for an inde differs in one bit position, the minterms are adjacent on the K-Map 4

Alternative Map Labeling Map use largely involves: Entering values into the map, and Reading off product terms from the map. Alternate labelings are useful: y z y y y z y 00 0 0 0 3 2 0 0 3 2 4 5 7 6 4 5 7 6 z z z z 5

Eample Functions By convention, we represent the minterms of F by a "" in the map and leave the minterms of blank F Eample: F (, y, z) = m (2, 3, 4, 5) y z y 0 3 2 4 5 7 6 Eample: F (, y, z) = m (3, 4, 6, 7) Learn the locations of the 8 indices based on the variable order shown (, most significant and z, least significant) on the map boundaries y z z y 0 3 2 4 5 7 6 z 6

Combining Squares By combining squares, we reduce number of literals in a product term, reducing the literal cost, thereby reducing the other two cost criteria On a 3-variable K-Map: One square represents a minterm with three variables Two adjacent squares represent a cube that is product term with two variables Four adjacent terms represent a cube that is product term with one variable Eight adjacent terms is the function of all ones (no variables) is a tautology f =. 7

Eample: Combining Squares Eample: Let y z y F (, y, z) = m (2, 3, 6, 7) Applying the Minimization Theorem three times: 0 3 2 4 5 7 6 z F (, y, z ) = y z + y z + y z + = yz + y z = y y z Thus the four terms that form a 2 2 square correspond to the term "y". 8

Three-Variable Maps Reduced literal product terms for SOP standard forms correspond to cubes i.e. to rectangles on the K-maps containing cell counts that are powers of 2. Rectangles of 2 cells represent 2 adjacent minterms; of 4 cells represent 4 minterms that form a pairwise adjacent ring. Rectangles can contain non-adjacent cells as illustrated by the pairwise adjacent ring above. 9

Three-Variable Maps Topological warps of 3-variable K-maps that show all adjacencies: Venn Diagram Cylinder 0 4 X Y 6 5 7 2 3 Z 20

Three-Variable Maps Eample Shapes of 2-cell Rectangles: yz y 0 3 2 4 5 7 6 Read off the product terms for the rectangles shown z z y yz 2

Three-Variable Maps Eample Shapes of 4-cell Rectangles: yz y 0 3 2 4 5 7 6 z Read off the product terms for the rectangles shown z z X Y 22

Three Variable Maps K-Maps can be used to simplify Boolean functions by a systematic methods. Terms are selected to cover the s in the map. Eample: Simplify F (, y, z) = m (, 2, 3, 5, 7) yz z y y z F(, y, z) = z + y

Three-Variable Map Simplification Use a K-map to find an optimum SOP equation for F (, y, z) = m (0,, 2, 4, 6, 7) F = z + y + y yz y z 24

Four Variable Maps Map and location of minterms: WX w=00 yz yz=00 yz=0 yz= yz=0 0 3 2 Y w=0 w= W w=0 5 6 4 7 2 3 5 4 8 9 0 Z X

Four Variable Terms Four variable maps can have rectangles corresponding to: A single = 4 variables, (i.e. Minterm) Two s = 3 variables, Four s = 2 variables Eight s = variable, Siteen s = zero variables (i.e. Constant "") 26

Four-Variable Maps Eample Shapes of Rectangles: WX w=00 yz yz=00 yz=0 yz= yz=0 0 3 2 Y w=0 w= W w=0 4 5 7 6 2 3 5 4 8 9 0 Z X 27

Four-Variable Maps Eample Shapes of Rectangles: WX w=00 yz yz=00 yz=0 yz= yz=0 0 3 2 Y w=0 w= W w=0 5 6 4 7 2 3 5 4 8 9 0 X Z 28

Four-Variable Map Simplification F(W, X, WX Y, w=00 yz Z) =Sm (0,2,4,5,6,7, 8,0,3,5) yz=00 yz=0 yz= yz=0 0 3 2 Y w=0 W w= w=0 4 5 7 6 2 3 5 4 8 9 0 X Z F = XZ + X'Z +W X 29

Four-Variable Map Simplification F(W, X,Y,Z) WX W yz =Sm (3,4,5,7,9,3,4,5) 0 3 2 4 5 7 6 2 3 5 4 Y X 8 9 0 Z F = W' X Y' + W' Y Z + WXY + WY'Z 30

Systematic Simplification A Prime Implicant is a cube i.e. a product term obtained by combining the maimum possible number of adjacent squares in the map into a rectangle with the number of squares a power of 2. A prime implicant is called an Essential Prime Implicant if it is the only prime implicant that covers (includes) one or more minterms. Prime Implicants and Essential Prime Implicants can be determined by inspection of a K-Map. A set of prime implicants "covers all minterms" if, for each minterm of the function, at least one prime implicant in the set of prime implicants includes the minterm. 3

Eample of Prime Find ALL Prime Implicants AB CD B D CD C B D ESSENTIAL Prime Implicants C BD A A B B BD A B AD D B C D Minterms covered by single prime implicant 32

Prime Implicant Practice Find all prime implicants for: F (A, B, C, D) = m (0,2,3,8,9,0,,2,3,4,5) CD C = essential AB 0 3 2 5 6 4 7 A 2 3 5 4 8 9 0 D B Prime implicants are: A,BC, and BD 33

Another Eample Find all prime implicants for: F (A, B, C, D) = m (0,2,3,4,7,2,3,4,5) CD C AB A 0 3 2 4 5 7 6 2 3 5 4 8 9 0 D AB, BCD, ACD, ABD, ABC, ACD, BCD B m = AB+ACD+ACD+ABC c = m +ABD+BCD+BCD 34

K-Maps, implicates Find all prime implicates for: F=(w+y+z) (w + +y) (+y) (w++y ) (w+ +z) (w ++z) YZ Y WX w=00 yz=00 yz=0 yz= yz=0 0 3 2 0 0 0 0 w=0 W w= w=0 0 4 5 7 6 0 2 3 5 4 0 0 8 9 0 0 0 Z 0 X m = (w+)(w +y)(w+z)(+z) c = m (y+z) 35

K-Maps, implicates Find all prime implicates for: F=(w+y+z)(w+ +y)(w+y +z )(+y +z)(w + +z )(w ++y)(+y +z ) YZ WX 0 Y 0 3 2 0 0 W 0 0 4 5 7 6 0 2 3 5 4 0 8 9 0 0 0 0 0 0 X Z m =( +z ) (y +z ) (w +) (+z)(w+ +y) c = m (w +z )(w+y+z)(+y ) 36

Five Variable or More K-Maps For five variable problems, we use two adjacent K- maps. It becomes harder to visualize adjacent minterms for selecting PIs. You can etend the problem to si variables by using four K-Maps. WX YZ V = 0 Y WX YZ V = Y X X W W Z Z 37

Five Variable K-Maps Find all prime implicants for: G(v,w,,y,z)= m (0,,2,4,5,6,7,8,0,6,7,8,20, 2,24,25,26,27,29) W V = 0 Y Z X W V = Y m = w y + z +v w +vy z+vw c = m +v w z Z X 38

Don't Cares in K-Maps Sometimes a function table or map contains entries for which it is known that: the input values for the minterm will never occur or the output value for the minterm is not used In these cases, the output value need not be defined Instead, the output value is defined as a don't care By placing don't cares ( an entry) in the function table or map, the cost of the logic circuit may be lowered. Eample: A logic function having the binary codes for the BCD digits as its inputs. Only the codes for 0 through 9 are used. The si codes, 00 through never occur, so the output values for these codes are to represent don t cares. 39

Incompletely Specified Functions F = (f, d, r) : B n {0,, } where represents don t care. f = onset function - r = offset function - d = don t care function - f()= F ()= r()= F ()=0 d()= F ()=* (f,d,r) forms a partition of B n. i.e. f + d + r = B n fd = fr = dr = (pairwise disjoint) 40

Eample:Logic Minimization Consider F (a,b,c)=(f,d,r), where f={abc, abc, abc} and d ={abc, abc}, and the sequence of covers illustrated below: On Off Don t care F = abc + abc+ abc Epand abc a F 2 = a+abc + abc abc is redundant a is prime F 3 = a+abc Epand abc bc c b a F 4 = a+bc 4

Eample: BCD 5 or More w In the map below gives a function F(w,,y,z) which is defined as "5 or more" over BCD inputs. With the don't cares used for the 6 non-bcd combinations: 0 0 0 0 0 0 3 2 4 5 7 6 2 3 5 4 8 9 0 z X X X X y X X F(w,,y, z) = w z + w y + w y F2 (w,,y,z) = w + z + y G = 7 This is much lower in cost than F where the don't cares were treated as "0s" having G = 2 For this particular function, cost G for the POS solution for F(w,,y,z) is not changed by using the don't cares. F3 (w,,y,z) = (w + ) (w + y + z) G = 7 42

Product of Sums Eample Find the optimum POS solution: F (A,B,C,D)= m (3,9,,2,3,4,5) + d (,4,6) Hint: Use F and complement it to get the result. A D F = A B+B' D C B A D C B F' = B' D' + A' B F = (B + D)(A + B') 43

Selection Rule Eample Simplify F(A, B, C, D) given on the K-map. C Selected Essential C A B A B D D Minterms covered by essential prime implicants 44

Selection Rule Eample with Don't Cares Simplify F(A, B, C, D) given on the K-map. C Selected Essential C B B A A D Minterms covered by essential prime implicants D 45

Combinational Circuits A combinational logic circuit has: A set of m Boolean inputs, A set of n Boolean outputs, and n switching functions, each mapping the 2 m input combinations to an output such that the current output depends only on the current input values A block diagram: COMBINATORIAL LOGIC CIRCUIT m Boolean Inputs n Boolean Outputs

Design Procedure. Specification Write a specification for the circuit 2. Formulation Derive a truth table or initial Boolean equations that define the required relationships between the inputs and outputs 3. Optimization Apply 2-level and multiple-level optimization Draw a logic diagram for the resulting circuit using ANDs, ORs, and inverters 4. Technology Mapping Map the logic diagram to the implementation technology selected 5. Verification Verify the correctness of the final design

Design Eample BCD to Ecess-3 code converter. Specification BCD to Ecess-3 code converter Transforms BCD code for the decimal digits to Ecess-3 code for the decimal digits BCD code words for digits 0 through 9 4-bit patterns 0000 to 00, respectively Ecess-3 code words for digits 0 through 9 4-bit patterns consisting of 3 (binary 00) added to each BCD code word Implementation: multiple-level circuit NAND gates (including inverters)

Specification of BCD-to-Ecess3 Inputs: a BCD input, A,B,C,D with A as the most significant bit and D as the least significant bit. Outputs: an Ecess-3 output W,X,Y,Z that corresponds to the BCD input. Internal operation circuit to do the conversion in combinational logic. W X Y Z BCD to Ecess-3 converter A B C D 49

Formulation of BCD-to-Ecess-3 Ecess-3 code is easily formed by adding a binary 3 to the binary or BCD for the digit. There are 6 possible inputs for both BCD and Ecess-3. It can be assumed that only valid BCD inputs will appear so the si combinations not used can be treated as don t cares. 50

BCD-to-Ecess-3 Code converter 5

Epressions for W X Y Z W(A,B,C,D) = Σm(5,6,7,8,9) X(A,B,C,D) = Σm(,2,3,4,9) Y(A,B,C,D) = Σm(0,3,4,7,8) Z(A,B,C,D) = Σm(0,2,4,6,8) +d(0,,2,3,4,5) +d(0,,2,3,4,5) +d(0,,2,3,4,5) +d(0,,2,3,4,5) 52

Optimization BCD-to-Ecess-3 Lay out K-maps for each output, W X Y Z Σ m (5,6,7,8,9) W = A + BC + BD 53

Optimization BCD-to-Ecess-3 Lay out K-maps for each output, W X Y Z Σ m (,2,3,4,9) X = BC D +B C+B D 54

Optimization BCD-to-Ecess-3 Σ m (0,3,4,7,8) Y = C D + CD

Minimize K-Maps Z minimization Σ m (0,2,4,6,8) Z = D 56

Two level versus multi-level circuit implementation Have equations W = A + BC + BD X = B C + B D + BC D Y = CD + C D Z = D Call T= C+D, then T = (C+D) = C D W = A + BT X = B T + BT Y = CD + T Z = D 57

Create the digital circuit Implementing the second set of equations where T=C+D results in a lower gate count. This gate has a fanout of 3 58