You are on page 1of 22

Digital Electronics Basics:

Combinational Logic

for
Basic Electronics

http://cktse.eie.polyu.edu.hk/eie209

by
Prof. Michael Tse

January 2005
Digital versus analog
So far, our discussion about electronics has been predominantly “analog”,
which is concerned with continuously changing signals—signals whose values
at different times are useful information.

There is another form of signals which is nowadays very important and is


being used in an overwhelming number of applications—DIGITAL.

A digital signal assumes just a few analog values. For example, binary signals
have two values, e.g., 0V and 5V. They transmit information in the form of a
sequence of 0V and 5V segments.

5V

0V

0 1 0 1 0 0 1 0 1 1 0

C.K. Tse: Digital Electronics: 2


Combinational Logic
Digital signals
Of course, in practical generation and detection of digital signals, exact values of
the assumed voltage levels are not possible.

Noise Margins:
5V
VOH VIH
VOL
0V VIL

0 1 0 1 0 0 1 0 1 1 0

Generation: Any voltage higher than VOH is HIGH. (VOH = 2.4V*)


Any voltage lower than VOL is LOW. (VOL = 0.4V)

Detection: Any voltage higher than VIH is HIGH. (VIH = 2.0V)


Any voltage lower than VIL is LOW. (VIL = 0.8V)

* for TTL logic which is a particular kind of logic circuit family.

C.K. Tse: Digital Electronics: 3


Combinational Logic
Logic
What can a digital circuit do?

The simplest task we can think of is a combinational type of logic decision.

For example, we can design a digital electronic circuit to make an instant decision
based on some information. Here we emphasize “instant” in the decision making
process. That means, the process has no time delay.

X = today’s weather is good


Y = today is a holiday
decision Z = go to picnic

Suppose our rule is Z = X and Y X


Z
The circuit is a simple AND gate. Y

This kind of logic, involving no time delay, is combinational logic.

C.K. Tse: Digital Electronics: 4


Combinational Logic
Truth tables
A easy way to represent a combinational logic result is to tabulate all possible inputs.

X Y Z X Y Z X Z
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
Truth table of AND Truth table of OR Truth table of NOT
X X
Z Z X Z
Y Y

X Y Z X Y Z X Y Z
0 0 1 0 0 1 0 0 0
0 1 1 0 1 0 0 1 1
1 0 1 1 0 0 1 0 1
1 1 0 1 1 0 1 1 0
Truth table of NAND Truth table of NOR Truth table of XOR (Exclusive OR)
X X X
Z Z Z
Y Y Y
C.K. Tse: Digital Electronics: 5
Combinational Logic
Boolean algebra
Logic can also be expressed in algebraic form.

X Y Z
0 0 0 X
0 1 0 Z = X.Y Y
Z
1 0 0 AND gate
1 1 1
Truth table of AND

X Y Z X
0 0 1 Y Z
0 1 1
Z = X.Y
1 0 1 X
Z
Y
1 1 0
Truth table of NAND NAND gate

C.K. Tse: Digital Electronics: 6


Combinational Logic
Boolean algebra
Logic can also be expressed in algebraic form.

X Y Z
0 0 0 X
0 1 1 Z = X+Y Y
Z
1 0 1 OR gate
1 1 1
Truth table of OR

X Y Z X
0 0 1 Y Z
0 1 0
Z = X+Y
1 0 0 X
Z
Y
1 1 0
Truth table of NOR NOR gate

C.K. Tse: Digital Electronics: 7


Combinational Logic
Finding expression from truth table
Once we have the truth table, we can find the output expression by adding up
all min-terms.

Min-term corresponds to the product term that give a 1 in the output.


For example, here the min-terms are X .Y , X.Y , and X.Y

X Y Z The expression for Z is


0 0 0
0 1 1 Z = X .Y + X.Y + X.Y
1 0 1
1 1 1

Question: This is an OR gate! Can it be simplified down to Z = X + Y ? How


can we do it?

C.K. Tse: Digital Electronics: 8


Combinational Logic
More examples
X Y Z The expression for Z is
0 0 1
0 1 1 Z = X .Y + X .Y + X.Y
1 0 1
1 1 0

X Y Z
The expression for Z is
0 0 1
0 1 0
1 0 0
Z = X .Y
1 1 0
Truth table of NOR

Question: These are NAND and NOR gates! Can they be simplified or
converted back to the originally derived forms? How can we do it?

C.K. Tse: Digital Electronics: 9


Combinational Logic
Circuit realization
X

Z = X .Y + X .Y + X.Y
Y
Z

Note: This is same as a NAND gate (see the truth table), and hence should be the
same as
X
Z
Y

The question is HOW TO SIMPLIFY A MIN-TERM EXPRESSION!

C.K. Tse: Digital Electronics: 10


Combinational Logic
Example: binary code to Gray code conversion
Binary Gray code What are the expressions for x, y
a b c x y z and z? Then, can we design a
0 0 0 0 0 0 circuit to converter binary code
0 0 1 0 0 1 to Gray code?
0 1 0 0 1 1
0 1 1 0 1 0 x = ab c + ab c + abc + abc
1 0 0 1 1 0
1 0 1 1 1 1 y = a bc + a bc + ab c + ab c
1 1 0 1 0 1 z = a b c + a bc + ab c + abc
1 1 1 1 0 0

So, for each of x, y and z, we need a number of inverters,


plus 4 AND gates and a multi-input OR gates.

C.K. Tse: Digital Electronics: 11


Combinational Logic
Boolean algebra simplification

Basic Laws:

Commutative: X+Y = Y+X


X.Y = Y.X

Associative: X+Y+Z = (X+Y)+Z = X+(Y+Z)


X.Y.Z = (X.Y).Z = X.(Y.Z)

Distributive: X.(Y+Z) = X.Y + X.Z

De Morgan’s: X+Y = X . Y
X.Y = X + Y

C.K. Tse: Digital Electronics: 12


Combinational Logic
Example:
Z = X .Y + X .Y + X.Y
= X .(Y + Y ) + X.Y
= X .1+ X.Y Y +Y =1
= X + X.Y X .1 = X
= (X.(X + Y )) De Morgan’ law

= (X.X + X.Y ) Distributive

= X.Y X .X = 0

That’s right! It’s a NAND gate!

C.K. Tse: Digital Electronics: 13


Combinational Logic
Example:

Z = X .Y + X.Y + X.Y
= (X + X).Y + X.Y
= Y + X.Y

= Y .(X.Y ) De Morgan’ law

= Y .(X + Y ) De Morgan’ law

= X .Y + 0 Y .Y = 0
= X .Y
= X +Y De Morgan’ law

That’s right! It’s a OR gate!


C.K. Tse: Digital Electronics: 14
Combinational Logic
Boolean algebra can be tedious.

Is there any easier method to simplify the min-term


expression?

C.K. Tse: Digital Electronics: 15


Combinational Logic
Karnaugh Maps

A very useful design tool for simplifying combinational logic.

X Y Z The expression for Z is


0 0 1
0 1 1 Z = X .Y + X .Y + X.Y
1 0 1
1 1 0
Y Y Y Y Y
0 1
0 1 1 X 1 1 X X 1 1
X
1 1 0 X 1 0 X 1 0

X.Y
Y

Therefore Z = X + Y or Z = X.Y
C.K. Tse: Digital Electronics: 16
Combinational Logic
Karnaugh map (with 3 inputs)

Suppose we have three inputs a, b and c.

Output x is
Procedure:
x = a.b.c + a.b .c + a .b.c + a.b.c 1. Circle clusters of “1”.
2. Determine the logic
b 110
b expressions for each cluster.
} 011

}
bc 3. Add them up.
a 00 01 11 10

111 a{ 0 0 0 1 1
ab
a{ 1
1 0 1 0
}

}
}

100
c c c Hence, we get
x = a.b.c + b.c + a .b
bc
abc
C.K. Tse: Digital Electronics: 17
Combinational Logic
Example: Gray code b b

}
}
bc
Binary Gray code a 00 01 11 10
a b c x y z
0 0 0 0 0 0 a{ 0 0 0 1 1
0 0 1 0 0 1 y
0
0
1
1
0
1
0 1 1
0 1 0
a{ 1
1 1 0 0

}
}
}
1 0 0 1 1 0
1 0 1 1 1 1 c c c
1
1
1
1
0
1
1 0 1
1 0 0
y = ab + a b
b b b
b

}
}
}
}

bc bc
a a 00 01 11 10
00 01 11 10

a{ 0 0 0 0 0 a{ 0 0 1 0 1
x z
a{ 1
1 1 1 1 a{ 1
0 1 0 1

}
}
}

}
}

c c c c c
c
x=a z = b c + bc
C.K. Tse: Digital Electronics: 18
Combinational Logic
Example: Gray code
a
Binary
b c
Gray code
x y z
x=a
0 0 0 0 0 0
0 0 1 0 0 1 y = ab + a b
0 1 0 0 1 1
0
1
1
0
1
0
0 1 0
1 1 0
z = b c + bc
1 0 1 1 1 1
1 1 0 1 0 1
1 1 1 1 0 0 a x

y
b

C.K. Tse: Digital Electronics: 19


Combinational Logic
Karnaugh map (with 4 inputs)

c c

{
{
cd
ab 00 01 11 10

00 }b
a { 01

11
} b

a { 10
{
} }b

{
d d d

C.K. Tse: Digital Electronics: 20


Combinational Logic
c c
Example

{
{
cd
Procedure: ab 00 01 11 10
1. Circle clusters of “1”.
00 1 1 0 0 }b
2.

3.
Determine the logic
expressions for each cluster.
Add them up.
a { 01 1 1 1 1

ac 11 1 1 1 1
} b

a { 10 0 0 1 1 }b

}
{

{
d d d
b
ac
x = a c + b + ac
C.K. Tse: Digital Electronics: 21
Combinational Logic
Example
Derive the circuit for this combinational logic.

x = a c + b + ac

a
c
b x

C.K. Tse: Digital Electronics: 22


Combinational Logic

You might also like