Vous êtes sur la page 1sur 48

Chapter 2: Boolean Algebra and Logic

Functions

CS 2402-- Digital Logic Design

CS 3402:A.Berrached

Chapter 1: Review (Begin class1)


1.

2.

3.

4.

Base 2 system
Be able to convert number from/to base 10 to/from
base 2
2s complete system
Be able to represent positive and negative integers
using the 2s complete system
Be able to convert between decimal and 2s
complement sytem
2s complete arithmetics
Addition
subtraction
Hexadecimal representation
CS 3402:A.Berrached

Boolean Algebra
Algebraic structure consisting of:
a set of elements B
operations {AND, OR}
Notation:
X AND Y X Y XY
X OR Y
X+Y
B contains at least two elements a & b such that a b
Note: switching algebra is a subset of Boolean algebra where
B={0, 1}
Axioms of Boolean Algebra
4. Associative Laws:
1. Closure a,b in B,
(i) a + (b+c) = (a+b)+c = a+b+c
(ii) a. (b.c) = (a.b).c = a.b.c
(i) a + b in B
5. Distributive Laws:
(ii) a b in B
(i) a + (b c) = (a + b) (a + c)
2. Identities: 0, 1 in B
(ii) a (b + c) = (a b) + (a c)
(i) a + 0 = a
6. Existence of the Complement:
(ii) a 1 = a
exists a unique in B
3. Commutative Laws: a,b in B,
(i) a + a = 1
(i) a + b = b + a
(ii) a a = 0
(ii) a b = b a
a is complement of a
CS 3402:A.Berrached

Principle of Duality
Definition of duality:
a dual of a Boolean expression is derived by replacing AND
operations by ORs, OR operations by ANDs, constant 0s by 1s,
and 1s by 0s (everything else is left unchanged).
Principle of duality: if a statement is true for an expression, then it
is also true for the dual of the expression
Example: find the dual of the following equalities
1)
2)

XY+Z = 0
a(b+c) = ab + ac

CS 3402:A.Berrached

Boolean Expression

A Boolean express consists of an algebraic expression formed


with Boolean variables, the constants 0 and 1, the logic
operation symbols, and parenthesis.
Example:
F(X,Y,Z) = X + Y Z
or F = X + Y Z

X, Y and Z are Boolean variables


A literal: The appearance of a variable or its complement in a
Boolean expression
Z = ABC + ABC + A(BC + BC)

A Boolean function can be represented with a truth table

A Boolean function can be represented with a logic circuit


diagram composed of logic gates.

CS 3402:A.Berrached

Exercise

Get the truth table for :


Z = ABC + ABC + A(BC + BC)
A B C

0 0 0

0 0 1

0 1 0

0 1 1

1 0 0

1 0 1

1 1 0

1 1 1

CS 3402:A.Berrached

CS 3402:A.Berrached

F1 = xy + xyz + xyz
Get truth table for F1
Draw logic circuit diagram for F1
X Y Z

F2=xy + xz
Get truth table for F2
Draw logic circuit diagram for F2

F1

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

(End of class?)
CS 3402:A.Berrached

From Boolean Expression to Gates (Begin class2)


More than one way to map an expression to gates
E.g., Z = A' B' (C + D) = (A' (B' (C + D)))

B
T1

C
T

A
B

C
D

For each Boolean function, there is only one unique truth table
representation
=>Truth table is the unique signature of a Boolean function
CS 3402:A.Berrached

Boolean Functions
Possible Boolean Functions of Two variables
X Y
0 0
0 1
1 0
1 1

F0 F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15


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
0 0 1 1 0 0 1 1 0 0
1
1
0
0
1
1
0 1 0 1 0 1 0 1 0 1
0
1
0
1
0
1
0

NAND

NOR

X Y

1
X

X+Y

Description
Z = 1 if X is 0
or Y is 0

Description
Z = 1 if both X
and Y are 0

Gates
X
Y

Truth T able
X Y Z
0 0 1
0 1 1
1 0 1
1 1 0

Gates
X
Y

CS 3402:A.Berrached

Truth T able
Z

X
0
0
1
1

Y
0
1
0
1

Z
1
0
0
0

10

Basic Logic Functions: NAND, NOR

NAND, NOR gates far outnumber AND, OR in typical designs


easier to construct in the underlying transistor technologies
they are functionally complete

Functionally Complete Operation Set:


A set of logic operations from which any Boolean function can be
realized (also called universal operation set)
E.g. {AND, OR, NOT} is functionally complete

The NAND operation is also functionally complete


=> any Boolean function can be realized with one type of gate (the
NAND gate).

The NOR operation is also functionally complete

CS 3402:A.Berrached

11

Basic Logic Functions: XOR, XNOR

XOR: X or Y but not both ("inequality", "difference")

XNOR: X and Y are the same ("equality", "coincidence")


Des cri ption
Z = 1 if X has a different
value than Y

Des cri ption


Z = 1 if X has the s ame
value as Y

Gates

Gates

X
Z

Truth T able
X
0
0
1
1

(a) XOR

Y
Truth T able

Y
0
1
0
1

Z
0
1
1
0

X
0
0
1
1

Y
0
1
0
1

Z
1
0
0
1

(b) XNOR
CS 3402:A.Berrached

12

Logic Functions: Rationale for Simplification

Logic Minimization: reduce complexity of the gate level implementation


reduce number of literals (gate inputs, circuit inputs)
reduce number of gates
reduce number of levels of gates

fewer inputs implies faster gates in some technologies

fan-ins (number of gate inputs) are limited in some technologies

Fewer circuit inputs implies fewer I/O pins

fewer levels of gates implies reduced signal propagation delays

number of gates (or gate packages) influences manufacturing costs

In general, need to make tradeoff between circuit delay and reduced


gate count.

CS 3402:A.Berrached

13

Optimization Criteria
1.

2.
3.

Min. # of circuit levels max. speed


1. Ideally 2 levels
Min. # literals min. amount of wires
Min. # terms min. # gates

CS 3402:A.Berrached

14

Simplification Using Boolean Algebra


Useful Theorems of Boolean Algebra:
1. Idempotency Theorem
a. X + X = X
b. X X = X
2. Null elements for + and operators
a. X + 1 = 1
b. X . 0 = 0
3. Involution Theorem
(X) = X
4. Absorption Theorem
a. X + XY = X
b. X.(X+Y) = X
5. Simplification Theorem
a. XY + XY = X
b. (X+Y).(X+Y) = X
(end of class 3)
6. Another Simplification Theorem (Begin class 4)
a. X + XY = X + Y

b. X.(X + Y) = X.Y

CS 3402:A.Berrached

15

More theorems

(a)

(b)

7. Consensus Theorem
AB + AC + BC = AB +AC
(A+B).(A+C).(B+C) = (A+B).(A+C)

CS 3402:A.Berrached

16

DeMorgan's Law
8. DeMorgans Law
a. (X+Y) = X . Y

b. (X.Y) = X + Y

The complement of the sum is the product of the complements


The complement of the product is the sum of the complements

In general
a. (A+B+.+Z) = A . B . .Z
b. (A.B.C.Z) = A + B + .+Z

CS 3402:A.Berrached

17

DeMorgan's Theorem
(X + Y)' = X' Y'
NOR is equivalent to AND
with inputs complemented

(X Y)' = X' + Y'


NAND is equivalent to OR
with inputs complemented

X
0
0
1
1

Y
0
1
0
1

X
1
1
0
0

Y
1
0
1
0

X
0
0
1
1

Y
0
1
0
1

X
1
1
0
0

Y
1
0
1
0

X +Y
1
0
0
0

XY
1
0
0
0

XY X +Y
1
1
1
1
1
1
0
0

DeMorgans Law can be used to get the complement of an expression


{F(X1,X2,...,Xn,0,1,+,)}' = {F(X1',X2',...,Xn',1,0,,+)}
Example:
F = A B' C' + A' B' C + A B' C + A B C'
F' = (A' + B + C) (A + B + C') (A' + B + C') (A' + B' + C)
CS 3402:A.Berrached

18

De Morgans Law
Find the complement of the following function and put in a
form that only single variables are complemented:
F = x.(yz + yz) + x(yz)

(end of class 7 sp13)

CS 3402:A.Berrached

19

Homework (2/2/2010) (Begin class 8 sp13)


Simplify the following expression
F(A,B,C,D) = B+BCD+BCD+AB+AB+BC

Chapter 2:
2.1a,b,&c
2.2b
2.3 c
2.13a
2.17c

Link to TTL databook:


http://webpages.ull.es/users/marbelo/74XX.pdf
CS 3402:A.Berrached

20

Problems: Simplify the following expressions


a)
b)
c)
d)
e)
f)
g)
h)
i)

(X + YZ).(X+YZ)
(W + X + YZ)(W + X + YZ)
(VW + X)(X + Y + Z + VW)
(V + WX)(V + WX + YZ)
(W + X)YZ + (W +X) YZ
(V+U+W)(WX+Y+UZ)+(WX+UZ+Y)
A + B + CD(A+B)
ABC + CD + BCD+ABD
[(A+D+BC)(B+D+AC)]+BCD+ACD`

CS 3402:A.Berrached

21

Function Representations
Note --- TTL Databook link:
http://webpages.ull.es/users/marbelo/74XX.pdf
CS 3402:A.Berrached

22

Function Representations

Truth Table (Unique representation)


Boolean Expressions
Logic Diagrams
From
Boolean Expression
Logic Diagram
Boolean Expression
Truth Table

==>
==>
==>
==>

CS 3402:A.Berrached

TO
Logic Diagram
Boolean Expression
Truth Table
Boolean Expression

23

Function Representations

F(X,Y,Z) = X + YZ + XYZ + XYZ

CS 3402:A.Berrached

24

Deriving Boolean Expression from Truth


Table

CS 3402:A.Berrached

25

Product and Sum Terms --Definitions


Definitions:
Literal: A boolean variable or its complement
X
X
A
B

Product term: A literal or the logical product (AND) of multiple literals:


X
XY
XYZ
XYZ
ABC

Note:

X(YZ)'

Sum term: A literal or the logical sum (OR) of multiple literals:


X
X+Y
X+Y+Z
X+Y+Z
A+B+C
Note: X+(Y+Z)'

CS 3402:A.Berrached

26

SOP & POS -- Definitions

Sum of products (SOP) expression: The logic sum (OR) of multiple


product terms:
AB + AC + B + ABC
ABC + BD + ACD

Product of sums (POS) expression: The logic product (AND) of multiple


sum terms:
(A+B).( A+C).B.( A+B+C)
(A + B + C).( C + D)

Note:
SOP expressions ==> 2-level AND-OR circuit

POS expressions ==> 2-level OR-AND circuit

CS 3402:A.Berrached

27

Minterms & Maxterms -- Definitions


Definitions
A Minterm: for an n variable function, a minterm is a product term that
contains each of the n variables exactly one time in complemented or
uncomplemented form.
Example: if X, Y and Z are the input variables, the minterms are:

XYZ

XYZ XYZ XYZ XYZ XYZ XYZ XYZ

A Maxterm: for an n variable function, a maxterm is a sum term that


contains each of the n variables exactly one time in complemented or
uncomplemented form
Example: if X, Y and Z are the input variables, the maxterms are:

X+Y+Z

X+Y+Z X+Y+Z X+Y+Z X+Y+Z X+Y+Z X+Y+Z X+Y+Z

CS 3402:A.Berrached

28

Minterms

For functions of three variables: X, Y, and Z


Minterm Designation
XYZ
m0
XYZ
m1
XYZ
m2
XYZ
m3
XYZ
m4
XYZ
m5
XYZ
m6
XYZ
m7

Bit Combination
000
001
010
011
100
101
110
111

The bit combination associated with each minterm is the only bit
combination for which the minterm is equal to1.
Example: X'Y'Z' = 1 iff X=0, Y=0, and Z=0
Each bit represents one of the variables ( order is important) :

Un-complemented variable ==> 1


Complemented variable
CS 3402:A.Berrached

==> 0
29

Maxterms
Maxterm
Bit Combination Designmation
X+Y+Z
000
M0
X + Y + Z
001
M1
X + Y + Z
010
M2
X + Y + Z
011
M3
X + Y + Z
100
M4
X + Y + Z
101
M5
X + Y + Z
110
M6
X + Y + Z
111
M7

The bit combination associated with each


Maxterm is the only bit combination for which the
Maxterm is equal to 0.

Note: The ith Maxterm is the complement of


the ith minterm; That is Mi = mi
CS 3402:A.Berrached

30

Standard (Canonical) forms of an expression

A switching function can be represented by several


different, but equivalent, algebraic expressions.
The standard form is a unique algebraic
representation of each function.
Standard SOP: sum of minterm form of a switching
function
Standard POS: the product of maxterm form ofa
switching function
Each switching function has a unique standard SOP
and a unique standard POS.

CS 3402:A.Berrached

31

Deriving Boolean Expression from Truth Table

Input
AB C
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

Output
F
1
0
0
1
0
0
0
0

Minterm
term
ABC
ABC
ABC
ABC
ABC
ABC
ABC
ABC

designation
m0
m1
m2
m3
m4
m5
m6
m7

F is 1 iff (A=0 AND B=0 AND C=0) or (A=0 AND B=1 AND C=1)
F is 1 iff (A=1 AND B=1 AND C=1) or (A=1 AND B=1 AND C=1)
F is 1 iff A.B.C = 1 OR A.B.C= 1
F is 1 iff ABC + ABC = 1
=> F = ABC + ABC
Short-hand notation:
CS 3402:A.Berrached

=> F = m0 + m3
F = m ( 0, 3)

32

Sum of minterms form

A Boolean function is equal to the sum of minterms


for which the output is one.
=> the sum of minterms (also called the standard
SOP) form
Example: F = m ( 0, 3)

CS 3402:A.Berrached

33

Deriving Boolean Expression from Truth Table

Input
AB
0 0
0 0
0 1
0 1
1 0
1 0
1 1
1 1

C
0
1
0
1
0
1
0
1

Output
F
1
0
0
1
0
0
0
0

Minterm
term
Designation
ABC
m0
ABC
m1
ABC
m2
ABC
m3
ABC
m4
ABC
m5
ABC
m6
ABC
m7

Maxterm
term
A +B+C
A + B + C
A + B + C
A + B + C
A + B + C
A + B + C
A + B + C
A + B + C

Designation
M0
M1
M2
M3
M4
M5
M6
M7

F is 0 iff (A+B+C) = 0 AND (A+B+C)=0 AND (A+B+C)=0 AND (A+B+C) =0


AND (A+B+C) = 0 AND (A+B+C) = 0
=> F = (A+B+C) . (A+B+C) . (A+B+C) AND (A+B+C) . (A+B+C) . (A+B+C)
=> F = M1.M2.M4.M5.M6.M7 ==> F =

M(1,2,4,5,6,7)

CS 3402:A.Berrached

34

Product of Maxterms

A Boolean function is equal to the product of


Maxterms for which the output is 0.
=> the product of Maxterms (also called the standard
Product of Sums) form
Example: F = M(1,2,4,5,6,7)
(end of class 2/11/13)

CS 3402:A.Berrached

35

Examples: (complete 2/13/13)


Find the standard SOP & POS expression for each of the
following switching functions (put them in short hand
notation):
F(A,B,C) = ABC + ABC
F(A,B,C) = AB + AB + AC
F(X, Z) = X + Z
F(A,B,C,D) = A(B + CD) + ABC

CS 3402:A.Berrached

36

Getting Standard Forms of a Switching Function


F(A,B,C) = AB + AB + AC
get standard SOP and POS forms of F

Method 1:
1. Derive Truth Table for F
2. Get SOP and POS from truth table
Method 2:
Use Shannons Expansion Theorem

CS 3402:A.Berrached

37

Shannons Expansion Theorem


a) f(x1,x2,,xn) = x1.f(1,x2,.,xn) + x1.f(0,x2,,xn)
b) f(x1,x2,,xn) = [ x1+ f(0,x2,.,xn)] . [ x1.f(1,x2,,xn)]

CS 3402:A.Berrached

38

CIRCUIT DESIGN

CS 3402:A.Berrached

39

Circuit Design Procedure


Starting from a statement of a problem
1. analyze problem requirements
What are the inputs?
What are the outputs?
Whats the transformation required by problem?
Draw a block diagram of circuit.
2. Draw the truth table
3. Get standard SOP/POS expressions
4. Minimize expressions
5. Draw circuit diagram
6. Simulate circuit using some CAD tools
CS 3402:A.Berrached

40

Circuit Design-- Example

A circuit has 4 inputs (A, B, C, and D) and three outputs X


Y, and Z. The value of the outputs XY and Z is supposed
to represent the number of 1s in the inputs. E.g. if
(A,B,C,D)=(0,1,0,1) then outputs (X,Y,Z) should be (0,1,0)

Get the standard SOP/POS expressions for each output


signal.
A
B
C
D

X
Y
Z

CS 3402:A.Berrached

41

Truth Table

CS 3402:A.Berrached

42

Incompletely Specified Functions


also known as Functions with dont care terms

The output for certain input combination is not important


(I.e. we don't care about it).
Certain input combinations never occur

Example: Design a circuit that takes as input a BCD digit


and outputs a 1 iff the parity of the input is even.
Recall BCD (Binary Coded Decimal) code
Parity of a bit sequence: # of 1s in bit sequence

CS 3402:A.Berrached

43

Binary Coded Decimal Codes

A number is a sequence of decimal digits

Each digit is represented with a 4-bit number.


BCD codes allow easy conversion to/from
decimal system

each decimal digit is represented with 4 bits in


base 2
e.g. 0 = 0000 3 = 0011 5= 0101 9 = 1001

N = 856.3710

N = 1000 0101 0110 . 0011 0111BCD


CS 3402:A.Berrached

44

Incompletely Specified Functions


Block Diagram

W
X

CS 3402:A.Berrached

45

Incompletely Specified Functions

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

1
0
0
1
0
1
1
0
0
1
d
d
d
d
d
d

F = m ( 0, 3, 5, 6, 9)+d(1015)
F = M(1,2,4,7, 8). d(1015)

End of class 2/13/2013

CS 3402:A.Berrached

46

Examples

1.

Find simplest SOP expression for the functions below:


F(A,B,C) = m(1,4,5)

F(A, B, C, D) = m(0, 2, 5, 8, 9, 10, 13)


Problem 1:
F = m(1,4,5) = ABC + ABC + ABC
2.

CS 3402:A.Berrached

47

Suggested HW problems
Do the following problems from your textbook (Roth)
2.3, 2.8, 2.9, 2.17, 2.18
3.14, 3.16, 3.23
4.5, 4.7, 4.8, 4.11, 4.13, 4.16 4.18

CS 3402:A.Berrached

48

Vous aimerez peut-être aussi