Sunteți pe pagina 1din 12

Digital Logic Design

Gate Level Minimization

Dr. Eng. Ahmed H. Madian


ahmed.madian@guc.edu.eg

Dr. Eng. Ahmed H. Madian

Outlines
Introduction The Karnaugh Map Method
Two-Variable Map Three-Variable Map Four-Variable Map Five-Variable Map

Product of Sums Simplification Dont-Care Conditions NAND and NOR Implementation Other Two-Level Implementations Exclusive-OR Function
Dr. Eng. Ahmed H. Madian 2

Minimization of Logic Functions


We have chips with millions of gates Why care about minimizing a function? What do a few gates matter? Basic logic functions replicated thousands of times Saving one gate for a memory cell pays off What is the criterion for minimization Should we minimize Number of product terms? Number of logic operations? Number of variables (literals)? Number of wires? ? For implementation: minimize number of gates
Dr. Eng. Ahmed H. Madian 3

How to Minimize Gate Count?


Example: F=ABC+ABC+ABC+ABC= (2,4,5,6) How many gates do we need for implementation? If AND gates have 3 inputs and OR gates have 4 inputs? If all gates are binary (2 inputs)? Are there any tricks we can use? Combine minterms: ABC+ABC=BC ABC+ABC=AB F = BC+AB How many gates does F need now? Simplest expression: Minimum number of terms and literals per term We need systematic approach to minimize expression Answer: Karnaugh maps (K-maps)
Dr. Eng. Ahmed H. Madian 4

Karnaugh Maps
Karnaugh maps (K-maps) are graphical representations of boolean functions. One map cell corresponds to a row in the truth table. Also, one map cell corresponds to a minterm or a maxterm in the boolean expression Multiple-cell areas of the map correspond to standard terms.

x 0 0 1 1

y 0 1 0 1

minterm m0 m1 m2 m3

Dr. Eng. Ahmed H. Madian

Two-Variable Map
x2 x1
0

0
1

1 m0 m1
3

x1 x2

0
0 2

1 m0 m2
3

0
2

OR

0
1

m2

m3

m1

m3

NOTE: ordering of variables is IMPORTANT for f(x1,x2), x1 is the row, x2 is the column. Cell 0 represents x1x2; Cell 1 represents x1x2; etc. If a minterm is present in the function, then a 1 is placed in the corresponding cell.
Dr. Eng. Ahmed H. Madian 6

Boolean Function in Karnaugh Map


1s and 0s represent function in Karnaugh map 1 represent On-set (F=1), 0 represents Off-set (F=0) Similar to truth table 0s are typically not shown
x 0 0 1 1 y 0 1 0 1 f 0 0 0 1 x 0 0 1 1 y 0 1 0 1 f 0 1 1 1

Dr. Eng. Ahmed H. Madian

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 (=x1x2) is adjacent to m1 (=x1x2) this means that x1x2 +x1x2= x1(x2+x2)=x1 Also m0 (=x1x2) is adjacent to m2 (=x1x2) x1x2 +x1x2= x2(x1+x1)=x2 but m0 (=x1x2) is NOT adjacent m3 (=x1x2)

Two-Variable Map

Dr. Eng. Ahmed H. Madian

2-Variable Map -- Example


f(x1,x2) = x1x2+ x1x2 + x1x2 = m0 + m1 + m2 = x1 + x2 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? x1 = m0 + m1 x2 = m0 + m2 Note m0 covered twice x2

x1
0

0
1

0
2

1
3

1 0

Dr. Eng. Ahmed H. Madian

3-variable Karnaugh Map


Karnaugh map with 3 variables: Two variables on one side, one on the other Note Gray code sequence (single variable change) facilitates grouping of 1-entries into logic blocks Note that the minterms are not arranged in a binary sequence, but similar to the Gray code. For simplifying Boolean functions, we must recognize the basic property possessed by adjacent squares. m5+m7= xyz + xyz = xz(y + y) = xz cancel

Dr. Eng. Ahmed H. Madian

10

Blocks in Karnaugh Maps


Identifying blocks in Karnaugh maps
Neighboring minterms can be combined:
xyz + xyz = xy(z+z) = xy

Resulting expression uses fewer literals (z no longer present)

Dr. Eng. Ahmed H. Madian

11

3-Variable Map
yz x
0

00
1

01
3

11
2

10 m2
6

0
4

m0
5

m1
7

m3 m7

m4

m5

m6

-Note: variable ordering is (x,y,z); yz specifies column, x specifies row. -Each cell is adjacent to three other cells (left or right or top or bottom or edge wrap)

Dr. Eng. Ahmed H. Madian

12

3-Variable Map (cont.)minterm


The types of structures that are either minterms or are generated by repeated application of the minimization theorem on a three variable map are shown at right. Groups of 1, 2, 4, 8 are possible.

group of 2 terms group of 4 terms


Dr. Eng. Ahmed H. Madian 13

Example: Blocks in Karnaugh Maps


Example:
F(x,y,z) = (2,3,4,5) = xyz+xyz+xyz+xyz Two blocks of size 2:

F = xy + xy

Dr. Eng. Ahmed H. Madian

14

Example: Blocks in Karnaugh Maps


What is the Karnaugh map for F(x,y,z) = (3,4,6,7) ? Block can continue across borders, wrap around Left to right Top to bottom

Dr. Eng. Ahmed H. Madian

15

Blocks in Karnaugh Maps


Can we combine more than two minterms? Yes: xyz+xyz+xyz+xyz = (x+x)y(z+z) = y Any block that is power of 2 size can be reduced Needs to be filled entirely with 1s Largest possible block yields simplest expression

Dr. Eng. Ahmed H. Madian

16

Overlapping Blocks
Example:
F(A,B,C) = (1,2,3,5,7) Blocks can overlap Still find the largest possible power-2 blocks

Dr. Eng. Ahmed H. Madian

17

Converting Blocks into Expressions


How to convert blocks into algebraic expressions? Write down the variables that do not change Example: F(A,B,C) = C + AB

Dr. Eng. Ahmed H. Madian

18

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

1 1
10

1 1
11

1 1
10

1 1
11

Dr. Eng. Ahmed H. Madian

19

More Examples f1(x, y, z) = m(2,3,5,7) f1(x, y, z) = xy + xz yz X 0 1 1 00 01 11 1 1 10 1

f2(x, y, z) = m (0,1,2,3,6) f2(x, y, z) = x+yz


Dr. Eng. Ahmed H. Madian

1 1

20

10

More Examples

Dr. Eng. Ahmed H. Madian

21

4-variable Karnaugh Map


Karnaugh map can be extended to 4 variables: Top cells are adjacent to bottom cells. Left-edge cells are adjacent to right-edge cells. Note variable ordering (WXYZ).

Dr. Eng. Ahmed H. Madian

22

11

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.

Dr. Eng. Ahmed H. Madian

23

Example
Simplify the following Boolean function (A,B,C,D) = m(0,1,2,4,5,7,8,9,10,12,13). First put the function g( ) into the map, and then group as many 1s as possible.
ab 00 01 11 10

cd

00
1 1 1 1

01
1 1 1 1

11
1

10
1

00
1 1 1

01
1 1 1 1

11

10
1

g(A,B,C,D) = bd+c+abd
Dr. Eng. Ahmed H. Madian 24

12

S-ar putea să vă placă și