0% found this document useful (0 votes)
77 views44 pages

EL2095 Digital System Optimizations (CH 4) : Sekolah Teknik Elektro Dan Informatika Institut Teknologi Bandung

The document discusses optimizations and tradeoffs in digital circuit design. It introduces two important design criteria: delay, which is the time from input changes to stable output, and size, which is the number of transistors. An optimization is when all criteria of interest are improved, such as reducing both delay and size. A tradeoff improves some criteria but worsens others, like reducing size but increasing delay. Karnaugh maps provide a visual way to perform algebraic logic minimization to find optimized or tradeoff solutions with minimum components. Grouping adjacent cells in the map according to variable values yields minimum cover expressions.

Uploaded by

Wildan Abdullah
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)
77 views44 pages

EL2095 Digital System Optimizations (CH 4) : Sekolah Teknik Elektro Dan Informatika Institut Teknologi Bandung

The document discusses optimizations and tradeoffs in digital circuit design. It introduces two important design criteria: delay, which is the time from input changes to stable output, and size, which is the number of transistors. An optimization is when all criteria of interest are improved, such as reducing both delay and size. A tradeoff improves some criteria but worsens others, like reducing size but increasing delay. Karnaugh maps provide a visual way to perform algebraic logic minimization to find optimized or tradeoff solutions with minimum components. Grouping adjacent cells in the map according to variable values yields minimum cover expressions.

Uploaded by

Wildan Abdullah
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/ 44

EL2095 Digital System

Optimizations (CH 4)
Sekolah Teknik Elektro dan Informatika
Institut Teknologi Bandung

Introduction
We now know how to build digital circuits

How can we build better circuits?

Lets consider two important design criteria

Delay the time from inputs changing to new correct stable output
Size the number of transistors
For quick estimation, assume

Transforming F1 to F2 represents
an optimization: Better in all
criteria of interest

Every gate has delay of 1 gate-delay


Every gate input requires 2 transistors
Ignore inverters
22 transistors
2 gate-delays

w
x
y

F1
w
x
y

6 transistors
1 gate-delay
w
x

F1 = wxy + wxy
(a)

= wx(y+y) = wx

F2

F2 = wx
(b)

F1

20
size
(transistors)

15
10
F2

1 2 3 4
delay (gate-delays)
(c)

Note: Slides with animation are denoted with a small red "a" near the animated items

Introduction
Tradeoff

Improves some, but worsens other, criteria of interest

Transforming G1 to G2
represents a tradeoff: Some
criteria better, others worse.
w
x

20 transistors
2 gate-delays
G1

w
y
z

G1 = wx + wy + z

18 transistors
3 gate-delays

x
y
z

G2

G2 = w(x+y) + z

20
size
(transistors)

15

G1
G2

10
5
1 2 3 4
delay (gate-delays)

Introduction
Tradeoffs

delay

Some criteria of interest


are improved, while
others are worsened

size

All criteria of interest


are improved (or at
least kept the same)

size

Optimizations

delay

We obviously prefer optimizations, but often must accept


tradeoffs

You cant build a car that is the most comfortable, and has the
best fuel efficiency, and is the fastest you have to give up
something to gain other things.

Combinational Logic Optimization and Tradeoffs

Two-level size optimization using algebraic


methods

Goal: circuit with only two levels (ORed AND


gates), with minimum transistors

Though transistors getting cheaper (Moores


Law), they still cost something

Define problem algebraically

Sum-of-products yields two levels

F = abc + abc is sum-of-products; G = w(xy + z)


is not.

Transform sum-of-products equation to have


fewest literals and terms

Each literal and term translates to a gate input,


each of which translates to about 2 transistors
(see Ch. 2)

Ignore inverters for simplicity

Example
F = xyz + xyz + xyz + xyz
F = xy(z + z) + xy(z + z)
F = xy*1 + xy*1
F = xy + xy
x

4 literals + 2
terms = 6
gate inputs

y
F
x
y

6 gate inputs =
18 transistors

Note: Assuming 6-transistor 2-input AND/OR circuits;


iNAND/NOR are so efficient.

1
y

m
y

1
1

m
x

0
n

F
1

m
y

0
n

y
x

0
0

Algebraic Two-Level Size Minimization

Previous example showed common


algebraic minimization method

(Multiply out to sum-of-products, then)


Apply following as much possible

ab + ab = a(b + b) = a*1 = a
Combining terms to eliminate a variable

Note that doesnt change function

(Formally called the Uniting theorem)

Duplicating a term sometimes helps

F = xyz + xyz + xyz + xyz


F = xy(z + z) + xy(z + z)
a
F = xy*1 + xy*1
F = xy + xy

F = xyz + xyz + xyz


F = xyz + xyz + xyz + xyz
F = xy(z+z) + xz(y+y)
a
F = xy + xz

c + d = c + d + d = c + d + d + d + d ...

Sometimes after combining terms, can


combine resulting terms

G = xyz + xyz + xyz + xyz


G = xy(z+z) + xy(z+z)
G = xy + xy a (now do again)
G = x(y+y)
G=x

Minimization

What

Why

Simplify a logic function, without changing its outputs


Lower cost implementation
Possibly faster

How

Weve seen how to do this with Boolean theorems


Now we will use more procedural methods:

Karnaugh map (can do by hand, for up to 4 or 5 variables)


Programmed methods such as Quine-McCluskey algorithm (we wont cover
these in this course)

Result

Will give us lowest cost AND-OR or OR-AND circuit


Cost = #gates + #inputs to all gates

Karnaugh Map Minimization

Karnaugh Map (or K-map) minimization is a visual


minimization technique

Is an application of adjacency
Procedure guarantees a minimal expression
Easy to use; fast
Problems include:

Applicable to limited number of variables (4 ~ 8)


Errors in translation from TT to K-map
Not grouping cells correctly
Errors in reading final expression

K-map Minimization (cont.)

Basic K-map is a 2-D rectangular array of cells

Each K-map represents one bit column of output


Each cell contains one bit of output function

Arrangement of cells in array facilitates recognition of


adjacent terms

Adjacent terms differ in one variable value; equivalent to


difference of one bit of input row values

e.g. m6 (110) and m7 (111)

Truth Table Rows and Adjacency


Standard TT ordering
doesnt show adjacency
A B
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1

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

D
0
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1

minterm
0
1
0
1
0
1
0
1
0
1
0
1
0
1
0
1

m0
m1
m2
m3
m4
m5
m6
m7
m8
m9
m10
m11
m12
m13
m14
m15

Key is to use gray


code for row order
A B
0
0
0
0
0
0
0
0
1
1
1
1
1
1
1
1

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

D
0
0
1
1
1
1
0
0
0
0
1
1
1
1
0
0

minterm
0
1
1
0
0
1
1
0
0
1
1
0
0
1
1
0

m0
m1
m3
m2
m6
m7
m5
m4
m12
m13
m15
m14
m10
m11
m9
m8

This helps but its still hard to see all possible adjacencies.

Folding of Gray Code Truth Table into K-map


ABCD

0000
0001
0011
0010
0110
0111
0101
0100
1100
1101
1111
1110
1010
1011
1001
1000

AB
CD

00
01
11
10

00 01 11 10

m0

m4

m12

m1

m5

m13

m7

m15

m6

m6

m7
m5

m3
m2

m4

m12
m13
m15
m14

m10
m11
m9
m8

m0

m4

m12

m8

m1

m5

m13

m9

m14

m3

m7

m15 m11

m2

m10

m2

m6

m14 m10

m3

m11

m1

m9

m0

m8

Karnaugh Map

Graphical representation of truth table

K-map with 2 Variables


F =f(x,y)

LSB
x y

m0

m0

m1

m1

m2

m3

m2

m3

MSB

Karnaugh Map

K-map with 2 Variables Example


F =f(x,y) = xy
LSB
x y

MSB

Karnaugh Map

K-map with 3 Variables


F =f(x,y,z)
x

m0

m1

m2

m3

m4

m5

m6

m7

MSB

LSB
yz 00
x

01

11

10

m0

m1

m3

m2

m4

m5

m7

m6

Karnaugh Map

K-map with 3 Variables Example


F =f(x,y,z) = m(2,3,4,5)
x

LSB
MSB x yz 00
0
0
1

01

11

10

Karnaugh Map

K-map with 4 Variables


F =f(w,x,y,z)
LSB
yz
00
MSB wx

01

11

10

00

m0

m1

m3

m2

01

m4

m5

m7

m6

11

m12

m13

m15

m14

10

m8

m9

m11

m10

Karnaugh Map

K-map with 4 Variables Example


F =f(w,x,y,z)= m(3,4,5,7,9,13,14,15)
LSB
yz
00
MSB wx

01

11

10

00

01

11

10

K-map Minimization

For any cell in 2-D array, there are four direct neighbors
(top, bottom, left, right)
2-D array can therefore show adjacencies of up to four
variables

MSB

LSB
yz 00
x

LSB
yz
00
MSB wx

01

11

10

01

11

10

00

m0

m1

m3

m2

01

m4

m5

m7

m6

11

m12

m13

m15

m14

10

m8

m9

m11

m10

m0

m1

m3

m2

m4

m5

m7

m6

Grouping - Applying Adjacency

If two cells have the same


value and are next to each
other, the terms are
MSB
adjacent.
This adjacency is shown by
enclosing them.
Groups can have common
cells.
Group size is a power of 2
and groups are
rectangular.
You can group 0s or 1s.

LSB
yz
00
wx

01

11

10

00

01

11

10

wxyz
wxyz
wyz

Reading the Groups


yz

00

01

11

10

00

01

11

10

wx

wyz

If 1s grouped, the expression


is a product term, 0s - sum
term.
Within group, note when
variable values change as
you go cell to cell. This
determines how the term
expression is formed by the
following table

Grouping 1s

Grouping 0s

Variable changes

Exclude

Exclude

Variable Constant 0

Incl. Complement

Incl. true

Variable Constant 1

Incl. true

Incl. Complement

K-maps

Circles can cross left/right sides

3/5/7 doesnt correspond to


algebraic transformations that
combine terms to eliminate a
variable

Circling all the cells is OK

Minterms differ in one variable only

Circles must have 1, 2, 4, or 8


cells 3, 5, or 7 not allowed

Function just equals 1

xyz

yz

Remember, edges are adjacent

00

01

11

10

00

01

11

10

00

01

11

10

xz

yz

yz

K-maps for Four Variables


F

Four-variable K-map follows


same principle

Adjacent cells differ in one


variable
Left/right adjacent
Top/bottom also adjacent

11

10

00

01

11

10

F=wxy+yz

yz

wx

But hard to use


F z
But not very useful easy
to 0do
y
algebraically by hand
0

01

Two-variable maps exist

00

yz

5 and 6 variable maps exist

wx

wxy

yz

00

01

11

10

00

01

11

10

G=z

Implicants and Prime Implicants


yz

00

01

11

10

00

01

11

10

wx

Prime
implicant

implicant

Single cells or groups that


could be part of a larger
group are know as
implicants
A group that is as large as
possible is a prime
implicant
Single cells can be prime
implicants if they cannot
be grouped with any other
cell

Implicants and Minimal Expressions

Any set of implicants that encloses (covers) all values is


sufficient; i.e. the associated logical expression
represents the desired function.

All minterms or maxterms are sufficient.

The smallest set of prime implicants that covers all values


forms a minimal expression for the desired function.

There may be more than one minimal set.

Essential and Secondary Prime Implicants

If a prime implicant has any cell that is not covered by any


other prime implicant, it is an essential prime implicant
If a prime implicant is not essential is is a secondary
prime implicant
A minimal set includes ALL essential prime implicants and
the minimum number of secondary PIs as needed to
cover all values

K-map Minimization Method

Technique is valid for either 1s or 0s

Find all prime implicants (largest groups of 1s or 0s in order of


largest to smallest)
Identify minimal set of PIs

Find all essential PIs


Find smallest set of secondary PIs

The resulting expression is minimal.

K-map Minimization Example (SOP)

We want a sum of products expression so we circle 1s


ab

cd 00

01

11

10

00

01

11

bcd

10

acd

acd

PIs are essential; no implicants remain ( no secondary


PIs).
The minimal expression is:

acd + bcd + acd

K-map Minimization Example (SOP)

We want a sum of products expression so we circle 1s


ab

cd 00

01

11

10

00

01

11

10

ac

bcd
abd
abc

PIs are essential


Secondary PIs : bcd, abd
The minimal expression is:

ac + abc + bcd
ac + abc + abd

K-map Minimization Example (POS)

We want a product of sums expression so we circle 0s


ab

cd 00

01

11

10

00

01

11

10

PIs are essential


Secondary PIs : b+c (redundant)
The minimal expression is:

(a+c)(a+c+d)(a+b)

a+c
a+c+d
a+b
b+c

Two-Level Size Minimization Using K-maps


Four Variable Example

Minimize:

abcd

H = ab(cd + cd) + abcd + abcd +


abd + abcd

1. Convert to sum-of-products:

H = abcd + abcd + abcd + abcd


+ abd + abcd

2. Place 1s in K-map cells


3. Cover 1s
4. OR resulting terms

abcd
abcd abd
abcd

abcd

cd

ab

00

01

11

10

00

01

abc

11

abd

10

H = bd + abc + abd

bd

Funny-looking circle, but


remember that left/right
adjacent, and top/bottom
adjacent

Exercise

F=f(x,y,z) = m(0,2,3,4,5,7)
K=f(w,x,y,z) = m(0,1,4,5,9,11,13,15)
L=f(a,b,c,d) = m(0,2,5,7,8,10,13,15)
J=f(x,y,z) = M(0,3,4,7)
T=f(w,x,y,z) = M(1,3,8,10,12,13,14,15)

Five variable K-map


de 00
abc

01

11

10

000

001

011

12

13

15

14

010

11

10

00

01

11

10

100

16

17

19

18

101

20

21

23

22

111

28

29

31

30

110

24

25

27

26

Uses two 4 variable maps sideby-side


groups spanning both maps
occupy the same place in both
maps
Can be viewed as stacked on
top of each other
0
16

Five variable K-map


de
abc

00

01

11

10

000

001

011

010

00

01

11

10

100

101

111

110

(a,b,c,d,e) =
m(3,4,7,10,11,14,15,16,17,20
,26,27,30 31)

Five variable K-map


de 00
abc

01

11

10

000

001

011

010

(a,b,c,d,e) =
m(3,4,7,10,11,14,15,16,17,20
,26,27,30 31)
Implicants

00

01

11

10

100

101

111

110

bd
ade
abcd
bcde

f(a,b,c,d,e) = bd + ade + abcd


+ bcde

Exercise

f(A,B,C,D,E) = m(0,2,4,7,10,12,13,18,23,26,28,29)
f(A,B,C,D,E) = M(0,2,4,11,14,15,16,20,24,30,31)

Exercise

f(A,B,C,D,E) = m(0,2,4,7,10,12,13,18,23,26,28,29)
DE 00
ABC

01

11

10

000

001

011

010

00

01

11

10

100

101

111

110

PI: ABDE, BCD, CDE, BCDE, ACDE


EPI: ABDE, BCD, CDE, BCDE

f ABDE BCD CDE BCDE

Exercise

f(A,B,C,D,E) = M(0,2,4,11,14,15,16,20,24,30,31)
DE 00
ABC

01

11

10

000

001

011

010

00

01

11

10

100

101

111

110

PI: (B+D+E), (B+C+D), (A+B+D+E)


(A+B+C+E), (A+C+D+E)
EPI: All

f (B D E )(B C D)(A B D E )
(A B C E )(A C D E )

Other Exercise

Plot Kmap and minimize

f = BCD + ABC + ABD


f = (A+B)(A+B)(B+C)

Find the minimum (SOP or POS) number of transistors for


the function: f(A,B,C,D) = M(0,2,3,9,11,12,13,15)

Dont Cares (Incompletely Specified Functions)

For expression minimization, dont care values (- or x or d)


can be assigned either 0 or 1

Hard to use in algebraic simplification; must evaluate all


possible combinations
K-map minimization easily handles dont cares

Basic dont care rule for K-maps is include the dc (- or x or


d) in group if it helps to form a larger group; else leave it
out

Example of Dont care minimization

f(a,b,c,d) = m(5,6,7,8,9) + d(10,11,12,13,14,15)


We want a sum of products expression so we circle 1s and
xs (dont cares)
cd

00

01

11

10

00

01

11

10

ab

f(a,b,c,d) = a + bc + bd
bd
bc
a

Without dont care


f(a,b,c,d) = abc + abc + abd

Exercise

F(a,b,c,d)= m(1,3,4,7,11) + d(5,12,13,14,15)


F(a,b,c,d)= M(0,2,6,8,9,10) D(5,12,13,14,15)

Minimization with Dont Cares Example:


Sliding Switch

Switch with 5 positions

3-bit value gives position in


binary

Want circuit that

Outputs 1 when switch is in


position 2, 3, or 4
Outputs 0 when switch is in
position 1 or 5
Note that the 3-bit input can
never output binary 0, 6, or 7

Treat as dont care input


combinations

2,3,4,
detector

yz

Withou
x
t dont
cares:
0
F = xy
1
+ xyz
G

00

01

11

10

xy
a

xyz
1

yz

y
00

01

11

10

With dont
cares:
z F = y + z

You might also like