MA251 Computer Organization and Architecture [ ]

MA251 Computer Organization and Architecture [3-0-0-6] Lecture 2: Simplification of Boolean Functions/ minimization of boolean functions Spring 2011 P...
Author: Eustace Richard
4 downloads 0 Views 874KB Size
MA251 Computer Organization and Architecture [3-0-0-6] Lecture 2: Simplification of Boolean Functions/ minimization of boolean functions Spring 2011 Partha Sarathi Mandal

Simplification of Boolean Functions

Examples of simplification A . B’ + A . B = A. (B’ + B) = A.1 =A (A + B).(A + B’) = (A + B.B’) =A+0 =A In the reverse way, you can expand a expression, Like X.Y = X.Y.1 = X.Y (Z + Z’) = X.Y.Z + X.Y.Z’

Simplification of Boolean Functions  An implementation of a Boolean Function requires  

the use of logic gates. A smaller number of gates, with each gate (other then Inverter) having less number of inputs, may reduce the cost of the implementation. There are 3 methods for simplification of Boolean functions. 1. Algebraic Method 2. Karnaugh Map (K-Map) 3. Quine-McCluskey 4

Methods : Simplification of Boolean Functions • The algebraic method by using Identities. • The graphical method by using Karnaugh Map (K-Map) method. • The tabular method by Quine-McCluskey • The K-map method is easy and straightforward. • A K-map for a function of n variables. – Consists of 2n cells, and, – in every row and column, two adjacent cells should differ in the value of only one of the logic variables. 5

Examples of K-Maps Examples: • Cell numbers are written in the cells. • 2-variable K-Map x'1 x1 x’2 x2

x’1x’2

x1x’2

x’1x2

x1 x2

x2

x1

0

1

0 0 1 1

2 3

6

Examples of K-Maps Examples: • Y= x’1x’2 + x1x’2 = (0,2)

x2

x1

0 1

0 1

1 1

x2

x1

0

1

0 0 1 1

2 3

7

3-Variable K-Map: •

3-variable K-map x3

x1x2

0 1

00

01

11

10

x’1x’2x’3

x’1x2x’3

x1x2x’3

x1x’2x’3

x’1x’2x3

x’1x2x3

x1 x2 x3

x1x’2x3

x3

x1x2

00 01 11 10 0 0 2 6 4 1 1 3 7 5

Example: Y= x’1x2x’3 + x1x2x’3 =(2,6) 8

3-Variable K-Map: •

3-variable K-map x3

x1x2

0 1

00

01

11

10

x’1x’2x’3

x’1x2x’3

x1x2x’3

x1x’2x’3

x’1x’2x3

x’1x2x3

x1 x2 x3

x1x’2x3

x3

x1x2

00 01 11 10 0 0 2 6 4 1 1 3 7 5

9

4-variable K-Map • 4-variable K-map

x1x2

x3x4

00 01 11 10

00 01 11 10 0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

10

K-map & minterm • A variable or its complement is called a literal. • For every K-map, each cell has a minterm associated with it. • Thus for cell no. 13 in the 4-variable K-map, the minterm is A.B.C’.D Or m13 = x1x2x’3x4

12

K-map & maxterms • For every K-map, each cell has one Maxterm associated with it. • Thus for cell no.13 in the 4-variable K-map, M13 = x’1+x’2+x3+x’4 • By De Morgan’s theorem, mi = Mi’ ADJACENT minterms (Maxterms): • Minterm which are identical, except for one variable, are considered to be adjacent to one another. • In a K-map, the corresponding cells are said to be adjacent cells.

13

Adjacent minterms: • Thus in K-4, Cell 0 is adjacent to cells 1, 4, 2 and 8. • In a K-map, the corresponding cells in the top and the bottom rows are adjacent to each other. Similarly the corresponding cells in the leftmost column and the rightmost column are adjacent to each other.  An Example: A function F, of 4 variables, is defined by the truth table given in the next slide. ( and again given in the next 3 slides):

14

Example: Truth Table

15

Example: TruthTable A B C D

F

0

0 0 0 0

1

1

0 0 0 1

0

2

0 0 1 0

1

3

0 0 1 1

1

4

0 1 0 0

0

5

0 1 0 1

1

Dec number

16

Example: TruthTable (continued)

Dec number

A

B

C D

F

6

0

1

1 0

1

7

0

1

1 1

1

8

1

0

0 0

1

9

1

0

0 1

0

10

1

0

1 0

1

11

1

0

1 1

1 17

Example: TruthTable (continued)

Dec Number

A

B C D

F

12

1

1 0 0

0

13

1

1 0 1

0

14

1

1 1 0

1

15

1

1 1 1

1 18

Sum of Products form: • The above table can be described by F =  m(0, 2, 3, 5, 6, 7, 8, 10, 11, 14, 15) The function can be written as: F = A’B’C’D’ + A’B’CD’ + A’B’CD + A’BC’D + A’BCD’ + A’BCD + AB’C’D’ + AB’CD’ + AB’CD + ABCD’ + ABCD …………………………………(1)  Each term on the RHS is a minterm.  The above function can be simplified by using the Identities.

19

The graphical method steps: • 

The graphical method steps: Insert 1 in those cells where the function F has a value of 1. Put 0 in the other cells. Examples: AB CD

00 01 11 10

00 1 01 0 11 0 10 1

0 1 0 0

1 1 1 1

1 1 1 1

20

Steps of graphical method (continued):  Combine adjacent 1’s into group of 2n each such that  Each group contains only 1’s not 0’s.  The group is not completely a part of a larger group.

 Choose the minimum number of the largest sized groups needed to cover all the 1’s.  Each group is represented by an expression which is an intersection of the minterm in the group.  The simplified solution is a logical OR of the expressions of all the groups chosen in steps 3 above.

21

Product of Sums Form: Using Maxterms For the same example, F=  M(1,4,9,12,13) = (A + B + C+ D’).(A + B’+ C + D).(A’+ B + C +D’). (A’ + B’ + C + D).( A’ + B’ + C +D’) …………..(2)

The simplification process is a dual of the process for the SOP form.

22

Use of KARNAUGH MAP for Simplification of Logic Functions SOL: On reading the three sets of adjacent boxes of 8, 4 and 2 cells respectively, we get:

F = C + B’.D’ + A’.B.D AB CD

24

SIMPLIFICATION using KARNAUGH MAP

Exam 2: F=∑ m(0,2,8,9,10,11,14,15) CD

AB

F= A.B’+A.C+B’.D’ 25

SIMPLIFICATION using KARNAUGH MAP Exam 3: Full-adder: A 0 0 0 0 1 1 1 1

B 0 0 1 1 0 0 1 1

C 0 1 0 1 0 1 0 1

S Carry 0 0 1 0 1 0 0 1 1 0 0 1 0 1 1 1

Carry= A.C+A.B+B.C

S=A.B’.C’ + A’.B’.C+A.B.C+A’.B.C’ 26

Quine-McCluskey Algorithm • Given Boolean function in the form of sum of Minterms find min sum of products. by – Exploit the adjacency to find prime implicants. – Find essential primes among primes via prime implicant chart.

Quine-McCluskey Algorithm • The method involves two steps: – Finding all prime implicants of the function. – Use those prime implicants in a prime implicant chart to find the essential prime implicants of the function, as well as other prime implicants that are necessary to cover the function.

Some Definitions The definitions: Given a function F of n variables. Implicant: A single 1, or group of 1's combined together on a map, is called an implicant of F. Prime Implicant : An implicant which cannot further combine with other implicants is called a Prime Implicant of F. A prime implicate is a group of 1,2,4,8… that cannot be contained in any larger group.

30

Prime implicant • Single 1 on a K-map represents a prime implicant if it is not adjacent to any other 1 • Two adjacent 1’s on a K-map form a prime implicant if they are not contained in a group of four 1’s • Four adjacent 1’s on a K-map form a prime implicant if they are not contained in a group of eight 1’s • etc.

31

Essential Prime Implicant • If minterm (i.e. a 1) can be covered by only one prime implicant, then that prime implicant is called an Essential Prime Implicant • All essential prime implicants must be present in the minimum expression for F. • Therefore find all essential prime implicants first. – examine each 1 on map – if that 1 + all adjacent 1's covered by one term only (i.e. encircled by one loop only), that term is essential – cover remaining 1's by minimum set of prime implicants

33

Groups of the minterms 1. Forms Groups of the minterms is the following ways. – – – –

Group 1: terms with no 1s. Group 2: terms which have only one 1. Group 3 terms which have only two 1s and so on.. The terms should be written in the ascending order of their values. • Example: 0001, 1000, 0100, 0010 should be written as 0001, 0010, 0100, 1000 and forms group 2.

– Each group has an equal number of ones in the input combination.

2. Each minterm can only be adjacent to the minterms in the next group.

Combining Minterms 2. Any two minterms which differ from each other by only one variable can be combined, and the unmatched variable removed (by marking ‘-’ or x). –

E.g., 0000 vs. 0100 yields 0-00 or 0x00 0000 vs. 1000 yields -000 or x000

3. When used in a combination, mark with a check. If cannot be combined, mark with a star. These are the prime implicants. 4. Continue again. Pair up rows from adjacent regions if they differ by exactly one bit. 5. Repeat until nothing left.

Prime implicant chart • The table is required to find essential prime implicant • Prime-implicant table – rows = prime implicants – columns = minterms of the function – place an "X" if the minterm is covered by the prime implicant. – If column has a single X, than the implicant associated with the row is essential. It must appear in minimum cover as well as other prime implicants that are necessary to cover the function.

Determine the prime implicants of the function given below F(w,x,y,z)=(1,4,6,7,8,9,10,11,15) • Grouping & Combining the minterms X001 * 01X0 * 100X  10X0  011X * 10X1 

101X  X111 * 1X11 *

10XX * 8, 10, 9, 11 10XX *

Prime implicants

Prime implicant chart • Eliminate all columns covered by essential primes • Find minimum set of rows that cover the remaining columns

Prime implicant chart

– the table shows that the selection of essential prime implicants covers all the minterms of the function except 7 and 15. – these two minterms must be included by the selection of one or more prime implicants. – Here xyz covers both minterms and hence one to be selected. – We have thus found the following minimum set of prime implicants whose sum gives the required minimized function.

Problem set 1

Problem set 1

contd…

Suggest Documents