0% found this document useful (0 votes)
16 views

Lecture 08

Uploaded by

ozcan8479
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Lecture 08

Uploaded by

ozcan8479
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

Circuit Simplification/Optimization

Asst. Prof. Mohanad Alayedi


Department of Software Engineering
Haliç University
[email protected]

CEN203, Fall 2024

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 1


Overview

 Circuit optimization
 Circuit implementation cost
 Boolean function optimization
 Karnaugh maps
– Two variable
– Three variable
– Four variable

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 2


Circuit optimization

 Goal: To obtain the simplest implementation for a given function


 Optimization is a more formal approach to simplification that is
performed using a specific procedure or algorithm
 Optimization requires a cost criterion to measure the simplicity of a
circuit
 Two distinct cost criteria we will use:
– Literal cost (L)
– Gate input cost (G)
• Gate input cost with NOTs (GN)

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 3


Literal cost

 Literal – a variable or its complement


 Literal cost – the number of literal
appearances in a Boolean expression
corresponding to the logic circuit diagram
 Examples:
– F = BD + AB'C + AC'D'
L=8
– F = BD + AB'C + AB'D' + ABC'
L=
– F = (A + B)(A + D)(B + C + D')(B' + C' + D)
L=
– Which solution is best?

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 4


Gate input cost

 Gate input costs - the number of inputs to the gates in the implementation
corresponding exactly to the given equation or equations. (G - inverters not counted,
GN - inverters counted)
 For SOP and POS equations, it can be found from the equation(s) by finding the sum of:
– all literal appearances
– the number of terms excluding terms consisting only of a single literal,
(G) and
– optionally, the number of distinct complemented single literals (GN).
 Example:

– F = BD + AB'C + AC'D' L = 8, G = 11, GN = 14


– F = BD + AB'C + AB'D' + ABC' L = 11, G = , GN =
– F = (A + B)(A + D)(B + C + D')(B' + C' + D) L = 10, G = , GN =
– Which solution is best?

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 5


Cost criteria 1

L = 5
 Example 1: G = L + 2 = 7
 F = A + BC + B'C' GN = G + 2 = 9

B
C
A F

 L (literal count) counts the AND inputs and the single literal OR input.
 G (gate input count) adds the remaining OR gate inputs
 GN(gate input count with NOTs) adds the inverter inputs

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 6


Cost criteria 2

A
 Example 2: B
 F = A B C + A'B'C' C
F
– L = 6, G = 8, GN = 11
 F = (A + C')(B' + C)(A' + B)
– L = 6, G = 9, GN = 12
 Same function and same literal
cost A
B
 But first circuit has better gate input C
count and better gate input count F
with NOTs
 Select it!

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 7


Boolean function optimization

 Minimizing the gate input (or literal) cost of a (a set of) Boolean equation(s)
reduces circuit cost.
 We choose gate input cost.
 Boolean Algebra and graphical techniques are tools to minimize cost
criteria values.
 Some important questions:
– When do we stop trying to reduce the cost?
– Do we know when we have a minimum cost?
 Treat optimum or near-optimum cost functions for two-level (SOP
and POS) circuits first.
 Introduce a graphical technique using Karnaugh maps (K- maps, for short)

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 8


Karnaugh maps (K-map)

 A K-map is a collection of squares


– Each square represents a minterm
– The collection of squares is a graphical representation of a Boolean function
– Adjacent squares differ in the value of one variable
– Alternative algebraic expressions for the same function are derived by
recognizing patterns of squares
 The K-map can be viewed as
– A reorganized version of the truth table

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 9


Uses of K-maps

 Provide a means for:


– Finding optimum or near optimum
• SOP and POS standard forms, and
• two-level AND/OR and OR/AND circuit implementations
 For functions with small numbers of variables
– Visualizing concepts related to manipulating
Boolean expressions, and
– Demonstrating concepts used by computer-aided
design programs to simplify large circuits

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 10


Two variable maps

 A 2-variable Karnaugh Map: y=0 y=1


– Note that minterm m0 and minterm m1 are
“adjacent” and differ in the value of the variable m0 = m1 =
x=0
y. x'y' x'y
– Similarly, minterm m0 and minterm m2 differ in m2 = m3 =
x=1
the x variable. x y' xy
– Also, m1 and m3 differ in the x variable as well.
– Finally, m2 and m3 differ in the value of the
variable y

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 11


K-map and truth tables

 The K-Map is just a different form of the truth table.


 Example – Two variable function:
– We choose a,b,c and d from the set {0,1} to
implement a particular function, F(x,y).

Function truth table K-map


Input Function
values values F(x,y) y = 0 y=1
(x,y) F(x,y)
00 a
x=0 a b
01 b
10 c
11 d
x=1 c d

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 12


K-map function representation

• Example:
F(x,y) = (2,3) F(x,y) y = 0 y=1
F(x,y) = xy' + xy
x=0 0 0

x=1 1 1

 For function F(x,y), the two adjacent cells containing


1’s can be combined using the Minimization Theorem:
F(x,y) = xy' + xy = x(y' + y) = x

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 13


K-map function representation

 Example:
G(x,y) = (1,2,3) G(x,y) y=0 y=1
G(x,y) = x'y + xy' + xy
x=0 0 1

x=1 1 1

 For G(x,y), two pairs of adjacent cells containing 1’s can be combined
using the Minimization Theorem:
G(x,y) = x'y + xy' + xy
G(x,y) = (x'y + xy) + (xy' + xy) = (x' + x)y + x(y' + y) = x + y
Duplicate xy

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 14


Three variable maps

y'z' y'z yz y'z


 A three-variable K-map:
x' m0 m1 m3 m2
x m4 m5 m7 m6

 Where each minterm corresponds to the product terms:


yz=00 yz=01 yz=11 yz=10

x=0 x'y'z' x'y'z x'y z x'y z'


x=1 x y'z' x y'z x y z x y z'
 Note that if the binary value for an index differs in one bit position, the
minterms are adjacent on the K-Map

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 15


Alternate map labeling

 Map use largely involves:


– Entering values into the map, and
– Reading off product terms from the map.
 Alternate labelings are useful:
yz
00 01 11 10
x
0 0 1 3 2
1 4 5 7 6

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 16


Example functions

 By convention, we represent the minterms of F by a "1" in


the map and leave the minterms of F' blank or put a 0
 Example: yz
F(x,y,z) = (2,3,4,5) x
00 01 11 10

0 1 3 2
0 1 1
4 5 7 6
 Example: 1 1 1
G(a,b,c) = (3,4,6,7)
 Learn the locations of the 8 bc
00 01 11 10
indices based on the variable a
order shown (x, ms 0 0 1 3 1 2
and z, ls) on the
7 6
map boundaries 1 4 1 5 1 1

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 17


Example: Combining squares

 Example: Let F(x,y,z) = (2,3,6,7)


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

 Applying the Minimization Theorem three times:


F(x,y,z) = x'yz' + x'yz + xyz' + xyz
= x'y(z' + z) + xy(z' + z) = x'y + xy
= (x' + x)y = y
 Thus the four terms that form a 2 × 2 square correspond to
the term "y".

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 18


Three variable maps

 Reduced literal product terms for SOP standard forms


correspond to rectangles on K-maps containing cell counts that
are powers of 2.
 Rectangles of 2 cells represent 2 adjacent minterms; of 4 cells
represent 4 minterms that form a “pairwise adjacent” ring.
 Rectangles can contain non-adjacent cells as illustrated by the
“pairwise adjacent” ring above.

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 19


Three variable maps

 Example Shapes of 2-cell Rectangles:


yz
x
Z

0 1 3 2

4 5 7 6
X

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 20


Three variable maps

 Example Shapes of 4-cell Rectangles:

yz
x
Z

0 1 3 2

4 5 7 6
X

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 21


Three variable maps

 K-Maps can be used to simplify Boolean functions


by systematic methods. Terms are selected to cover
the “1s”in the map.

 Example: x'y
Simplify yz
Z
x
F(x,y,z) = (1,2,3,5,7)
0 1 3 2
1 1 1
4 5 1 7 1 6
X
F = x'y + z
z Y

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 22


Three variable map simplification

 Use a K-map to find an optimum SOP equation for


 F(x,y,z) = (0,1,2,4,6,7)

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 23


Four variable maps

 Map and location of minterms z


yz
wx 00 01 11 10

00 0 1 3 2

01 4 5 7 6
x
11 12 13 15 14
w
10 8 9 11 10

y
CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 24
Four variable terms

 Four variable maps can have rectangles


corresponding to:
– A single 1 = 4 variables, (i.e. Minterm)
– Two 1s = 3 variables,
– Four 1s = 2 variables
– Eight 1s = 1 variable,
– Sixteen 1s = zero variables (i.e.
Constant "1")

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 25


Four variable maps

 Example shapes of rectangles


z

0 1 3 2

4 5 7 6
x
12 13 15 14
w
8 9 11 10

y
CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 26
Four variable maps

 Example shapes of rectangles


z

0 1 3 2

4 5 7 6
x
12 13 15 14
w
8 9 11 10

y
CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 27
Four variable maps

 Example shapes of rectangles


z

0 1 3 2

4 5 7 6
x
12 13 15 14
w
8 9 11 10

y
CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 28
Four variable maps

 Example shapes of rectangles


z

0 1 3 2

4 5 7 6
x
12 13 15 14
w
8 9 11 10

y
CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 29
Four variable map simplification 1

 F(w,x,y,z) = (0,2,4,5,6,7,8,10,13,15)

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 30


Four variable map simplification 2

 F(w,x,y,z) = (3,4,5,7,9,13,14,15)

0 1 3 2

4 5 7 6

12 13 15 14

8 9 11 10

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 31


References

Logic and Computer Design Fundamentals, by Charles Kime and Thomas


Kaminski, Pearson Education.

CEN203, Fall 2024 2024, Dr. Mohanad Alayedi (Haliç University) 32

You might also like