Вы находитесь на странице: 1из 7

Harvard University CS 101 Fall 2005, Shimon Schocken

Boolean Logic

Boolean Logic 1 Elements of Computing Systems

Boolean algebra
Some elementary Boolean operators: x Not(x) x y And(x,y)
0 1 0 0 0
„ Not(x) 1 0 0 1 0
1 0 0
„ And(x,y) 1 1 1

„ Or(x,y)
„ Nand(x,y) x y Or(x,y) x y Nand(x,x)
0 0 0 0 0 1
0 1 1 0 1 1
Boolean functions: 1 0 1 1 0 1
1 1 1 1 1 0

x y z f ( x, y , z ) = ( x + y ) z
0 0 0 0
0 0 1 0
„ Functional expression VS truth table expression
0 1 0 1
0 1 1 0 „ Important result: Every Boolean function can be
1 0 0 1 expressed using And, Or, Not
1 0 1 0
1 1 0 1
1 1 1 0

Boolean Logic 2 Elements of Computing Systems

Copyright © Shimon Schocken


All Boolean functions of 2 variables

Boolean Logic 3 Elements of Computing Systems

Boolean algebra

Given: Nand(a,b), false

„ Not(a) = Nand(a,a)

„ true = Not(false)
George Boole, 1815-1864
„ And(a,b) = Not(Nand(a,b))
(“A Calculus of Logic”)

„ Or(a,b) = Not(And(Not(a),Not(b)))

„ Xor(a,b) = Or(a,Not(b),Not(a),b))

„ Etc.

Boolean Logic 4 Elements of Computing Systems

Copyright © Shimon Schocken


Gate logic

„ Gate logic – a gate architecture designed to implement a Boolean function

„ Elementary gates:

„ Composite gates:

„ Interface VS implementation.

Boolean Logic 5 Elements of Computing Systems

Gate Logic

Interface

a
Xor out
b Claude Shannon, 1916-2001
(“Symbolic Analysis of Relay and
a b out Switching Circuits” )
Implementation
0 0 0
0 1 1
1 0 1 a
1 1 0 And
Not

Or out

Not
And
b

Xor(a,b)=Or(a,Not(b),Not(a),b))

Boolean Logic 6 Elements of Computing Systems

Copyright © Shimon Schocken


Circuit implementations
a
a b
a b out a b out
0 0 0 b 0 0 0
AND gate 0 1 0 0 1 1
1 0 0 OR gate 1 0 1
1 1 1 1 1 1
power supply
power supply
out out

a b c
a b c out
a
0 0 0 0 AND
0 0 1 0 b
0 1 0 0 AND (a,b,c)
0 1 1 0 out
1 0 0 0 AND
1 0 1 0 c
1 1 0 0
1 1 1 1
out

„ Physical realizations of logic gates are irrelevant to computer science.

Boolean Logic 7 Elements of Computing Systems

Project 1: elementary logic gates

Given: Nand(a,b), false a b Nand(a,b)


0 0 1
0 1 1
1 0 1
Build: 1 1 0

„ Not(a) = ...

„ true = ...

„ And(a,b) = ...

„ Or(a,b) = ...

„ Mux(a,b,sel) = ...

„ Etc. - 12 gates altogether.

Boolean Logic 8 Elements of Computing Systems

Copyright © Shimon Schocken


Multiplexer

a b sel out sel out

0 0 0 0 a 0 a
0 0 1 0 1 b
Mux out
0 1 0 0 b
0 1 1 1
1 0 0 1
1 0 1 0 sel
1 1 0 1
1 1 1 1

„ Implementation: based on Not, And, Or gates.

Boolean Logic 9 Elements of Computing Systems

Project 1 tips

„ Gate construction “work flow”: see the “building an And gate” slides
from the intro lecture
„ Course web site
„ Download the TECS software suite
„ Go through the hardware simulator
„ You’re in business.

Boolean Logic 10 Elements of Computing Systems

Copyright © Shimon Schocken


End notes: Canonical representation

Suspect function (a-la-Leibnitz): Each suspect may or may not have an alibi (a), a
motivation to commit the crime (m), and a relationship to the weapon found in
the scene of the crime (w). The police decides to focus attention only on
suspects for whom the proposition Not(a) And (m Or w) is true.

Truth table of the "suspect" function s (a, m, w) = a ⋅ ( m + w)

Canonical form: s ( a, m, w) = a m w + a m w + a m w

Boolean Logic 11 Elements of Computing Systems

End notes: Canonical representation (cont.)

s (a, m, w) = a ⋅ ( m + w)

a
s
or
m
and
w
s ( a, m, w) = a m w + a m w + a m w
a
m and
w

s
and or

and

Boolean Logic 12 Elements of Computing Systems

Copyright © Shimon Schocken


End notes: Programmable Logic Device for 3-way functions
a
legend:
active fuse
b and blown fuse

8 and terms
connected to the
.. or
f(a,b,c)
same 3 inputs .

single or term
connected to the
and outputs of 8 and terms

_ _ _
PLD implementation of f(a,b,c)= a b c + a b c
(the on/off states of the fuses determine which gates participate in the computation)

Boolean Logic 13 Elements of Computing Systems

Perspective

„ Each Boolean function has a canonical representation

„ The canonical representation is expressed in terms of And, Not, Or

„ And, Not, Or can be expressed in terms of Nand alone

„ Ergo, every Boolean function can be realized by a standard PLD


consisting of Nand gates only
a

„ Mass production b and

„ Universal building blocks, .. or


f(a,b,c)
.
unique topology
and

„ Gates, neurons, atoms, …

Boolean Logic 14 Elements of Computing Systems

Copyright © Shimon Schocken

Вам также может понравиться