بهينه سازي با نقشة کارنو

Slides:



Advertisements
Similar presentations
Digital Logic Design Gate-Level Minimization
Advertisements

Boolean Algebra and Reduction Techniques
K-Map Simplification COE 202 Digital Logic Design Dr. Aiman El-Maleh
Gate-level Minimization
ECE C03 Lecture 21 Lecture 2 Two Level Minimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECE 301 – Digital Electronics Karnaugh Maps (Lecture #7) The slides included herein were taken from the materials accompanying Fundamentals of Logic Design,
ENGIN112 L8: Minimization with Karnaugh Maps September 19, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 8 Minimization with Karnaugh.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 6 Dr. Shi Dept. of Electrical and Computer Engineering.
Gate-Level Minimization. Digital Circuits The Map Method The complexity of the digital logic gates the complexity of the algebraic expression.
Chapter 3 Simplification of Switching Functions
Circuit Optimization Goal: To obtain the simplest implementation for a given function Optimization is a more formal approach to simplification that is.
Give qualifications of instructors: DAP
Gate Logic: Two Level Canonical Forms
Contemporary Logic Design Two-Level Logic © R.H. Katz Transparency No. 3-1 Chapter #2: Two-Level Combinational Logic Section 2.1, Logic Functions.
Contemporary Logic Design Two-Level Logic © R.H. Katz Transparency No. 4-1 Chapter #2: Two-Level Combinational Logic Section 2.3, Switches and Tools.

EET 1131 Unit 5 Boolean Algebra and Reduction Techniques
Computer Engineering (Logic Circuits) (Karnaugh Map)
Introduction Gate-level minimization refers to the design task of finding an optimal gate-level implementation of Boolean functions describing a digital.
CS 151 Digital Systems Design Lecture 8 Minimization with Karnaugh Maps.
بهينه سازي با نقشة کارنو Karnaugh Map. 2  Method of graphically representing the truth table that helps visualize adjacencies 2-variable K-map 3-variable.
Week 3- slide 1 EE 231 Digital Electronics Fall 01 Gate Logic: Two-Level Simplification K-Map Method Examples F = A asserted, unchanged B varies G = B’,
Overview Part 2 – Circuit Optimization 2-4 Two-Level Optimization
Chapter 2: Boolean Algebra and Logic Functions
Overview of Chapter 3 °K-maps: an alternate approach to representing Boolean functions °K-map representation can be used to minimize Boolean functions.
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
Boolean Algebra and Digital Circuits
1 Simplification of Boolean Functions:  An implementation of a Boolean Function requires the use of logic gates.  A smaller number of gates, with each.
CT455: Computer Organization K-Map
Department of Computer Engineering
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC. K-Map (1)  Karnaugh Mapping is used to minimize the number of logic gates that are required in a digital circuit.
9/16/04UCB EECS150 D. Culler Fa04 1 EECS Components and Design Techniques for Digital Systems Lec 06 – Minimizing Boolean Logic 9/16-04 David Culler.
Optimization Algorithm
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. Circuit Optimization Logic and Computer Design Fundamentals.
ECE 2110: Introduction to Digital Systems PoS minimization Don’t care conditions.
EE345 – Micro-Controllers Gate-Level Minimization Prof. Ahmad Abu-El-Haija.
Gate-level Minimization
Chapter 2 Two- Level Combinational Logic. Chapter Overview Logic Functions and Switches Not, AND, OR, NAND, NOR, XOR, XNOR Gate Logic Laws and Theorems.
Computer Engineering (Logic Circuits) (Karnaugh Map)
Chapter3: Gate-Level Minimization Part 1 Origionally By Reham S. Al-Majed Imam Muhammad Bin Saud University.
Chapter 3 The Karnaugh Map
07 KM Page 1 ECEn/CS 224 Karnaugh Maps. 07 KM Page 2 ECEn/CS 224 What are Karnaugh Maps? A simpler way to handle most (but not all) jobs of manipulating.
CHAPTER 3: PRINCIPLES OF COMBINATIONAL LOGIC
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
LOGIC GATES & BOOLEAN ALGEBRA
Unit 1 Minimization Techniques and Logic Gates. Introduction to Digital Systems Analog devices and systems process time-varying signals that can take.
Ahmad Almulhem, KFUPM 2010 COE 202: Digital Logic Design Combinational Logic Part 3 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
Boolean Algebra & Logic Circuits Dr. Ahmed El-Bialy Dr. Sahar Fawzy.
BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
THE K-MAP.
1 Example: Groupings on 3-Variable K-Maps BC F(A,B,C) = A ’ B ’ A BC F(A,B,C) = B ’ A
 Seattle Pacific University EE Logic System DesignKMaps-1 Two-Level Simplification All Boolean expressions can be represented in two- level forms.
Key Observation Adjacencies in the K-Map
Digital Logic (Karnaugh Map). Karnaugh Maps Karnaugh maps (K-maps) are graphical representations of boolean functions. One map cell corresponds to a row.
CMPUT Computer Organization and Architecture II1 CMPUT329 - Fall 2003 Topic 4: Cost of Logic Circuits and Karnaugh Maps José Nelson Amaral.
Karnaugh Maps (K maps).
ECE 301 – Digital Electronics Minimizing Boolean Expressions using K-maps, The Minimal Cover, and Incompletely Specified Boolean Functions (Lecture #6)
K-maps and Decoders Prof. Sin-Min Lee Department of Computer Science.
CE1110: Digital Logic Design Gate Level Minimization Karnaugh Maps (K-Maps)
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
Chapter 2: Boolean Algebra and Logic Functions
Computer Organisation
Karnaugh Maps.
BASIC & COMBINATIONAL LOGIC CIRCUIT
Chapter 3 Gate-level Minimization.
Lecture 6 Karnaugh maps (K-maps) K-maps with “don’t cares”
COE 202: Digital Logic Design Combinational Logic Part 3
3-Variable K-map AB/C AB/C A’B’ A’B AB AB’
Presentation transcript:

بهينه سازي با نقشة کارنو Karnaugh Map

Karnaugh Map Method of graphically representing the truth table that helps visualize adjacencies A B 1 2 3 6 7 4 5 AB C 12 13 15 14 8 9 11 10 CD 00 01 D 4-variable K-map 2-variable K-map 3-variable K-map

Karnaugh Map One cell (in K-map) = a row (in truth table) one cell = a minterm (or a maxterm) Multiple-cell areas = standard terms A B 1 2 3 6 7 4 5 AB C 12 13 15 14 8 9 11 10 CD 00 01 D

Karnaugh Map A B C f1 1 1 1 1 1 f1(A,B,C) = m1 + m2 + m4 + m6 m0 1 m1 m2 m3 m4 m5 m6 m7 f1(A,B,C) = m1 + m2 + m4 + m6 = A’B’C + A’BC’ + AB’C’ + ABC’ A AB C 00 01 11 10 1 1 1 2 6 4 1 1 1 3 7 5 B

Karnaugh Map Numbering Scheme: 00, 01, 11, 10 Gray Code - only a single bit changes from code word to next code word. A B 1 A AB 00 01 11 10 CD 2 00 4 12 8 1 1 3 01 1 5 13 9 A D AB 11 C 00 01 11 10 3 7 15 11 C 10 2 6 14 10 2 6 4 1 B 1 3 7 5 B

Two-Variable Map (cont.) Any two adjacent cells in the map differ by ONLY one variable, which appears complemented in one cell and uncomplemented in the other. Example: m0 (=A’B’) is adjacent to m1 (=A’B) and m2 (=AB’) but NOT m3 (=AB) A B 1 2 3

Karnaugh Map Adjacencies in the K-Map Wrap from first to last column AB C 00 01 11 10 000 010 1 10 100 1 001 01 1 1 101 B Wrap from first to last column Top row to bottom row

2-Variable Map -- Example f(x1,x2) = x1’x2’+ x1’x2 + x1x2’ = m0 + m1 + m2 1s placed in K-map for specified minterms m0, m1, m2 Grouping (ORing) of 1s allows simplification What (simpler) function is represented by each dashed rectangle? m0 + m1 = x1’x2’+ x1’x2 = x1’(x2’+ x2 ) = x1’ m0 + m2 = x1’x2’+ x1x2’ = x2’(x1’+ x1 ) = x2’ Note m0 covered twice x2 1 x1 2 1 3

Minimization as SOP using K-map Enter 1s in the K-map for each product term in the function Group adjacent K-map cells containing 1s to obtain a product with fewer variables. Groups must be in power of 2 (2, 4, 8, …) Handle “boundary wrap” Answer may not be unique

Minimization as SOP A asserted, unchanged B varies B complemented, unchanged A varies A asserted, unchanged B varies F = ? Cout = ? F(A,B,C) = ?

Minimization as SOP G = B' B complemented, unchanged A varies A asserted, unchanged B varies F = A Cout = AB + Bcin + ACin F(A,B,C) = A

More Examples F(A,B,C) = Sm(0,4,5,7) F = F' : simply replace 1's with 0's and vice versa F'(A,B,C) = Sm(1,2,3,6) F' =

More Examples Why not group m4 and m5? F(A,B,C) = Sm(0,4,5,7) F = B' C' + A C F' simply replaces 1's with 0's and vice versa F'(A,B,C) = Sm(1,2,3,6) F' = B C' + A' C

Simplification Example: Enter minterms of the Boolean function into the map, then group terms Example: f(a,b,c) = bc’ + abc + ab’ Result: f(a,b,c) = bc’+ a ab c 00 01 11 10 1 ab c 00 01 11 10 1 1 1

4-Variable Map CD AB 00 01 11 10 m0 m4 m12 m8 00 m1 m5 m13 m9 01 m3 m7 F(A,B,C,D) = Sm(0,2,3,5,6,7,8,10,11,14,15) F = AB 00 01 11 10 CD m0 m4 m12 m8 00 m1 m5 m13 m9 01 m3 m7 m15 m11 11 m2 m6 m14 m10 10

Four-variable Map Simplification One square represents a minterm of 4 literals. A rectangle of 2 adjacent squares represents a product term of 3 literals. A rectangle of 4 squares represents a product term of 2 literals. A rectangle of 8 squares represents a product term of 1 literal. A rectangle of 16 squares produces a function that is equal to logic 1.

4-Variable Map F(A,B,C,D) = Sm(0,2,3,5,6,7,8,10,11,14,15) F = C + A' B D + B' D' Find the smallest number of the largest possible subcubes that cover the ON-set

Simplify for POS K-map Method: Circling Zeros to get product of sums form F = (B’ + C + D) (A’ + C + D’) (B + C + D’) Replace F by F’, 0’s become 1’s and vice versa F’ = B C’ D’ + A C’ D + B’ C’ D (F’)’ = (B C’ D’ + A C’ D + B’ C’ D)’ F = (B’ + C + D) (A’ + C + D’) (B + C + D’)

Don’t Cares Don't Cares can be treated as 1's or 0's if it is advantageous to do so F(A,B,C,D) = Sm(1,3,5,7,9) + Sd(6,12,13) F = w/o don't cares F = w/ don't cares A'D + B' C' D C' D + A' D AB 00 01 11 10 X 1 C CD A D B In Product of Sums form : F = D (A' + C') Same answer as above, but fewer literals

Example: Comparator Design Example: Two Bit Comparator Block Diagram F 1 2 3 D C B A B = C D B < C D B > C D N Block Diagram and Truth Table A 4-Variable K-map for each of the 3 output functions

1’s on K-map diagonals make XOR or XNOR Comparator K-Maps F1 = F2 = F3 = A' B' C' D' + A' B C' D + A B C D + A B' C D' A' B' D + B' C D + A' C B C' D' + A C' + A B D' = (A xnor C) (B xnor D)  much simpler, but not in sum of products form 1’s on K-map diagonals make XOR or XNOR

Example: Two Bit Adder Block Diagram and Truth Table Cout Block Diagram and Truth Table A 4-variable K-map for each of the 3 output functions

1's on diagonal suggest XOR! Adder K-Maps A A A AB AB AB CD 00 01 11 10 CD 00 01 11 10 CD 00 01 11 10 00 00 1 1 00 1 1 01 1 01 1 1 01 1 1 D D D 11 1 1 1 11 1 1 11 1 1 C C C 10 1 1 10 1 1 10 1 1 B B B K-map for X K-map for Y K-map for Z X = A C + B C D + A B D Z = B D' + B' D = B xor D Y = A' B' C + A B' C' + A' B C' D + A' B C D' + A B C' D' + A B C D = B' (A xor C) + A' B (C xor D) + A B (C xnor D) = B' (A xor C) + B (A xor C xor D) 1's on diagonal suggest XOR! gate count reduced if XOR available

Implementations of Y Two alternative implementations of Y with and without XOR Note: XOR typically requires 4 NAND gates to implement!

XOR تبديل مدارها به فقط Nand: بعداً xy’ + yx’ = xy’ + yx’ + xx’ + yy’ x(y’+x’) + y(x’+y’) x.(x.y)’ + y. (x.y)’ ((x.(x.y)’)’ . (y. (x.y)’)’)’ تبديل مدارها به فقط Nand: بعداً

Example: BCD Incrementer

Example: BCD Incrementer AB AB 00 01 11 10 1 X C CD A D B CD 00 01 11 10 00 X 1 01 X W D 11 1 X X C 10 X X B AB 00 01 11 10 X 1 C CD A D B Y AB 00 01 11 10 1 X C CD A D B Z W = B C D + A D' X = B C' + B D' + B' C D Y = A' C' D + C D' Z = D'

Order is important Order Dependency A AB CD 00 01 11 10 00 1 01 1 1 1 1 01 1 1 1 D 11 1 1 1 C 10 1 B

Definition of Terms Implicant: Prime Implicant (PI) (maximal PI): single element of the ON-set or any group of elements that can be combined together in a K-map (= adjacency plane) Prime Implicant (PI) (maximal PI): implicant (a circled set of 1-cells) satisfying the combining rule, such that if we try to make it larger (covering twice as many cells), it covers one or more 0s. Distinguished 1-cell: an input combination that is covered by only one PI. Essential Prime Implicant (EPI): a PI that covers one or more distinguished 1-cells.

Implicant, PI and EPI Minimum cover = First: cover EPIs AB 6 Prime Implicants: CD 00 01 11 10 A' B' D, B C', A C, A' C' D, A B, B' C D 00 1 1 01 1 1 1 D Essential 11 1 1 1 C 10 1 1 B Minimum cover = First: cover EPIs Then: minimum number of PIs = B C' + A C + A' B' D

Implicant, PI and EPI Minimum cover = First: cover EPIs AB CD 00 01 11 10 5 Prime Implicants: 00 1 B D, A B C', A C D, A' B C, A' C' D 01 1 1 1 D 11 1 1 1 essential C 10 1 B Minimum cover = First: cover EPIs Then: minimum number of PIs = A B C‘ + A C D + A' B C + A' C' D

More Examples = BD + AC + B' C Prime Implicants: B D, C D, A C, B' C AB Prime Implicants: CD 00 01 11 10 B D, C D, A C, B' C 00 essential 01 1 1 D 11 1 1 1 1 C 10 1 1 1 B = BD + AC + B' C

Example Example: f(A,B,C,D) = m(4,5,6,8,9,10,13) + d(0,7,15) Primes around A B C' D AB 00 01 11 10 X 1 C CD A D B Initial K-map Primes around A' B C' D'

(each element covered once) Example: Continued A Essential Primes with Min Cover (each element covered once) AB 00 01 11 10 X 1 C CD A D B AB CD 00 01 11 10 00 X 1 1 01 1 1 1 D 11 X X C 10 1 1 B Primes around A B' C' D'

5-Variable K-Map

5-Variable K-Map

5-Variable K-Map f(A,B,C,D,E) = Sm(2,5,7,8,10, 00 01 11 10 A=0 A=1 1 f(A,B,C,D,E) = Sm(2,5,7,8,10, 13,15,17,19,21,23,24,29 31) = C E + A B' E + B C' D' E' + A' C' D E'

6-Variable K-Map

7-Variable K-Map ?

8-Variable K-Map ?

ترکيب هاي XOR در جدول کارنو خانه هاي قطري نشان مي دهند يکي از فرم هاي XOR/XNOR است که با دقت بيشتر معلوم مي شود کدام است. 1 b a 1 ab’ + a’b = a XOR b 1 b a 1 a’b’ + ab = a XNOR b

ترکيب هاي XOR در جدول کارنو a’b’c’ + a’bc + abc’ + ab’c = a’(bc)’ + a(bc) = ao(bc) 00 01 11 10 1 c ab . 1 a’b’c + a’bc’ + abc + ab’c’ = a’(bc) + a(bc)’ = a(bc) 00 01 11 10 1 c ab 1

ترکيب هاي XOR در جدول کارنو a’.(boc): با بررسي بيشتر داخل o معلوم مي شود. a’(b’c’ + bc) = a’(bc) 00 01 11 10 1 c ab 1 b(aoc) b(a’c’ + …) = b (aoc) 00 01 11 10 1 c ab . 1

ترکيب هاي XOR در جدول کارنو ab 00 01 11 10 1 c cd a d b c’(aobod) ab 00 01 11 10 1 c cd a d b bd(aoc)

ترکيب هاي XOR در جدول کارنو 00 01 11 10 1 c ab 1 a’c’ + ac 00 01 11 10 1 c ab ac’+a’c 1

ترکيب هاي XOR در جدول کارنو 00 01 11 10 1 c ab 1 bc’ + b’c =(bc) 00 01 11 10 1 c ab b’c’ + bc 1

ترکيب هاي XOR در جدول کارنو قوت روش: به خصوص وقتي don’t care داريم.

Implementing by Nands only Universal gate  can replace gates by equivalent Nand circuit. Large circuit (many gates) But

DeMorgan’s Law: New Symbols for AND/OR (a + b)’ = a’ b’ (a b)’ = a’ + b’ a + b = (a’ b’)’ (a b) = (a’ + b’)’ = = = =

New Symbols for NOT (a . a)’ = a’ A _ A A (a + a)’ = a’ A A

NAND-Only Implementation Find Sum-of-Product form. Inventers can be added Equivalent NAND-only

Another Example

NOR-Only Implementation Find Product-of-Sums form. Inverters can be added Equivalent NOR-only

NAND-Only Implementation Another method: Group 0s in K-Map Find F’ in SOP form Add an inverter at the end.

NAND-Only Implementation Multi-Level Circuits Convert AND/OR gates to proper NAND gates AND  AND-NOT symbol OR  NOT-OR symbol Bubbles must cancel each other; otherwise, insert a NAND inverter. Take care of appropriate input literals.

NAND-Only Implementation Example:

NAND-Only Implementation Another Example:

NAND-Only Implementation Be careful about branches: Gates with multi-fanouts A B C D F X (a) (c) A B C D’ F X’ X A B C D’ F X’ (b)

NOR-Only Implementation Use “Duality” for the last several slides.

Analysis of NAND Circuits The functionality of a NAND-only circuit is not clear. Must be converted to AND-OR circuit.

Analysis of NAND Circuits Example

Analysis of NAND/NOR Circuits

Analysis of NAND/NOR Circuits

Variable-Entered Maps

Variable-Entered Maps Using a 3-variable K-Map for a 4-variable function Extract some variables out of the function:

Variable-Entered Maps To enter the variables in the K-map: Example:

Variable-Entered Maps To group map entries: Can consider F as: Pi’s are map-entered variables S0 : minimum sum obtained by P1=P2=…=0 S1 : minimum sum obtained by P1=1, Pj=0 (j=/ 1) and replacing all ‘1’’s on the map with ‘don’t cares (X)’ S2 : minimum sum obtained by P2=1, Pj=0 (j=/ 2) and replacing Ss:….

Variable-Entered Maps Example: A 6-variable function

Variable-Entered Maps Both C and C’ in the map-entered variables: F = A' B C' + A B’ C + A B C' + A B C = A' B (C') + A B’ (C) + A B (1) 1 B A A 1 B C F A 1 B F C’ C C C’ 1 C’ C 1

Variable-Entered Maps F = A' B (C') + A B’ (C) + A B 1 B A 1 1 B A 1 B A C = 0 C C’ 1 C C’ 1 1 B A F = AC + BC’ 1 X C = 1