Slides:



Advertisements
Similar presentations
Techniques for Combinational Logic Optimization
Advertisements

K-Map Simplification COE 202 Digital Logic Design Dr. Aiman El-Maleh
ECE 3110: Introduction to Digital Systems Simplifying Sum of Products using Karnaugh Maps.
Chapter 3 Simplification of Switching Functions. Karnaugh Maps (K-Map) A K-Map is a graphical representation of a logic function’s truth table.
MOHD. YAMANI IDRIS/ NOORZAILY MOHAMED NOOR
Chapter 3 Simplification of Switching Functions
Give qualifications of instructors: DAP

Computer Engineering (Logic Circuits) (Karnaugh Map)
ECE 331 – Digital System Design Karnaugh Maps and Determining a Minimal Cover (Lecture #7) The slides included herein were taken from the materials accompanying.
بهينه سازي با نقشة کارنو Karnaugh Map. 2  Method of graphically representing the truth table that helps visualize adjacencies 2-variable K-map 3-variable.
Logic gate level Part 3: minimizing circuits. Improving circuit efficiency Efficiency of combinatorial circuit depends on number & arrangement of its.
EECC341 - Shaaban #1 Lec # 7 Winter Combinational Circuit Minimization Canonical sum and product logic expressions do not provide a circuit.
Simplifying Boolean Expressions Using K-Map Method
Digital Logic Chapter 4 Presented by Prof Tim Johnson
BOOLEAN ALGEBRA Saras M. Srivastava PGT (Computer Science)
1 Simplification of Boolean Functions:  An implementation of a Boolean Function requires the use of logic gates.  A smaller number of gates, with each.
1 Chapter 5 Karnaugh Maps Mei Yang ECG Logic Design 1.
Chapter 3 Simplification of Switching Functions. Simplification Goals Goal -- minimize the cost of realizing a switching function Cost measures and other.
Department of Computer Engineering
1 Digital Logic Design Week 5 Simplifying logic expressions.
1 © 2015 B. Wilkinson Modification date: January 1, 2015 Designing combinational circuits Logic circuits whose outputs are dependent upon the values placed.
ECE 2110: Introduction to Digital Systems PoS minimization Don’t care conditions.
Two Level Networks. Two-Level Networks Slide 2 SOPs A function has, in general many SOPs Functions can be simplified using Boolean algebra Compare the.
Circuit Minimization. It is often uneconomical to realize a logic directly from the first logic expression that pops into your head. Canonical sum and.
Computer Engineering (Logic Circuits) (Karnaugh Map)
Chapter3: Gate-Level Minimization Part 1 Origionally By Reham S. Al-Majed Imam Muhammad Bin Saud University.
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
Minimisation ENEL111. Minimisation Last Lecture  Sum of products  Boolean algebra This Lecture  Karnaugh maps  Some more examples of algebra and truth.
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
CS1Q Computer Systems Lecture 7
Ahmad Almulhem, KFUPM 2010 COE 202: Digital Logic Design Combinational Logic Part 3 Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:
ENG241 Digital Design Week #2 Combinational Logic Circuits.
ECE 3110: Introduction to Digital Systems Chapter #4 Review.
Prof. Hsien-Hsin Sean Lee
June 12, 2002© Howard Huang1 Karnaugh maps Last time we saw applications of Boolean logic to circuit design. – The basic Boolean operations are.
BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION
CHAPTER 1 INTRODUCTION TO DIGITAL LOGIC
Karnaugh Maps (K-Map) A K-Map is a graphical representation of a logic function’s truth table.
C.S.Choy39 TERMINOLOGY Minterm –product term containing all input variables of a function in either true or complementary form Maxterm – sum term containing.
1 Example: Groupings on 3-Variable K-Maps BC F(A,B,C) = A ’ B ’ A BC F(A,B,C) = B ’ A
Karnaugh Maps (K maps).
ECE 301 – Digital Electronics Minimizing Boolean Expressions using K-maps, The Minimal Cover, and Incompletely Specified Boolean Functions (Lecture #6)
Chapter 3 Simplification of Switching Functions. Simplification Goals Goal -- minimize the cost of realizing a switching function Cost measures and other.
Karnaugh Maps The minimization method using Boolean Algebra, apart from being laborious and requiring the remembering all the laws, can lead to solutions.
CHAPTER 3 Simplification of Boolean Functions
Lecture 4 Nand, Nor Gates, CS147 Circuit Minimization and
DeMorgan’s Theorem DeMorgan’s 2nd Theorem
Computer Organisation
CS 352 Introduction to Logic Design
ECE 2110: Introduction to Digital Systems
Karnaugh Maps.
Digital Logic and Design
Optimized Implementation of Logic Function
BASIC & COMBINATIONAL LOGIC CIRCUIT
ECE 331 – Digital System Design
Digital Logic & Design Dr. Waseem Ikram Lecture 12.
Digital Logic & Design Dr. Waseem Ikram Lecture 13.
CHAPTER 5 KARNAUGH MAPS 5.1 Minimum Forms of Switching Functions
Karnaugh Maps Topics covered in this presentation: Karnaugh Maps
Optimization Algorithm
Karnaugh Maps Introduction Venn Diagrams 2-variable K-maps
COE 202: Digital Logic Design Combinational Logic Part 3
Minimization of Switching Functions
Overview Part 2 – Circuit Optimization
3-Variable K-map AB/C AB/C A’B’ A’B AB AB’
Karnaugh maps Last time we saw applications of Boolean logic to circuit design. The basic Boolean operations are AND, OR and NOT. These operations can.
Laws & Rules of Boolean Algebra
ECE 331 – Digital System Design
Presentation transcript:

Lecture 5 Karnaugh Maps One of the easiest ways to simplify a Boolean expression is through the use of a Karnaugh map. Let us recall the OR gate (again!) The Boolean minterm is A B + A B + A B The general form of a 2 input Karnaugh map is below. Note that each square differs from its neighbouring square by changing only 1 of the numbers- this is more important for 3 and greater Karnaugh maps A logic function with n variables will require 2n squares B A 00 01 11 10

To produce a simplified Boolean expression using a K-map (1) produce the Boolean minterm (2) plot the 1s for the ANDed variables in the appropriate square (3) loop adjacent (horizontal or vertical groups of 8, 4, or 2 1s together (4) eliminate variable/complements pairs (5) OR the remaining variables Lets use the OR function as an example. 1. The Boolean minterm is 2 A B + A B + A B B A

B A 1 Loop 1 3. Loop adjacent 1s Loop 2 4. Eliminate variable/complements pairs From loop 1: A B and A B, since A and A are variable and complement they are eliminated. This leaves only B. From loop 2, A B and A B, since B and B are variable and complement they are eliminated. This leaves only A. 5. OR the remaining variables Y = A + B

Note You may only loop horizontally or vertically. This is because you are changing just one variable at a time. You cannot loop diagonally. Start with the highest number of squares 8, then 4 then 2. If you have a group of 4, it is the same as looping 4 groups of 2. (Can you see where the 4 doublets are?) You can loop the same 1 more than once – in fact you can do this often.

Consider the case of a 3 input K map. In this case we have A, B and C which are grouped into the 4 possible AB combinations x 2 possible C combinations. Therefore the K map will have 8 squares A B A B C Consider the truth table. Step 1. Minterm Y =

Step 2. Mark 1s in the appropriate squares A B A B C Step 3. Loop 8, 4 or 2, adjacent 1s. Step 4. Eliminate variable/complements pairs Step 5. OR remaining variables

Check 1: Do we always get a 1 when C = 1 Do we always get a 1 when A B = 1

Check 2: Can we simplify the original minterm expression to get the same answer. Y = A B C + A B C + A B C + A B C + A B C

AB CD Pick any square and As the number of variables increases K maps become very useful. Consider the case of a 4 variable input (A,B,C and D). There are 4 possible AB combinations x 4 possible CD combinations so the K map will have 16 squares. Fill in the possible arrangements AB CD Pick any square and going vertically or horizontally we only change one variable at a time.

A B A B C D Note the pattern 0 0  0 1  1 1  1 0 We are changing one bit at a time. This single variable change is called adjacency. The bit in the sequence is 0 0 - which is the same as the first bit. This is important when considering special looping arrangements

Exercise 5.1 Use this 4 input truth table. Step 1. Write out the unsimplified Boolean minterm

Step 2. Mark 1s in the appropriate squares Step 3. Loop 8, 4 or 2 adjacent 1s. Step 4. Eliminate variable/complements pairs Step 5. OR remaining variables

Check: Do you get a ‘1’ when D = 1 or when A B C = 1

Lecture 6 K maps can have some unusual looping arrangements. You should prove to yourself that the K map for the expression Y = A B C D + A B C D + A B C D + A B C D + A B C D is given below A B A B C D 1

Is loop 3 permitted???? NO A B A B C D Loop 1 B and B - eliminate A, C, D - keep 1 1 1 1 1 Loop 2 B and B - eliminate A, C, D - keep Is loop 3 permitted???? NO

Why can we not loop on a diagonal or a group of 3??

So the original expression can be simplified to Y = A C D + A C D + A B C D But we can combine the first 2 terms here to give Y = A C D + A C D + A B C D = A (C + C ) D + A B C D = A D + A B C D Is this the case could we not have done this using the K-map. Answer – we can if we look for ‘unusual’ looping arrangements.

A B A B C D 1 Eliminate B and B also C and C which just leaves A and D A B A B 1 C D This grouping is equivalent to

Other interesting looping arrangements are A B A B C 1 1 No change 1 A B A B C Eliminate A and A gives B and C 1 1 1 Y = A B C + B C

A B A B C D 1 1 1 1 Y = B D

You should prove that looping (i) vertically and (ii) horizontally gives the same result. A B A B A B A B C D 1 1 C D C D C D 1 1

We can come to some conclusions about the structure of K maps We can come to some conclusions about the structure of K maps. For a 3 variable K map a 1 cell group yields a 3 variable product term a 2 cell group yields a 2 variable product term a 4 cell group yields a 1 variable product term a 8 cell group yields a value of 1 for the expression Example. What logic expression do we get from these K maps? A B A B C 1 1 1 1 A B A B C 1 1 1 1

This allows us to regard different parts of the K map to be associated with different variables.

For a 4 variable K map a 1 cell group yields a 4 variable product term a 2 cell group yields a 3 variable product term a 4 cell group yields a 2 variable product term a 8 cell group yields a 1 variable product term a 16 cell group yields a value of 1 for the expression A B A B C D

Similar to a 3 variable to a map we can regard different parts of the K map to be associated with different variables. A B A B C D

Some formal definitions A literal is a variable either complemented or not complemented. Example A, B and D Normal product term is a product of terms in which no variable appears more than once. Example AB or ACD. An example of a non-normal product term would be ACC

An implicant is a normal product term that implies Y = 1 An implicant is a normal product term that implies Y = 1. For example if Y= AB + BC, the implicants are AB and BC. A prime implicant (PI) is one that is not a subset of another implicant. In a K map a PI is the largest possible grouping allowed. E.g a group of 4 will be a PI whereas the two groups of 2 will only be implicants. A distinguished 1-cell is a cell that is covered by only one PI. In a K-map, such cells are 1s that are circled once. An essential prime implicant is a PI if it includes a 1 that is not included in any other prime implicant. For a K map the EPIs must include the PIs associated with a distinguished 1 cells.

5. A minimal sum is a SOP expression such that no SOP expression of Y has fewer product terms. It will include the EPIs but MUST also include whatever number of other terms to make sure that all the 1s have been covered.

The best way to examine these terms is by means of an example The best way to examine these terms is by means of an example. Using the information in the K-map to determine the number and list of PIs, The distinguished 1-cells, the EPIs and the minimal sum. A B A B C D 1

So we can write Y as Y = This SOP expression contains 5 terms – these are the 5 implicants. What we want to see is if it is possible to write out another expression for Y but which has fewer terms.

the PIs, The distinguished 1-cells, the EPIs and the minimal sum.

Recall that Y = Now Ymin = A C D + A C D + other terms???? The key point was the distinguished 1-cells are also EPI and the EPI will form part of the minimal sum. We must check whether using the EPIs alone is sufficient so that all the 1s are covered. Answer – NO we must add an extra term/s – but which one?? Add BCD to the EPIs to give the minimal sum

Exercise 6. 1. Here is a slight variation from the previous example Exercise 6.1. Here is a slight variation from the previous example. Using the information in the K-map to determine the number and list of PIs, The distinguished 1-cells, the EPIs and the minimal sum. A B A B C D 1

the PIs, The distinguished 1-cells, the EPIs and the minimal sum.

In each of the 3 maps the location of the EPI have been circled 1 In each of the 3 maps the location of the EPI have been circled How do we know that theses are EPIs? They are the PIs associated with a distinguished 1 cell. So the minimal sum will include these two terms. How many ways is it possible to group together the other 1s present using as small a number of groups as possible?? 1 1

So the minimal sum will include these two terms. Do these two terms cover all the 1s present? If YES then the the minimal sum is just the EPIs If NO then we need to add the minimal number of extra terms How many ways is it possible to group together the other 1s present using as small a number ofgroups as possible??

The previous example showed that that there are 3 ways to ensure that all the 1s are covered so there are three possible ways to write out the the minimal sum Ymin = A B C + A C D + Ymin = A B C + A C D + Each of these uses 4 terms. The original expression used 6. This means that there exist expressions with 5 PI but they do not form a minimal sum.

Exercise 6.2 Using the information in the K-map to determine the number and lists of PIs, The distinguished 1-cells, the EPIs and the minimal sum. A B A B C D 1 1 1 1 1 1 1 1 1

the PIs, The distinguished 1-cells, the EPIs and the minimal sum.

Remember this is the ‘sum-of-products’. Y = A B C + A B C Lecture 7 We can write the minterm as Since it consist of terms from rows 4 and 7 it can also be written as S A,B,C (4,7)= S (4,7). This is known as the canonical sum of the logic function and the elements within the sum make up the minterm list and mans ‘the sum of the minterms 4 and 7 with variables A,B and C’. Remember this is the ‘sum-of-products’. In the case of 3 input K map the cell numbers are Y = A B C + A B C

What are the cell numbers associated with the 4 variable K map. C D

0000 0001 0011 0010 0100 0101 0111 0110 1100 1101 1111 1110 1000 1001 1011 1010 4 1 8 12 2 3 5 9 13 7 11 15 6 10 14

Exercise 7. 1. Look at the K map below Exercise 7.1. Look at the K map below. Write out an canonical sum for Y? A B A B C D 1

Exercise 7.2 This system has four inputs and one outputs. The first two inputs A and B represent a 2-bit binary number in the range of 0 to 3. A second binary number (in the same range) is represented by the other two outputs, C and D. The output F is to be 1 if and only if the second number is larger than the first number. Show a truth table for F and write down the unsimplifed Boolean expression. Show F on a Karnaugh map and find a simplified expression for F.

The final aspect of K maps is the ‘don’t care’ condition. To produce a decimal signal for the numbers 0-9 we need to know the binary equivalents.

From the truth table binary numbers 0000 to 1001 represent 0 to 9. (This is a 4 bit weighted code and is correctly known as the 8421 BCD code – binary coded decimal). The truth table shows that possible values such as 1010 etc are possible but these would not lie in the range 0-9. These six combinations are called ‘Don’t cares’ when plotted on a Karnaugh map using an X We may allow the Xs to be 1 or 0 depending on our needs. In the example above, suppose to prevent using these 6 additional number we wish to stop when the BCD count reaches 9. The Boolean expression for this is D C B A (remember that A B = B A).

The 6 don’t cares are marked with an X which could me that they could be 0 or 1. A B A B C D X 1 We can then loop around, 8, 4 or 2 adjacent 1s and since the Xs could be 1s we loop around them and then proceed as normally. So the simplified expression is Y = D A

An interesting question. Why do we not loop like this as well. Answer. Firstly it does not cover a 1 and secondly it would add an extra term AB A B A B C D X 1

Exercise 7.3: Simplify the logic function given by f= S (1, 3, 7, 8, 9, 10, 12, 13, 14, 15) How would your answer change if the function to be minimised had don’t care conditions D = (4, 5, 11).