Você está na página 1de 20

Boolean Algebra and Digital

Circuits
Part 1: Boolean Algebra
Binary Logic and Digital Circuits

we saw in the previous set of lectures how


computers represent information
and in particular how they perform arithmetical
operations upon numbers
in the following set of lectures well see how binary
logic is used to design and implement digital circuits
which can perform such operations
and how simple circuits combine to perform
more complex operations
A Potted History

1854: George Booles The Laws of Thought is published, thus creating


Symbolic Logic, or Boolean Algebra

1938: John Atanasoff determines 4 principles for his ABC digital


computer:

it will use electricity instead of mechanical movements

it will use base 2 because switches are either on or off

it will use capacitors for memory because they store charge


with a regenerative process, avoiding power leakage

computations will be performed by direct logical action - which


Claude Shannon proved is essentially Boolean Algebra - rather
than by enumeration as had been done before
Boolean Algebra

a system for the manipulation of variables, where the


variables can have one of two values:

true or false

which correspond to on or off, 1 or 0

Boolean Expressions are created by applying Boolean


Operators to one or more variables:

such as AND, OR and NOT

and also NAND, NOR and XOR


Operators and their Truth Tables

each operator can be described using its truth table:


AND OR NOT
Inputs Output Inputs Output Input Output
x y x.y x y x+y x x
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
math: xy math: xy math: x
logic: x.y logic: x+y logic: x
Operators and their Truth Tables

each operator can be described using its truth table:


NAND NOR XOR
Inputs Output Inputs Output Inputs Output
x y x.y x y x+y x y xy
0 0 1 0 0 1 0 0 0
0 1 1 0 1 0 0 1 1
1 0 1 1 0 0 1 0 1
1 1 0 1 1 0 1 1 0
math: (x y) math: (x y) math:
(x y) (x y)
logic: x.y logic: x+y logic: xy
Boolean Functions
A Boolean Function involves:

one or more input variables

one or more operators

a result from the set {0,1}

examples:

F(x, y) = x.y

F(x, y) = x + y

F(x, y, z) = y + x.z

if x = 0, y =1 and z = 1 then we can easily evaluate the first two functions:

x.y = 1 AND 0 = 0

x + y = 1 OR 0 = 1

but in what order to we perform the operations to find the answer to the third function?
Operators: Order of Precedence
priority highest to lowest:
Inputs Intermediate Output
NOT then AND then OR
x y z x x.z F=y+x.z
F(x,y,z) = y + x.z
0 0 0 1 0 0
evaluate F when x = 0, y = 1
0 0 1 1 1 1
and z = 1
0 1 0 1 0 1
easiest to evaluate in stages:
0 1 1 1 1 1
x = NOT(0) = 1
1 0 0 0 0 0
x.z = 1 AND 1 = 1
1 0 1 0 0 0
y + x.z = 1 OR 1 = 1
1 1 0 0 0 1
so we see that it helps to evaluate
1 1 1 0 0 1
the function in pieces
(can you spot the easy way to generate the set of truth table
input values for x, y and z?)
Boolean Identities

boolean functions can quickly become complicated

yet the simpler we can make the function, the smaller


circuit well need to build for it

cheaper, more economical and faster

so theres an incentive to reduce boolean functions to their


simplest form

sometimes this can be tricky, so well look at a clever


technique for simplifying functions later

for now, well use the basic identities to perform the task
Boolean Identities
Name AND Form OR Form
Identity Law 1.x = x 0 + x = x
Null (or Dominance) Law 0.x = 0 1 + x = 1
Idempotent Law x.x = x x + x = x
Inverse Law x.x = 0 x + x = 1
Commutative Law x.y = y.x x + y = y + x
Associative Law (x.y).z = x.(y.z) (x+y)+z = x+(y+z)
Distributive Law x+y.z = (x+y).(x+z) x.(y+z) = x.y + x.z
Absorption Law x.(x+y) = x x + x.y = x
DeMorgans Law x.y = x + y x+y = x.y
Double Complement Law x = x
Table 3.5 from Computer Organization & Architecture
note the double-bar over the x
Using Identities to Simplify Functions

i. simplify F(x, y, z) = x.y.z + x.y.z + x.z


= x.y.z + x.y.z + x.z
= x.y.(z + z) + x.z distributive

= x.y.(1) + x.z inverse


= x.y + x.z identity

(examples i., ii. & iii. are based upon examples 3.2, 3.3 and the proof on p128 from Computer Organization & Architecture)
Using Identities to Simplify Functions

ii. simplify F(x, y) = y + x.y


= y + x.y
= y + (x + y) DeMorgans

= y + (y + x) commutative
= (y + y) + x associative

= 1 + x inverse

= 1 null
Using Identities to Simplify Functions

iii. prove (x + y).(x + y) = y


(x + y).(x + y)
= x.x + x.y + y.x + y.y distributive
= 0 + x.y + y.x + y.y inverse
= 0 + x.y + y.x + y idempotent
= x.y + y.x + y identity
= y.(x + x) + y distributive (& commutative)
= y.(1) + y inverse
= y + y identity
= y idempotent
DeMorgans Law

recall that:
important: note that
x.y = x + y
x.y x.y
x+y = x.y

this is one of the most useful identities in practical terms

why?

answer: it tells us how to covert AND and OR operations into NAND


and NOR operations

moreover we can determine that all other operations can be


performed using just NAND or just NOR

and that makes digital circuits much easier to produce


NAND Alone

example: show that OR, NOT and AND can be performed using NAND
operations only:

OR: x+y = x.x + y.y idempotent


= (x.x) + (y.y) double complement
= x.x.y.y DeMorgan

NOT: x = (x) simple re-write


= (x.x) idempotent

AND: x.y = x.y double complement


= (x.y) simple re-write
= (x.y).(x.y) idempotent
More DeMorgan

because building circuits is often easier just using NAND and NOR gates,
its useful to be able to negate a function (using a simple NOT operation)

this gives the complement of the function

example: if F(x, y, z) = x + y + z then find F:


F(x, y, z) = x + y + z
= w + z substituting w = x + y
= w.z DeMorgans
= x + y.z replacing x + y = w
= x.y.z DeMorgans

so we see that DeMorgans law extends for 3 variables, and in fact generally
Standardized Form
weve seen that the same boolean function can be written in many different
ways

to avoid confusion designers specify functions in a standardized (or canonical)


form

the two most common forms are:

sum of products

ANDed variables are ORed together

such as F(x, y, z) = x.y + x.z + y.z

product of sums

ORed variables are ANDed together

such as F(x, y, z) = (x + y).(x + z).(y + z)


Sum of Products
the easiest version to determine because we can just use a truth table:

find and list the values of x, y and z which make the function true

then simply OR each expression in the list together

example: a majority polling function

x y z F
so the function is:
0 0 0 0
F = xyz + xyz + xyz + xyz
0 0 1 0
0 1 0 0
0 1 1 1 xyz
1 0 0 0
1 0 1 1 xyz
1 1 0 1 xyz
1 1 1 1 xyz
Table 3.8 from Computer Organization & Architecture
To Conclude

weve learned about Boolean variables, operators, expressions and functions

weve seen how to form truth tables to help us to determine the


outcome of functions

dont underestimate the value of using these!

weve seen how to apply the identities to help us to simplify some


functions

and to transform others so that they can be expressed just using NAND
or NOR

making good use of DeMorgans law

weve seen how to represent functions in a standardized form


References & Further Learning

outline primarily based upon:

Chapter 3, Computer Organization & Architecture (3rd Edition), Null & Lobur

other material used for reference:

Set 5, CG066 Lecture Notes, Dave Harrison,Northumbria University

suggested learning activities:

practice creating truth tables for the basic operators until you are
comfortable with them

use NAND gates to build the remaining gates from the example

create a function, draw its truth table and then derive its standardized form
as a sum of products

Você também pode gostar