You are on page 1of 48

ESc201:IntroductiontoElectronics

DigitalCircuits2

Dr. K D K. V V. S Srivastava i t Dept. of Electrical Engineering IIT Kanpur


1

Goal of Simplification
I the In th SOP expression: i 1 Minimize number of product terms 1. 2. Minimize number of literals in each term

Simplification Minimization

Minimization

y = x1 . x2 . x3 + x1. x2 . x3 + x1. x2 . x3 + x1. x2 . x3 y = x1 . x3 .( ( x2 + x2 ) + x1. x3 .( ( x2 + x2 )

y = x1 . x3 + x1. x3
y =( ( x1 + x1 ). ) x3

y = x3
Principle i i l used: d x+ x =1
3

f = x . y + x. y + x . y Apply the Principle: x + x = 1 to simplify

f = x .( y + y ) + x . y
f = ( x + x) ( x + y ) f = ( x .x + xx + x . y + x. y ) f = ( x + x . y + x. y ) f = ( x + y.( x + x )) f = (x + y)

f = x + x. y

Principle: x + x = 1 and x + x = x
4

Need a systematic and simpler method

Karnaugh K hM Map (K map) )i is a popular l t technique h i f for carrying i out simplification It represents the information in problem in such a way that the two p principles p become easy y to apply pp y

Principle: x + x = 1 and x + x = x

K-map representation of truth table


x 0 0 1 1 y min term 0 1 0 1 x.y x.y x.y x.y m0 m1 m2 m3

y x 0 1
y x 0 1

0 m0 m2

1 m1 m3

x 0 0 1 1

y f1 0 1 0 1 0 1 1 0

0 0 1

1 1 0
6

f2 =

(1, 2,3 )
y x 0 1 0 1 0 1 0 1

y x 0 1

0 0 1

1 1 1

f = x .y + x . y
7

3-variable K-map representation

x 0 0 0 0 1 1 1 1

y z min terms 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 x.y.z x.y.z x.y.z x.y.z x.y.z x.y.z x.y.z x.y.z m0 m1 m2 m3 m4 m5 m6 m7

yz

00 m0 m4

01 m1 m5

11 m3 m7

10 m2 m6

0 1

3-variable K-map representation


x 0 0 0 0 1 1 1 1 y z min terms 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1 x.y.z x.y.z x.y.z x.y.z x.y.z x.y.z x.y.z x.y.z m0 m1 m2 m3 m4 m5 m6 m7
x 0 0 0 0 1 1 1 1 y z 0 0 1 1 0 0 1 1 f

0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1

yz

00 m0 m4

01 m1 m5

11 m3 m7

10 m2 m6

yz

00 0 0

01 1 1

11 1 1

10 0 0
9

0 1

0 1

What is the function represented by this K map?

yz

00 1 0

01 0 1

11 1 1

10 0 0

0 1

f = x .y . z + x . y . z + x . y . z + x . y . z
10

4-variable K-map representation


w x y z min i t terms m0 m1 m2 m3 m14 m15
10 0 0 1 0

0 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 1 0 1 1 1 1
yz wx 00 00 1 01 11 10 0 1 1 01 0 1 0 0 11 1 1 0 0

yz wx 00 00 0 01 11 10 4 12 8

01 1 5 13 9

11 3 7 15 11

10 2 6 14 10

f =w. x . y . z + w. x . y . z + w. x . y . z + w. x . y . z + w . x . y . z + w . x . y. z + w . x . y . z
11

Minimization using Kmap

f 2 = (2,3) (2 3)
f = x. y + x . y
f = x.( y + y )

y x 0 1

0 0 1

1 0 1

f= x
Combine terms which differ in only one bit position. As a result, whatever is common remains.
12

y x 0 1

0 0 0

1 1 1

f = x. y + x . y f = ( x. + x). y
y x 0 1 0 1 0

f=y
1 1 0

y x 0 1

0 1 1

1 0 0

f=y

f =x

13

f 2 = (1, 2,3)

x 0 1

0 0 1

1 1 1

f = x y + x y + x y = x y + x y + x y + x y = x ( y + y ) + (x + x ) y = x+ y
The idea Th id is i to t cover all ll the th 1s 1 with ith as few f and d as simple i l terms as possible
14

3-variable minimization

f = x .y . z + x . y . z + x . y . z + x . y . z
x yz 00 1 0 01 0 1 11 1 1 10 0 0

0 1

y. z

x. z
f = x .y . z + y . z + x . z
15

3-variable minimization

f = x .y . z + x . y . z + x . y . z + x . y . z
x yz 00 1 0 01 0 1 11 0 1 10 1 0

0 1

x. z

x. z

f = x . z + x. z
16

3-variable minimization
yz

00 0 1

01 0 1

11 0 1

10 0 1

0 1

f = x. y . z + x . y . z + x . y . z + x . y . z

x. y
x yz 00 0 1 01 0 1 0 1

x. y
11 0 1 10 0 1

f =x . y + x . y

f =x .( y + y ) = x

17

yz

00 1 0

01 1 0

11 1 0

10 1 0

yz

00 1 1

01 0 0

11 0 0

10 1 1

0 1

yz

00 0 0

01 1 1

11 1 1

10 0 0

yz

00 1 1

01 0 1

11 0 1

10 1 1

0 1

0 1

z
18

f =x + z

Can we do this ?

yz

00 0 1

01 0 1

11 0 1

10 0 0

0 1

Note that each encirclement should represent a single product term. In this case it does not.

f =x . y. z + x. y.z + x. y.z = x . y + x.z

We do not get a single product term. In general we cannot make groups of 3 terms.

19

Can we use kmap with the following ordering of variables?

yz

00 0 0

01 0 1

10 0 1

11 0 0

0 1

Can we combine these two terms into a single term ?

f =x . y. z + x. y.z = x .( y. z + y.z )
Note that no simplification is possible.
20

yz

00 0 0

01 1 0

10 0 0

11 1 0

0 1

These two terms can be combined into a single term but it is not easy to show that on the diagram.

f = x . y. z + x. y.z = x .( y + y ).z = x.z


Kmap p requires q information to be represented p in such a way y that it is easy to apply the principle

x + x=1

21

4-variable minimization
yz wx 00 00 1 01 11 10 0 1 1 01 0 1 0 0 11 1 1 0 0 10 0 0 1 0

w. y . z
w. x . z

w. y . z
f = w . y. z + w . x. z + w . y. z + w . x . y. z + w . x . y. z
Is this the simplest expression ?
22

yz wx 00 00 1
yz wx 00 00 1 01 11 10 0 1 1 01 0 1 0 0 11 1 1 0 0 10 0 0 1 0

01 0 1 0 0

11 1 1 0 0

10 0 0 1 0

01 11 10

0 1 1

w. x . y . z + w. x . y . z = x . y . z

w. x . y . z + w. x . y . z = w. x . z
23

4-variable minimization
yz wx 00 00 1 01 0 1 0 0 11 1 1 0 0 10 0 0 1 0

x. y. z

01 11 10

0 1 1

w. y . z

w. x . z

w. x . z

w. y . z
f = w . y. z + w . x. z + w . y. z + w . x . z + x . y. z
Is this the best that we can do ?
24

Cover the 1s with minimum number of terms


yz wx 00 00 1 01 11 10 0 1 1 01 0 1 0 0 11 1 1 0 0 10 0 0 1 0

yz wx 00 00 1 01 11 10 0 1 1

01 0 1 0 0

11 1 1 0 0

10 0 0 1 0

f = w . y. z + w . x. z + w . y. z + w . x . z + x . y. z

f = w . y. z + w . x. z + w . x . z + x . y. z
25

4-variable minimization
yz wx 00 00 1 01 11 10 1 0 1 01 0 1 0 0 11 0 0 0 0 10 0 0 0 1

yz wx 00 00 1 01 11 10 1 0 1

01 0 1 0 0

11 0 0 0 0

10 0 0 0 1

f = w . x. y + w. x. z + w . y. z

f = w . x. y + w. x. z + x . y. z

26

Groups of 4
yz wx 00 00 0 01 11 10 1 0 0 01 1 1 1 1 11 0 1 0 0 10 0 1 0 0

w. x

x. z
01 0 1 1 1 11 0 1 1 1 10 0 0 0 0
27

yz wx 00 00 0 01 0 0 0

y.z

11

w. z

10

yz wx 00 00 0 01 11 10 1 1 0

01 0 0 0 0

11 0 0 0 0

10 0 1 1 0

yz wx 00 00 0

01 1 0 0 1

11 1 0 0 1

10 0 0 0 0

x. z

01 11 10

0 0 0

x. z

yz wx 00 00 1 01 11 10 0 0 1

01 0 0 0 0

11 0 0 0 0

10 1 0 0 1

y yz wx 00 00 1

01 0 0 0 0

11 1 0 0 1

10 0 0 0 0
28

x. z

01 11 10

0 0 1

??

Groups of 8
y yz wx 00 00 0 01 11 10 0 0 0 01 1 1 1 1 11 1 1 1 1 10 0 0 0 0 yz wx 00 00 0 01 0 1 1 0 11 0 1 1 0 10 0 1 1 0

01 11 10

1 1 0

yz wx 00 00 1 01 11 10 1 1 1

01 0 0 0 0

11 0 0 0 0

10 1 1 1 1

yz wx 00 00 1

01 1 0 0 1

11 1 0 0 1

10 1 0 0 1
29

01 11 10

0 0 1

Examples

yz wx 00 00 0 01 11 10 1 1 0

01 1 1 1 0

11 0 1 1 0

10 1 1 1 1

yz wx 00 00 0 01 11 10 1 1 0

01 1 1 1 0

11 0 0 1 0

10 1 1 1 1

30

Dont care terms


a b c d Decimal Decoder y0 y1 y2 y3 y9

a b

d y0y1y2y3y4y5y6y7y8y9

0 0 0 0 1000000000 0 0 0 1 0100000000 0 0 1 0 0010000000 0 0 1 1 0001000000 0 1 0 0 0000100000 0 1 0 1 0000010000 0 1 1 0 0000001000

Y3

d cd ab 00 00 0 01 11 10 0 x 0

01 0 0 x 0

11 1 0 x x

10 0 0 x x

0 1 1 1 0000000100 1 0 0 0 0000000010 1 0 0 1 0000000001 1 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 1 1 1 1 xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx

y3 = a.b.c.d

31

Dont care terms can be chosen as 0 or 1. Depending on the problem, we can choose the dont care term as 1 and use it to obtain a simpler Boolean expression
Y3 cd d ab 00 00 0 01 11 10 0 x 0

01 0 0 x 0

11 1 0 x x

10 0 0 x x

y3 = b.c.d
Dont D t care t terms should h ld only l b be i included l d di in encirclements i l t if it helps in obtaining a larger grouping or smaller number of groups.
32

Product of Sum (PoS) Terms Representation


x 0 0 1 1 y f1 0 1 0 1 0 1 1 0
x 0 0 1 1 y Max term 0 1 0 1 x+y x+y x+y x+y M0 M1 M2 M3

f1 = ( x + y ) ( x + y )

f1 = M 0 M 3
f1 = (M 0 , M 3 )
33

Minimization of Product of Sum Terms using Kmap


y y x 0 1 0 0 1 1 1 1 y x 0 1 0 0 0 1 1 1 x 0 1 0 0 1 1 1 1

f = x+ y

f = x + x. y + x. y = x + ( x + x). y = x+ y
Sum of Product (SoP)

f=y
34

y x 0 1

0 1 1

1 0 0

y x 0 1

0 1 0

1 1 0

f =x

f=y
x yz 00 1 0 01 0 1 11 0 1 10 1 0

x+z

0 1

x+z
35

f =( x + z ).( x + z ) f = x . z + x . z

x+ y+z

yz wx 00 00 0 01 11 10 1 1 0

01 1 1 0 0

11 0 1 1 0

10 1 1 1 0

x+ y+z

w+ y + z

w+ x

f =( ( x + y + z) ).( ( x + y + z) ).( (w + y + z) ).( ( w + x)


36

Example
Obtain the minimized PoS by y suitably y using g dont care terms
yz wx 00 00 1 01 11 10 1 0 1

01 x 0 x x

11 0 1 1 1

10 1 1 1 x

f =( w + x + z ).( w + x + y ).( y + z )
37

Design Flow
System Description

x y z system f

y z 0 0 1 1 0 0 1 1 0 1 0 1 0 1 0 1

f 0 1 0 1 0 1 0 1

Truth Table

0 0 0 0 1 1 1 1

Boolean Expression

f = x .y . z + x . y . z + x . y . z + x . y . z
Minimized Boolean Expression

f = x . z + x. z
x y y

Gate Netlist

z x z

38

Mapping of Boolean expression to a Network of gates available in the library

y = x1 . x2 . x3 + x1. x2 . x3 + x1. x2 . x3 + x1. x2 . x3


x1 x2 x3 x1 x2 x3 x1 x2 x3 x1 x2 x3
39

Implementation using only NAND gates


NAND to Inverter

x. x = x
NAND to AND

x. y
NAND to OR

x. y

x
f = x. y = x + y

Implementation using only NAND gates


A SoP expression is easily implemented with NAND gates gates.
a b c d g h f

f =a.b + c.d + f .g

AND

OR

41

a b c d g h f

a b c d g h f

There is a one-to-one mapping between AND-OR network and NAND network


42

Often there is lot of further optimization that can be done Consider implementation of XOR gate

f = A .B + A. B

43

Implementation using only NOR gates


NOR to Inverter

x+ x = x
NOR to OR

x+ y
NOR to AND

x+ y

x
f = x + y = x. y
44

Implementation using only NOR gates


To implement using NOR gates, it is easiest to start with minimized Boolean expression in POS form
a b c d g h f

f =(a + b).(c + d ).( f + g )

OR

AND

45

f =(a + b).(c + d ).( f + g )


a b c d g h f

a b c d g h f

There is a one-to-one mapping between OR-AND network and NOR network


46

To implement SoP expression using NOR gates, determine first the corresponding PoS expression and then follow the procedure outlined earlier

Implement f(x,y,z) = x . z + x . z using NOR gates


yz

00 1 0

01 0 1

11 0 1

10 1 0
x

0 1

f =( x + z ).( ) ( x + z)

x z x z f

z x z f

Similarly PoS expression can be implemented as NAND network by first converting it to SoP expression and then following the procedure outlined earlier

47

How do we get the chocolate?

48

You might also like