You are on page 1of 29

Lecture 4: Simplification using Boolean

Algebra,
K Maps
CSE 140: Components and Design Techniques for
Digital Systems
Diba Mirza
Dept. of Computer Science and Engineering
University of California, San Diego
1

Announcements
HW 1 posted on TED and on the website,
due Wed (Jan 21 at 5pm)
Paperless quiz on Friday (multiple choice
based on lecture material)
Dont forget to bring your clickers, answers on
paper will not be accepted.

What you should know at the end of this


lecture.
1. How to simplify combinational circuits using Boolean
Algebra axioms and theorems
2. How to simplify combinational circuits using Karnaugh
maps
3. Why Karnaugh maps are preferred in simplifying circuits

Shannons Expansion
Shannons expansion assumes a switching algebra
system
Divide a switching function into smaller functions
Pick a variable x, partition the switching function
into two cases: x=1 and x=0
f(x,y,z,)= xf(x=1,y,z,) + xf(x=0,y,z,)

<4>

Shannons expansion
Two flavors of the expansion
f(x)=xf(1)+xf(0)
f(x)= (x+f(0)). (x+f(1))
f(x,y)=xf(1,y)+xf(0,y)
f(x,y)=(x+f(0,y)).(x+f(1,y))
f(x,y,z,)=xf(1,y,z,)+xf(0,y,z,)
f(x,y,z,)=(x+f(0,y,z,)).(x+f(1,y,z,))

<5>

Proof of Shannons Expansion


f(x,y)=(x+f(0,y))(x+f(1,y)) {Enumerative induction}

<6>

Shannons Expansion: Example


f(x,y,z)=xf(0,y,z) + xf(1,y,z)
Is the above equation correct?
A. Yes
B. No

<7>

Shannons Expansion
Decompose the switching function into min terms
f(x,y)=xf(1,y)+xf(0,y)

<8>

Shannons Expansion
Decompose the switching function into max terms
f(x,y)=(x+f(0,y)). (x+ f(1,y))

<9>

Reduction of Boolean Expression


AB+AC+BC
=AB+BC

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

Prove the reduction using


(1) Boolean algebra,
(2) Logic simulation and
(3) Shannons expansion (exercise)
1-<10>

We are in a position to build a circuit to do


n-bit Binary Addition
5
+ 7
12
Carry
Sum

1
+
1

1 1
1 0 1
1 1 1
1

Carryout

0 0

Carry bits
5
7
12

Sums
11

Binary Addition: Hardware


Half Adder: Two inputs (a,b) and two
outputs (carry, sum).

Full Adder: Three inputs (a,b,c) and two


outputs (carry, sum).

12

Full Adder
Truth Table
Cin

a
Sum
b
Carry

Id

a b cin

0
1
2
3
4
5
6
7

0
0
0
0
1
1
1
1

0
0
1
1
0
0
1
1

0
1
0
1
0
1
0
1

carry

sum

0
0
0
1
0
1
1
1

0
1
1
0
1
0
0
1

13

Minterm and Maxterm


Id

a b cin

0
1
2
3
4
5
6
7

0
0
0
0
1
1
1
1

0
0
1
1
0
0
1
1

0
1
0
1
0
1
0
1

carryout
0
0
0
1
0
1
1
1

a+b+c
a+b+c
a+b+c
a b c
a+b+c
a bc
a b c
abc

maxterm

minterm

14

Minterm and Maxterm


Id

a b cin

0
1
2
3
4
5
6
7

0
0
0
0
1
1
1
1

0
0
1
1
0
0
1
1

0
1
0
1
0
1
0
1

carryout
0
0
0
1
0
1
1
1

a+b+c
a+b+c
a+b+c
a b c
a+b+c
a bc
a b c
abc

f1(a,b,c) = abc + abc + abc + abc


f1(a, b, c) = m3 + m5 + m6 + m7 = Sm(3,5,6,7)
f2(a,b,c) = (a+b+c)(a+b+c)(a+b+c)(a+b+c)
f2(a, b, c) = M0M1M2M4 = PM(0, 1, 2, 4)

PI Q: Is f1 = f2?
A.Yes
B.No

15

PIQ: Reduce using Boolean algebra theorems


Carry(A,B,C)=ABC+ABC+ABC+ABC
A. ABC+ABC+AB
B. ABC+AC+AB
C. AB+AC+BC
D. ABC
E. Cannot be reduced further

16

ABC+ABC+ABC+ABC

17

Circuit for Full Adder Carry out


f1(a,b,c) = abc + abc + abc + abc
= ab +c(b +a)

18

Building the simplest possible circuit


We can get the simplest circuit in two ways:
1.Truth table > Canonical POS/SOP > Most simplified
switching function -> Simplest Circuit
This can get difficult when we have many inputs variables

2.Truth table or Canonical POS/SOP ->Karnaugh map->


Simplest Circuit

1-<19>

Implementation: Specification => Logic Diagram

Karnaugh Map: A 2-dimensional truth table


Flow 1:
1. Specification
2. Truth Table
3. Sum of Products or Product of Sums
canonical form
4. Reduced expression using Boolean
Algebra
5. Schematic Diagram of Two Level Logic

Flow 2:
1.Specification
2.Truth Table or Boolean function
3.Karnaugh Map (truth table in two
dimensional space)
4.Reduce using KMaps
5.Reduced expression (SOP or POS)
6.Schematic Diagram of Two Level Logic

20

Truth Table vs. Karnaugh Map


2-variable function, f(A,B)
ID A B f(A,B)
0

0 f(0,0)

1 f(0,1)

0 f(1,0)

1 f(1,1)

A=0

A=1

B=0

f(0,0)

f(1,0)

B=1

f(0,1)

f(1,1)

21

Truth Table vs. Karnaugh Map


2-variable function, f(A,B)
ID A B f(A,B)
0

0 0

1 1

0 1

1 1

A=0

A=1

B=0

B=1

Boolean expr:
22

Function can be represented by sum of minterms:


f(A,B) = AB+AB+AB
This is not optimal however!
We want to minimize the number of literals and terms.
Try minimizing using Boolean algebra

23

To minimize the number of literals and terms.


We factor out common terms
AB+AB+AB= AB+AB+AB+AB
=(A+A)B+A(B+B)=B+A
Hence, we have
f(A,B) = A+B

24

How can we guarantee the most reduced


expression was reached?
Boolean expressions can be minimized by combining terms
K-maps minimize equations graphically
ID A B f(A,B)
A=0

0 f(0,0)

1 f(0,1)

0 f(1,0)

1 f(1,1)

A=1

B=0

AB

AB

B=1

AB

AB

25

K-Map: Truth Table in 2 Dimensions

ID A

f(A,B)

A=0
B=0
B=1

0
1

0
1

A=1
2
3

1
1

26

K-Map: Truth Table in 2 Dimensions


ID A

A=0

f(A,B)

Why Karnaugh maps are


preferred in simplifying circuits?

B=0
B=1

0
1

0
1

AB

A=1
2
3

AB

1
1
AB

f(A,B) = A + B
27

Review Some Definitions


Complement: variable with a bar over it
A, B, C
Literal: variable or its complement
A, A, B, B, C, C
Implicant: product of literals
ABC, AC, BC
Implicate: sum of literals
(A+B+C), (A+C), (B+C)
Minterm: product that includes all input variables
ABC, ABC, ABC
Maxterm: sum that includes all input variables
(A+B+C), (A+B+C), (A+B+C)
28

Next Lecture
Quiz (multiple choice based on material
covered so far)
Bring your clickers for the quiz, paper
submissions will not be accepted

29

You might also like