0% found this document useful (0 votes)
24 views56 pages

逻辑代数基础 Chapter 1

The document provides a comprehensive overview of Boolean algebra and Karnaugh maps, covering basic logic gates, Boolean expressions, and minimization techniques. It explains key concepts such as sum of products (SOP), product of sums (POS), minterms, maxterms, and canonical forms. Additionally, it includes truth tables and examples to illustrate the application of these concepts in logic circuit design.

Uploaded by

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

逻辑代数基础 Chapter 1

The document provides a comprehensive overview of Boolean algebra and Karnaugh maps, covering basic logic gates, Boolean expressions, and minimization techniques. It explains key concepts such as sum of products (SOP), product of sums (POS), minterms, maxterms, and canonical forms. Additionally, it includes truth tables and examples to illustrate the application of these concepts in logic circuit design.

Uploaded by

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

Revision on Boolean Algebra & K-map

•1.1 Basic logic gates


• 1.2 Boolean algebra
• 1.3 Logic Circuit and Boolean Expression
•1.4 Logic function – SOP, POS, minterm,
maxterm, canonical form
• 1.5 Minimization using Boolean algebra
• 1.6 Karnaugh map
• 1.7 Minimization using Karnaugh map
• 1.8 Logic functions with don’t care conditions
1
1.1 Basic Logic Gates
OR gate AND gate NOT gate
Binary/Unary Binary Binary Unary
operator?

Symbols 1: + 1: · 1: ’

3: -
2: 2: ^ 2: ~
3: absence of an operator

Examples 1: a + b 1: a · b 1: a’
2: a b 2: a ^ b 2: ~a
3: ab 3:
Logic Gate
Symbol

Truth table of OR Truth table of AND Truth table of NOT


a b a +b a b ab a
0 0 0 0 0 0 0 1
0 1 1 0 1 0 1 0
1 0 1 1 0 0
1 1 1 1 1 1 2
Negated Gates

NAND
“ b
Operation NOR XOR XNOR
a b (ab)’ (a + b)’ a b
0 0 1 1 0 1
0 1 1 0 1 0
1 0 1 0 1 0
1 1 0 0 0 1
Logic Gate
Symbol

3
1.2 Boolean Algebra

• A set of element S with at


least two
different elements (x , y) satisfying
binary operations (+) and (.) .

• ForBoolean algebra in which S= {0,1}, the


formulation is referred as switching
function.

4
Basic Postulates

If x,y S,
x +y =y +x
x. y = y. x commutative

If x,y,z S,
x + (y + z) = (x + y) + z
x . (y . z) = (x . y) . z
associative

If x,y,z S,
x . (y+ z) = (x . y) + (x . z)
x + (y . z) = (x + y) . (x + z)
distributive 5
Distributive Law
• Proof
x + y.z = (x + y) . (x + z)

x y z y.z x + y.z x+y x+z (x + y) . (x + z)


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

6
Duality

• If an expression is valid in Boolean algebra, the dual


of the expression is also valid.

• Principle of duality:
0. x= 1 +x = 1
0
0 +x =
1. x=
xx +x =
xx . x
x x + x’ =
=xx.
1
x’ = 0
The expressions are interchangeable by replacing “0” by “1” and “+”
by “ . ” .
7
Theore
m
Idempotent
x+x=x x. x=
Involution x
(x’ )’= x
Absorption
x + xy = x x (x+ y) =
x
Logical adjacency
xy + xy’ = x

DeMorgan (x + y) = x y xy = x
+ y
• The complement of sum is equal to the product of the
complement
• The complement of product is equal to the sum of the 8
complement
DeMorg
an X Y X + X Y
0 0 Y 1 1
0 1 0 0
1 0 0 0
1 1 0 0

X Y - -
X Y X Y+

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

Note X+ Y X+ Y and X Y X , a very common


that Y 9
mistake
1.3 Logic Circuit and Boolean
Expression

Boolean expression from a logic circuit

• Write down the output expression from all


logic operators
• The Boolean function of this circuit is A (B
+ CD)
• Construct a truth table for above logic 1
circuit 0
Truth table for a logic circuit
Completed solution
for a logic circuit
design
must include:

Examples of numbering systems Inputs Output 1. Boolean Algebra


Decimal Hexadecimal A B C D A(B+CD) 2. Circuit
0 0 0 0 0 0 0 schematic 3.
1 1 0 0 0 1 0 Truth table
2 2 0 0 1 0 0
3 3 0 0 1 1 0
For the truth table,
4 4 0 1 0 0 0
find the output as
5 5 0 1 0 1 0
6 6 0 1 1 0 0
a following:
7 7 0 1 1 1 0 1. Write down all
8 8 1 0 0 0 0 possible input
9 9 1 0 0 1 0
10 A 1 0 1 0 0 combinations
11 B 1 0 1 1 1
2 . Write down the
12 C 1 1 0 0 1
final stage
13 D 1 1 0 1 1
output (i.e. A( B
14 E 1 1 1 0 1
+ CD))
15 F 1 1 1 1 1
Boolean function Truth Table
Example: f(x,y,z)=xy’+x’z’

Input(s) Output
x y z xy’ x’z’ xy’ + x’z’
0 0 0 0 1 1
0 0 1 0 0 0
0 1 0 0 1 1
0 1 1 0 0 0
1 0 0 1 0 1
1 0 1 1 0 1
1 1 0 0 0 0
1 1 1 0 0 0
1
2
Truth Table  Boolean function

Inputs Output
a b c f
0 0 0 0 f is 1 if {(a = 0) AND (b = 0) AND (c = 1)}
OR
0 0 1 1
{(a = 1) AND (b = 0) AND (c = 0)} OR
0 1 0 0
0 1 1 0 {(a = 1) AND (b = 0) AND (c = 1)}

1 0 0 1
1 0 1 1 f(a,b,c) = a’b’c + ab’c’ + ab’c
1 1 0 0
Is it the simplest form?
1 1 1 0

1
3
1.4 Logic Function - SOP and POS

Logic functions are generally expressed with


least number of literals (variables).

• Sum of products (SOP)


f(a,b,c,d) = ab’c + b’d’ + a’cd

• Product of sums (POS)


f(a,b,c,d) = (a’ + b + c)(b’ + c + d’)(a +
c’)

1
4
1.4.1 Minterm and Maxterm
Minterm :- For a function of n variables, if a product term contains
all n
variables exactly one time in its complemented or
uncomplemented form, the product term is called minterm.
Complement = 0 and
Uncomplement =1.
Function Minterm Not Not
minterm minterm
f( A, B, C) A’ B’ C (A B)’ C A’B’ or AABC

Maxterm :- If a sum term of a function of n variables contains all n


variables exactly one time in its complemented or
uncomplemented form, the sum term is called a maxterm.
Complement = 1 and Uncomplement =0.
Function Maxterm Not Not maxterm
maxterm
f( A, B, C) A’+ B’+ C (A + B)’ C A’+ B’ or
Noted that the minterm and maxterm cannotA’+B+B+C
be simplified.
15
Minterms and maxterms for 3
variables logic
function
Minterms Maxterms
x y z Term designatio term designatio
n n
0 0 0 x’y’z’ m0 x +y +z M0
0 0 1 x’y’z m1 x + y + z’ M1
0 1 0 x’yz’ m2 x + y’ + z M2
0 1 1 x’yz m3 x + y’ + z’ M3
1 0 0 xy’z’ m4 x’ + y + z M4
1 0 1 xy’z m5 x’ + y + z’ M5
1 1 0 xyz’ m6 x’ + y’ + z M6
1 1 1 xyz m7 x’ + y’ + z’ M7

The number of minterms and maxterm of a logic function of n


variables equals to 2n, e.g. f(a,b,c,d)  16 minterms (maxterms);
f(a,b,c,d,e)  32 minterms (maxterms). 1
6
1.4.2 Canonical form
The canonical form of a logic function is a
presentation in either minterms of
maxterms.
In minterm form (with logic output “1”):
f (A, B, C) = ABC + ABC + ABC + ABC
Minterm Code Number
A’BC’ 010 m2
ABC’ 110 m6
A’BC 011 m3
ABC 111 m7

f (A, B, C) = m2 + m3 + m6 + m7

Canonical form f (A, B, C) = Σ m(2,3,6,7)


1
Noted for minterm: Complement = 0 and Uncomplement 7
The canonical form of a logic function is a
presentation in either minterms of
maxterms.
In maxterm form (with logic output “0”):
f (A, B, C) = (A + B + C)(A + B + C)(A + B + C)(A + B +
Maxterm Code Number C)
A +B + C 000
M0
A + B + C’ 001
M1
A’ + B + C 100
M4
A’ + B + C’ 101
M5
f (A, B, C) =
M0M1M4M5
Canonical form f (A, B, C) = Ⅱ M (0, 1, 4, 5)
1
Noted for maxterm: Complement = 1 and 8
Canonical SOP representation:

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

= ab(c + c) + ab(c + c) + bc(a +


a)

= abc + abc + abc + abc + abc + abc


= m1 + m4 + m5 + m6 + m7

f (a, b, c) = Σ m(1,4,5,6,7)

1
9
Canonical POS representation:

f (x, y, z) = xy + xz
= (xy + x)(xy + z) = (x + x)(y + x)(x + z)(y + z)

= (x + y)(x + z)(y + z) = (x + y + zz)(x + z + yy)(y + z + xx)


= (x + y + z)(x + y + z)(x + z + y)(x + y + z)(x + y + z)(x + y + z)
= (x + y + z)(x + y + z)(x + y + z)(x + y + z)

f (x,y,z) = M 0 M 2 M 4 M 5 = ⅡM(0,2,4,5)

2
0
Conversion between canonical
forms

Relationship

maxtermi = mintermi (i.e. Mi = mi)

mintermi = maxtermi (i.e. mi = Mi)

e.g. M3’ = (a + b’ + c’)


= a’bc (De Morgan’s Theorem)
= m3
2
1
Canonical form conversion: SOP 
POS
For minterm representation (choose all the terms x y z f
with output 1): 0
0 0 0

f (x , y , z) = xyz + xyz + xyz + xyz 0 0 1 1


0 1 0 0
f (x, y,z) = m1 + m4 + m5 + m7 = Σm(1,4,5,7) 0 1 1 0
1 0 0 1
For maxterm representation (choose all the terms
with output 0): 1 0 1 1
1 1 0 0
f (x, y, z) = xyz + xyz + xyz + xyz
1 1 1 1
f (x, y, z) = f (x, y, z) = xyz + xyz + xyz +
xyz
= (x + y + z)(x + y + z)(x + y + z)(x + y + z)
f (x, y, z) = M 0 M 2 M 3 M 6 = ⅡM (0,2,3,6)

Noted that for maxterm the uncomplemented variable = 0,


complemented variable = 1
22
1.5 Minimization using Boolean Algebra

• Obtain a simple (or simplest) logic circuit


• Reduce the cost of production
>Less logic gate ICs required
>PCB (Printed Circuit Board)
 size reduced
• Reduce the power consumption
 longer battery usage time
Example:
Given 4 equivalent Boolean functions f1 to f4 expressed in
SOP form already (to be proved in later session).

f1(a,b,c) = a’bc’ + a’bc + ab’c’ + ab’c + abc (5


product terms, 15 literals)

f2(a,b,c) = a’b + ab’ +abc (3 product terms, 7 literals)


f3(a,b,c) = a’b + ab’ +ac (3 product terms, 6 literals)
f4(a,b,c) = a’b + ab’ +bc (3 product terms, 6 literals)
Both f3 & f4 are the minima
How can you simplify f1 to f3?
24
Simplification

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


= (a’bc’+ a’bc) + (ab’c’ + ab’c) + abc
= a’b + ab’ + abc = f2
= a’b + a(b’ + bc)
= a’b + a(b’ + c)
= a’b + ab’ + ac
= f3

How to obtain f4 ?
f4(a,b,c) = a’b + ab’ +bc 25
Example:

f(A,B,C,D) = AB + AC + ABC
DeMorgan
= (AB) (AC ) + ABC

= (A + B) (A + C)+ ABC
= A A + AC + AB + B C +
ABC
= A + AC + AB +
BC
= A + AB +
BC
= A+ B
C 26
Example:
f (A, B, C, D) = AB + BC + CD +BD
= AB + CD + B(C +D)
= AB + CD + BCD

= AB + (CD + B)(CD + CD)


= AB + CD + B
= B(A +1) + CD
= B + CD
27
A very useful rule for simplifying
Boolean function

Basic: a + ab = (a + a)(a + b) = a +
b
We can have the following general form:

a + a[…] = a + [ …]

Examples: x + x(w + yz) = x + (w + yz)


a + a(bd + bcd + cd ) = a + bd +
bcd + cd
28
1.6 Karnaugh Map

• In
1953, Maurice Karnaugh introduced a map
method known as Karnaugh map (K-map)
> A straightforward procedure for minimizing Boolean
functions in a table form
> Graphical representation of a truth table
>Minterm is used in the cell of the K-map
> It isn-variable function (defined by 2 n ):
>Two-variable K-map has 4 cells
> Three-variable K-map has 8 cells
>Four-variable K-map has 16 cells

29
Two-variable K-map

Variables are This column


labeled on the represents a = 1
upper left corner
of the map
This cell means
(a = 1) AND (b =
0)
This row This cell means
represents b = 1 (a = 1) AND (b = 1)

a 0 1 a 0 1
b b
0 a'b ’ ab’ 0 m0 m2
1 a'b ab 1 m1 m3

Minterm representations 30
Plotting functions in K-map

f(a,b) = Σm(0,3) Canonical form (contain Minterm)

a 0 1 a 0 1 Put a 0 or leave blank for


b b those minterms not included
0 0 1 in the function
or
1 1 1
Put a 1 in the corresponding
cells

f(a,b) = a’b + ab’ Function must be formed by


Minterm
a 0 1 a 0 1 Functions represented
b b
0 1 1 1 1 graphically with corresponding
or 0
minterm cells labeled to value 1
1 0 0 1
31
Three-variable K-map

Note: the columns are not in


numerical order, but Gray code
order (why)?

This cell means:


(a = 0) AND (b = 1) AND (c =
0)

32
Minterm representations

33
Simplification of Production Terms
Example: Simplify f(a,b,c) =Σm(6,7) Only one-
variable
difference

Using Boolean Algebra:

f(a,b,c) = abc’ + abc


= ab (adjacency)

This group contains both 0 and 1


for c (i.e. no longer depends on
c, depends on a and b only

Rule: whenever we group two adjacent cells, they


can form a product term with one variable less
34
Wrap-around Adjacency

Adjacent cells (1-


bit change only)

Form a cylinder!
35
More examples

f(a,b,c) = abc’ + ab’c’


= ac’ (adjacency)

We can even group adjacent 1’s


across the edges:
Also one-variable difference!

f(a,b,c) = a’b’c’ + ab’c’


= b’c’ (adjacency)

36
Format of three-variable

Label rows with first variable, Vertical orientation of


Columns with the others three-variable K-map

Although there are different ways


drawing the K-map, we use the same
method to group the adjacent 1’s!

37
Four-variable K-map

Not: Only 1 bit difference between adjacent cells


38
Wrap-around Adjaceny for 4 Variables

39
Image the map as 1-bit change only for
every adjacent cells!
….

1-bit change only for


every adjacent cells!

40
Examples of 4-variable K-map

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

f(a,b,c,d) = a’cd + acd = f(a,b,c,d) =


cd cd 41
Examples of 4-variable K-map

f(a,b,c,d) = a’b’ + ad f(a,b,c,d) =

Across 4 Group of
corners: 8 cells:

f(a,b,c,d) = f(a,b,c,d) = 42
Are They Adjacent Cells?

Diagonal X Magic square


X
43
Summary for K-map method

Group size is power of 2 (e.g. 2, 4, 8) Other group size is illegal!


Limitations
. The Boolean functions minimized by K-map are always in SOP or
POS form
. Can handle minimization for two-level circuits, but not three or
more levels
44
1.7 Minimization using Karnaugh map

• Group the adjacent cells (the number of cells


must be a power of 2)
• Rules
>(1) To find the fewest group that covers all cells with
marked of 1s
>(2) The groups should be as large as possible

• Goal
>Reduce the number of products (terms) to minimum
>Save the cost
45
Example: Two-variable K-map

Simplify f(a,b) =Σm(0,1,3)


Many ways to group them. Which is best solution?

(i) (ii)
3 groups 2 groups
f = a’b’ + a’b + ab f = a’b’ +
b

(iii) (iv) 2 groups (the groups


2 groups
can be overlapped)
f = a’ +
f = a’ + b
ab
46
Example: Three-variable K-map
Simplify f(a,b,c) =Σm(0,1,2,3,4,5)
Which solution is better?

(i) 2 groups
f(a,b,c) = a’ + ab’

(ii) 2 groups
f(a,b,c) = a’ + b’

47
Example: Four-variable K-map

Select the least number of groups to cover all minterms:

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

48
Two Solutions

f (a,b,c,d) = a’b’c’d’ + abc’ + or f (a,b,c,d) = a’b’c’d’ + abc’ +


ab’c + bc’d + ab’c + bc’d +
abd acd

49
Logic function in POS with K-map

• Previous examples only show the simplified


Boolean functions in SOP form
• How to obtain functions in POS form
>Step 1:- Group the 0s to obtain f’ in SOP form
>Step2:- Apply DeMorgan’s Theorem to find f
in POS form
or
>Group the 0s and express them directly in POS with
Maxterms (require to complement the variables with +)

50
Example: Find POS
Simplify f(a,b,c,d) =Σm(0,1,2,5,8,9,10) in
POS form

Group the 0s using the same


Fill the 1s and 0s into the procedure as grouping the 1s
map
f’(a,b,c,d) = ab + cd + bd ’
f(a,b,c,d) = (a’+b’)(c’+d’)
(b’+d) 51
1.8 Logic functions with Don’t’-care conditions

The output of Boolean functions are incompletely


specified functions,

• For some input conditions, the outputs are


unspecified
• Input condition has no effects to the function
i.e., the output for those input are of no concern
• Output values are defined as don’t-care
• Don’t-care term can be minterm / maxterms
• Don’t-care term indicates by an 根 , d, φ or Q

52
Truth Table with Don’t Care

a b f What the table says is:

0 0 0 f is 0 if (a = 0 AND b = 0)
f is 1 if (a = 0 AND b = 1), or
0 1 1 (a = 1 AND b = 0)
1 0 1
fcan be 0 or 1 if (a = 1 AND b = 1)
1 1 X

a b f1 f2 f(a, b) = Σm(1,2) + Σd(3)


0 0 0 0
0 1 1 1 Both f1 or f2 of the table on
the left are acceptable
1 0 1 1
1 1 0 1
53
K-map with Don’t-care

Which solution is better?

f 1 implementation
2 groups
f = a’b + ab’

f 2 implementation
2 groups
f=a +b
54
Procedure for K-map in don’t-care cases

Simplify f(a,b,c,d) =Σm(1,3,7,11,15) + Σd(0,2,5)

f(a,b,c,d) = a’b’d +
cd
Is it a good solution? 55
Other solutions

f(a,b,c,d) = a’b’ + f(a,b,c,d) = a’d +


cd cd

Choose to include those Xs that eliminates more literals

56

You might also like