Vous êtes sur la page 1sur 58

Boolean Algebra

U.U.Samantha Rajapaksha
BSc. Eng. (Moratuwa), MSc in IT
Senior Lecturer
Sri Lanka Institute of Information Technology
New Kandy Road,
Malabe, Sri Lanka
Tel:0112-301904
email: samantha.r@sliit.lk
Web: www.sliit.lk

Binary Logic and Gates


Binary variables take on one of two values.
Logical operators operate on binary values
and binary variables.
Basic logical operators are the logic
functions AND, OR and NOT.
Logic gates implement logic functions.
Boolean Algebra: a useful mathematical
system for specifying and transforming
logic functions.
We study Boolean algebra as a foundation
for designing and analyzing digital
systems!

Logical Operations
The three basic logical operations are:
AND
OR
NOT

AND is denoted by a dot ().


OR is denoted by a plus (+).
NOT is denoted by an overbar ( ), a single
quote mark (') after, or (~) before the
variable.

Operator Definitions
Operations are defined on
the values "0" and "1" for each
operator:
OR
NOT
AND

0
0
1
1

0
1
0
1

=
=
=
=

0
0
0
1

0+
=
0
0+
=
1
1+
=
1
1+
=1

0
1
0
1

0 1
1 0

Truth Tables
Truth table a tabular listing of the
values of a function for all possible
combinations of values on its arguments
Example: Truth tables for the basic logic
operations:
OR
NOT
AND
X Y Z = X+Y X
X YZ =
Z X
0 0
0
0
1
0 0XY
0
0 1
1
1
0
0 10
1 0
1
1 00
1 1
1
1 11

Boolean Algebra
The truth table for the Boolean
function:

To make evaluation of the


Boolean function easier, the
truth table contains extra
(shaded) columns to hold
evaluations of subparts of the
function.

Logic Gate Symbols and


Behavior
Logic gates have special symbols:
X
Y

Z 5 X Y

Z5 X1 Y

OR gate

AND gate

(a) Graphic symbols

And waveform behavior in time as


0
0
1
1
X
follows:
Y

(AND) X Y

(OR)

X1 Y

(NOT)

(b) Timing diagram

Z5 X

Logic Gates
Another very useful gate is the exclusive OR (XOR) gate.
The output of the XOR operation is true only when the values
of the inputs differ.

Note the special symbol


for the XOR operation.

Logic Gates
NAND and NOR
are two very
important gates.
Their symbols and
truth tables are
shown at the right.

Logic Diagrams and


Expressions
Truth Table
Equation
XYZ

F X Y Z

000

001

010

011

100

101

110

111

F X Y Z
Logic Diagram
X

Boolean equations, truth tables and logic diagrams


describe the same function!
Truth tables are unique; expressions and logic diagrams
are not. This gives flexibility in implementing functions.

Exercise
Show that A+BC =(A+B)(A+C)
is true using a truth table.

Boolean Algebra

An algebraic structure defined on a set of at least two


elements, B, together with three binary operators
(denoted +, and ) that satisfies the following basic
identities:

1.

X + 0= X

2.

X . 1= X

3.

X + 1= 1

4.

5.

X + X= X

6.

X . X=X

7.

X + X= 1

8.

X . X =0

9.

X=X

0=0

10. X + Y=Y + X

11.

XY =YX

Commutative

12. (X + Y)+ Z = X + (Y+ Z)


14. X(Y +Z) = XY +XZ

13. (XY)Z =X(YZ)

Associative

15. X + YZ= (X + Y)(X + Z)

Distributive

16. X + Y =X . Y

17. X . Y =X + Y

DeMorgan
s

Minterms
Minterms are AND terms with every
variable present in either true or
complemented form.
Given that each binary variable may appear
normal (e.g., x) or complemented (e.g.,
),
x
there are 2n minterms for n variables.
Example: Two variables (X and Y)produce
2 x 2 = 4 combinations:
(both normal)
normal, Y complemented)
XY (X
(X complemented, Y normal)
XY (both complemented)

XY
XY there are four minterms of two
Thus
variables.

Maxterms
Maxterms are OR terms with every
variable in true or complemented form.
Given that each binary variable may
appear normal (e.g., x) or
complemented (e.g., x), there are 2n
maxterms for n variables.
Example: Two variables (X and Y)
produce
= 4 combinations:
2X
x2Y

X Y (both normal)
(x normal, y complemented)
X Y (x complemented, y normal)
X Y (both complemented)

Minterm and Maxterm


Relationship
Review: DeMorgan's Theorem
and
Two-variable example:
and
Thus M2 is the complement of m2
and vice-versa.
Since DeMorgan's Theorem holds
for n variables, the above holds for
terms of n variables

giving:

Mi mi

and
Thus Mi is the complement of mi.

x y x y

x y x y

M2 x y

m2 xy

mi Mi

Standard Forms of Boolean


Expressions
All Boolean expressions, regardless of their form,
can be converted into either of two standard
forms:
The sum-of-products (SOP) form
The product-of-sums (POS) form

Standardization makes the evaluation,


simplification, and implementation of Boolean
expressions much more systematic and easier.

Sum-of-Products (SOP)

The Sum-of-Products (SOP)


Form
An SOP expression
when two or
more product terms
are summed by
Boolean addition.
Examples:

AB ABC
ABC CDE B CD
A B A BC AC
Also:

A A B C BCD

In an SOP form, a
single overbar
cannot extend
over more than
one variable;
however, more
than one variable
in a termAcan
B C have
an overbar:

ABC
example:
is OK!

Implementation of an
SOP
X=AB+BCD+AC
AND/OR
implementation

NAND/NAND
implementation

A
B

A
B

B
C
D

B
C
D

A
C

A
C

General Expression SOP


Any logic expression can be changed into
SOP form by applying Boolean algebra
techniques.
ex:
A( B CD ) AB ACD
AB B(CD EF ) AB BCD BEF
( A B )( B C D) AB AC AD BB BC BD
( A B ) C ( A B )C ( A B )C AC BC

The Standard SOP Form


A standard SOP expression is one in
which all the variables in the domain
appear in each product term in the
expression.
Example:AB CD

A B CD ABC D

Standard SOP expressions are important


in:
Constructing truth tables
The Karnaugh map simplification method

Converting Product Terms to


Standard SOP
Step 1: Multiply each nonstandard product
term by a term made up of the sum of a
missing variable and its complement. This
results in two product terms.
As you know, you can multiply anything by 1
without changing its value.

Step 2: Repeat step 1 until all resulting


product term contains all variables in the
domain in either complemented or
uncomplemented form. In converting a
product term to standard form, the number
of product terms is doubled for each
missing variable.

Converting Product Terms to


Standard SOP (example)
Convert the following Boolean expression
into standard SOP form:
AB C A B ABC D
AB C AB C ( D D ) AB CD AB CD
A B A B (C C ) A B C A B C
A B C ( D D ) A B C ( D D ) A B CD A B CD A B C D A B C D
AB C A B ABC D AB CD AB CD A B CD A B CD A B C D A B C D ABC D

Exercise
Convert the following Boolean expression into standard
SOP form:

F ( A, B, C ) A B C

Binary Representation of a
Standard Product Term
A standard product term is equal to 1 for
only one combination of variable values.
Example: AB CD
is equal to 1 when A=1,
B=0, C=1, and D=0 as shown below
AB CD 1 0 1 0 1 1 1 1 1
And this term is 0 for all other combinations
of values for the variables.

Product-of-Sums (POS)

The Product-of-Sums (POS)


Form
When two or more
sum terms are
multiplied, the result
expression is a
product-of-sums
(POS):
Examples:
( A B )( A B C )
( A B C )(C D E )( B C D)
( A B)( A B C )( A C )

Also:

A ( A B C )( B C D )

In a POS form, a
single overbar
cannot extend
over more than
one variable;
however, more
than one variable
in a termA can
B C have
an overbar:

example:A B C
is OK!

Implementation of a POS
X=(A+B)(B+C+D)(A+C)

OR/AND implementation
A
B
B
C
D
A
C

The Standard POS Form


A standard POS expression is one in
which all the variables in the domain
appear in each sum term in the
expression.
( A B C D )( A B C D)( A B C D)
Example:

Standard POS expressions are important


in:
Constructing truth tables
The Karnaugh map simplification method

Converting a Sum Term to


Standard POS
Step 1: Add to each nonstandard product term a term
made up of the product of the missing variable and its
complement. This results in two sum terms.
As you know, you can add 0 to anything without changing
its value.

Step 2: Apply rule 12 A+BC=(A+B)(A+C).


Step 3: Repeat step 1 until all resulting sum terms
contain all variable in the domain in either
complemented or uncomplemented form.

Converting a Sum Term to


Standard POS (example)
Convert the following Boolean expression
into standard POS form:
( A B C )( B C D )( A B C D)
A B C A B C DD ( A B C D)( A B C D )
B C D B C D AA ( A B C D )( A B C D )
( A B C )( B C D )( A B C D)
( A B C D)( A B C D )( A B C D )( A B C D )( A B C D)

Exercise
Convert the following Boolean expression into standard
POS form:

F ( X , Y , Z ) XY X Z

Binary Representation of a
Standard Sum Term
A standard sum term is equal to 0 for
only one combination of variable values.
Example:A B C D
is equal to 0 when A=0,
B=1, C=0, and D=1 as shown below
A B C D 0 1 0 1 0000 0

And this term is 1 for all other combinations


of values for the variables.

SOP/POS

Converting Standard SOP to


Standard POS
The Facts:
The binary values of the product terms in a given
standard SOP expression are not present in the
equivalent standard POS expression.
The binary values that are not represented in the
SOP expression are present in the equivalent POS
expression.

Converting Standard SOP to


Standard POS
What can you use the facts?
Convert from standard SOP to standard POS.

How?
Step 1: Evaluate each product term in the SOP
expression. That is, determine the binary numbers that
represent the product terms.
Step 2: Determine all of the binary numbers not
included in the evaluation in Step 1.
Step 3: Write the equivalent sum term for each binary
number from Step 2 and express in POS form.

Converting Standard SOP to


Standard POS (example)
Convert the SOP expression to an
equivalent POS expression:
A B C A BC A BC AB C ABC
The evaluation is as follows:

000 010 011 101 111

There are 8 possible combinations. The SOP


expression contains five of these, so the POS
must contain the other 3 which are: 001, 100,
and 110.
( A B C )( A B C )( A B C )

Exercises

Karnaugh Maps (Kmap)


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
A topologically-warped Venn diagram as
used to visualize sets in algebra of sets

Two Variable Maps


A 2-variable Karnaugh Map:

Note that minterm m0 and


minterm m1 are adjacent
and differ in the value of the
variable y
Similarly, minterm m0 and

y = 0y = 1

m0 = m1 =
x=0
xy

xy

x = 1m2 = mx3 y=

minterm m2 differ in the x variable. x y


Also, m1 and m3 differ in the x variable as well.
Finally, m2 and m3 differ in the value of the
variable y

K-Map and Truth


The K-Map is just a different form of the
Tables

truth table.
Example Two variable function:
We choose a,b,c and d from the set {0,1}
toFunction
implement
K-Map F(x,y).
Tablea particular function,

Input Function
Values Value
(x,y)
F(x,y)
0
0
1
1

0
1
0
1

a
b
c
d

y = 0y = 1
x=0 a
b
d
x=1c

K-Map Function
Representation
Example: F(x,y) = x

y=1
F = xy = 0
x=0 0

x=1 1

For function F(x,y), the two adjacent

cells containing 1s can be combined


using the Minimization Theorem:
F (x , y ) x y x y x

Three Variable Maps


A three-variable K-map:

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

x=0 m0

m1

m3

m2

x=1 m4

m5

m7

m6

Where each minterm corresponds to the


product terms:

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

x=0

xyz

xyz

xyz

xyz

x=1

xyz

xyz

xyz

xyz

Note that if the binary value for an index


differs in one bit position, the minterms are
adjacent on the K-Map

Alternative Map Labeling


Map use largely involves:
Entering values into the map,
and
Reading off product terms
from the map.
y
Alternate
y
0
3
2
1
xuseful:

y
y
z
labelings
x 00 01 are
11 10
x

00

14

Example Functions
By convention, we represent the minterms of
F by a "1" in the map and leave Fthe minterms
of
blank
y
Example:

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

x 41

Example:

G(a, b, c) m(3,4,6,7)
0

Learn the locations of the 8


indices based on the variable
x 41 5
order shown (x, most significant
and z, least significant) on the
map boundaries

y
3

1
7
1

2
6

Combining Squares
By combining squares, we reduce number
of literals in a product term, reducing the
literal cost, thereby reducing the other
two cost criteria

On a 3-variable K-Map:
One square represents a minterm with three
variables
Two adjacent squares represent a product
term with two variables
Four adjacent terms represent a product
term with one variable
Eight adjacent terms is the function of all
ones (no variables) = 1.

Example: Combining
Squares F m(2,3,6,7)
y
Example: Let

1
7
1

1
6
1

z
Applying the Minimization Theorem
three times:

F(x,y,z) xyz xyz xyz xyz


yz yz
y

Thus the four terms that form a 2 2


square correspond to the term "y".

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.

Three-Variable Maps
Example Shapes of 2-cell Rectangles:

Read off the product terms for the


rectangles shown

Three-Variable Maps
Example Shapes of 4-cell Rectangles:

z
Read off the product terms for the rectangles
shown

Three Variable Maps

K-Maps can be used to simplify Boolean


functions by
systematic methods. Terms are selected
to cover the
F(x, y, z) m(1,2,3,5,7)
1sin the map.
xy

Example: Simplify

1 1 1
x

1 1
z

F(x, y, z)

z x y

Three-Variable Map
Simplification
Use a K-map to find an optimum SOP
equation for

F(X, Y, Z) m(0,1,2,4,6,7)

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")

Four-Variable Maps
Example Shapes of Rectangles:

12

13

15

14

11

10

Four-Variable Maps
Example Shapes of Rectangles:

12

13

15

14

11

10

Four-Variable Map
Simplification
F(W,X,Y, Z) m(0,2,4,5,6,7,
8,10,13,15
)

Four-Variable Map
Simplification
F(W,X,Y, Z) m(3,4,5,7,9,1
3,14,15
)

Exercise

Vous aimerez peut-être aussi