4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the...

12
4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum- cost impl. Approach: Find as few (fewer product terms) as possible and as large (fewer number of variables in each term) as possible groups of 1s that cover all cases where the function has a value of 1. This works well as the K-maps were small. For larger logic functions, which have many variables, this approach is unsuitable. We must have an organized method for deriving a min-cost impl. 1

Transcript of 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the...

Page 1: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

4.2 Strategy for minimization

• So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost impl. – Approach: Find as few (fewer product terms) as possible and as

large (fewer number of variables in each term) as possible groups of 1s that cover all cases where the function has a value of 1.

– This works well as the K-maps were small.

• For larger logic functions, which have many variables, this approach is unsuitable. – We must have an organized method for deriving a min-cost impl.– We will introduce a method similar to the one used in CAD tools.

1

Page 2: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

• Literal– Each appearance of a variable in a product term,

either un-complemented or complemented.

• Implicant – a product term that indicates the input valuation for

which a given function is equal to 1.• Most basic implicants are minterms: For an n-variable

function, a minterm is an implicant consisting of n literals

• Prime implicant– An implicant that it is impossible to delete any literal

and still have a valid implicant.

2

Page 3: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

More terminology

• Cover– A collection of implicants that account for all

valuations for which a given function is equal to 1.• Multiple different covers exist for most functions.• A set of all minterms for which f = 1 is a cover; a set of

all prime implicants is also a cover.

• Cost– The number of gates plus the total number of

inputs to all gates in the circuit.

3

Page 4: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

Figure 4.9. Three-variable function f (x1, x2, x3) = m(0, 1, 2, 3, 7).

x 1 x 2 x 3

1 1

1 1

x 1

0 0

1 0

00 01 11 10

0

1

x 2 x 3

An example

• 11 possible implicants• Two prime implicants

• Cover: f = x2+x2x3 =…

4

Page 5: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

Minimization procedure

• Lowest-cost implementation is achieved when the cover of a given function consists of prime implicants.– How to determine the minimum-cost subset of

prime implicants that will cover the function?– Essential prime implicant

• If a prime implicant includes a minterm for which f=1 that is not included in any other prime implicant, then it must be included in the cover.

5

Page 6: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

Process of finding a minimum-cost circuit

1. Generate all prime implicants for the given function f.

2. Find the set of essential prime implicants.

3. If the set of essential prime implicants covers all valuations for which f=1, then this set is the desired cover of f. otherwise, determine the nonessential prime implicants that should be added to form a complete minimum-cost cover.

6

Page 7: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

Figure 4.10. Four-variable function f ( x1,…, x4) = m(2, 3, 5, 6, 7, 10, 11, 13, 14).

x 1 x 2 x 3 x 4 00 01 11 10

1 1

1 1

1 1

00

01

11

10

x 1 x 3

1 1

1

x 3 x 4

x 1 x 2 x 4

x 2 x 3

x 2 x 3 x 4

1. Primary implicants

2. Essential primary implicants

(m11), (m13)

3. m7 is left, or can cover, we choose

with the lower cost.

7

f=

Page 8: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

Figure 4.11. The function f ( x1,…, x4) = m(0, 4, 8, 10, 11, 12, 13, 15).

x 1 x 2 x 3 x 4 00 01 11 10

1

1 1 1 1

1

00

01

11

10

x 1 x 2 x 4

1

1

x 3 x 4

x 1 x 2 x 4

x 1 x 2 x 3

x 1 x 2 x 3

x 1 x 3 x 4

8

1. Primary implicants

, ,

2. Essential primary implicants

3.If choosing , need , to cover m15, m11, and m10;

if choosing, need only to cover m10 and m11 which has lower cost.

f=

Page 9: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

Figure 4.12. The function f ( x1,…, x4) = m(0, 2, 4, 5, 10, 11, 13, 15).

x 1 x 2 x 3 x 4 00 01 11 10

1

1

1

1

1

1

00

01

11

10 1

1

x 1 x 3 x 4

x 2 x 3 x 4

x 2 x 3 x 4

x 1 x 3 x 4

x 1 x 2 x 4 x 1 x 2 x 4

x 1 x 2 x 3 x 1 x 2 x 3

9

1. Primary implicants

,

,, ,

2. No essential primary implicants

3. Can get two solutions with same cost.

f==

Page 10: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

4.3 Minimization of POS forms

10

x 1 x 2 x 3

1

00 01 11 10

0

1

1 0 0

1 1 1 0

x 1 x 2 +

x 1 x 3 +

Figure 4.13. POS minimization of f (x1, x2, x3) = M(4, 5, 6).

Combining property 14b(x+y)(x+) = x

f = () ()

=

= = = () ()

Page 11: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

11

x 1 x 2 x 3 x 4

0

00 01 11 10

0 0 0

0 1 1 0

1 1 0 1

1 1 1 1

00

01

11

10

x 2 x 3 + ( )

x 3 x 4 + ( )

x 1 x 2 x 3 x 4 + + + ( )

Figure 4.14. POS minimization of f ( x1,…, x4) = M(0, 1, 4, 8, 9, 12, 15).

f = (+) (+)( + + )

= +

= = = (+) (+) ( + + )

Page 12: 4.2 Strategy for minimization So far, we used an intuitive approach to decide how the 1s in the K-map should be grouped together to obtain the minimum-cost.

4.4 Incompletely specified functions

12

x 1 x 2 x 3 x 4

0

00 01 11 10

1 d 0

0 1 d 0

0 0 d 0

1 1 d 1

00

01

11

10

x 2 x 3

x 3 x 4

(a) SOP implementation

x 1 x 2 x 3 x 4

0

00 01 11 10

1 d 0

0 1 d 0

0 0 d 0

1 1 d 1

00

01

11

10

x 2 x 3 + ( )

x 3 x 4 + ( )

(b) POS implementation

Figure 4.15. Two implementations of the function f ( x1,…, x4) = m(2, 4, 5, 6, 10) + D(12, 13, 14, 15).

d can represent either 0 or 1.

f = + f = ) (