Lecture 02: Digital System Design
Dept. of Computer Sc. and Engg.
University of Rajshahi
www.ru.ac.bd
Dr. Mahboob Qaosar
Binary Logic
Deals with binary variables that take 2
discrete values (0 and 1), and with logic
operations
Three basic logic operations:
AND, OR, NOT
Binary/logic variables are typically
represented as letters: A,B,C,…,X,Y,Z
Oct 15, 2024 Boolean Algebra
Binary Logic Function
F(vars) = expression
Operators ( +, •, ‘ )
Variables
set of binary
Constants ( 0, 1 )
variables
Groupings (parenthesis)
Example: F(a,b) = a’•b + b’
G(x,y,z) = x•(y+z’)
Oct 15, 2024 Boolean Algebra
Basic Logic Operators
AND
Binary
OR
NOT Unary
F(a,b)= a•b, F is 1 if and only if a=b=1
G(a,b) = a+b, G is 1 if either a=1 or b=1
H(a) = a’, H is 1 if a=0
Oct 15, 2024 Boolean Algebra
Basic Logic Operators (cont.)
1-bit logic AND resembles binary
multiplication:
0 • 0 = 0, 0 • 1 = 0,
1 • 0 = 0, 1•1 =1
1-bit logic OR resembles binary addition,
except for one operation:
0 + 0 = 0, 0 + 1 = 1,
1 + 0 = 1, 1 + 1 = 1 (≠ 102)
Oct 15, 2024 Boolean Algebra
Truth Tables for logic operators
Truth table: tabular form that uniguely represents the
relationship between the input variables of a function and its
output
2-Input AND 2-Input OR
A B F=A• A B F=A+
B B NOT
0 0 0 0 0 0 A F=
0 1 0 0 1 1 A’
1 0 0 1 0 1 0 1
1 1 1 1 1 1 1 0
Oct 15, 2024 Boolean Algebra
Truth Tables (cont.)
Q: Let a function F() depend on n variables.
How many rows are there in the truth table of
F() ?
n n
A: 2 rows, since there are 2 possible
binary patterns/combinations for the n
variables
Oct 15, 2024 Boolean Algebra
Logic Gates
Logic gates are abstractions of electronic circuit
components that operate on one or more input
signals to produce an output signal.
2-Input AND 2-Input OR NOT (Inverter)
A A
F G A H
B B
F = A•B G = A+B H = A’
Oct 15, 2024 Boolean Algebra
Timing Diagram
t0 t1 t2 t3 t4 t5 t6
1
Input A 0
1 Transitions
signals B 0
1
F=A•B 0 Basic
Gate
1 Assumption:
Output G=A+B 0 Zero time for
Signals
1 signals to
H=A’ 0 propagate
Through gates
Oct 15, 2024 Boolean Algebra
Combinational Logic Circuit
from Logic Function
Consider function F = A’ + B•C’ + A’•B’
A combinational logic circuit can be constructed to implement F, by
appropriately connecting input signals and logic gates:
Circuit input signals from function variables (A, B, C)
Circuit output signal function output (F)
Logic gates from logic operations
A F
Oct 15, 2024 Boolean Algebra
Combinational Logic Circuit
from Logic Function (cont.)
In order to design a cost-effective A B C F G
and efficient circuit, we must
0 0 0 1 1
minimize the circuit’s size (area)
and propagation delay (time 0 0 1 1 1
required for an input signal 0 1 0 1 1
change to be observed at the 0 1 1 1 1
output line) 1 0 0 0 0
Observe the truth table of F=A’ + 1 0 1 0 0
B•C’ + A’•B’ and G=A’ + B•C’
1 1 0 1 1
Truth tables for F and G are
1 1 1 0 0
identical same function
Use G to implement the logic
circuit (less components)
Oct 15, 2024 Boolean Algebra
Combinational Logic Circuit
from Logic Function (cont.)
C
A F
C
B
A G
Oct 15, 2024 Boolean Algebra
Boolean Algebra
VERY nice machinery used to manipulate
(simplify) Boolean functions
George Boole (1815-1864): “An investigation
of the laws of thought”
Terminology:
Literal: A variable or its complement
Product term: literals connected by •
Sum term: literals connected by +
Oct 15, 2024 Boolean Algebra
Boolean Algebra Properties
Let X: boolean variable, 0,1: constants
1. X + 0 = X -- Zero Axiom
2. X • 1 = X -- Unit Axiom
3. X+1 =1 -- Unit Property
4. X • 0 = 0 -- Zero Property
Oct 15, 2024 Boolean Algebra
Boolean Algebra Properties
(cont.)
Let X: boolean variable, 0,1: constants
5. X+X=X -- Idepotence
6. X•X =X -- Idepotence
7. X + X’ = 1 -- Complement
8. X • X’ = 0 -- Complement
9. (X’)’ = X -- Involution
Oct 15, 2024 Boolean Algebra
Duality
The dual of an expression is obtained by
exchanging (• and +), and (1 and 0) in it,
provided that the precedence of operations is
not changed.
Cannot exchange x with x’
Example:
Find H(x,y,z), the dual of F(x,y,z) = x’yz’ + x’y’z
H = (x’+y+z’) (x’+y’+ z)
Oct 15, 2024 Boolean Algebra
Duality (cont’d)
With respect to duality, Identities 1 – 8 have
the following relationship:
1. X+0=X 2. X•1 =X (dual of 1)
3. X+1 =1 4. X•0 =0 (dual of 3)
5. X+X=X 6. X • X = X (dual of 5)
7. X + X’ = 1 8. X • X’ = 0 (dual of 8)
Oct 15, 2024 Boolean Algebra
More Boolean Algebra
Properties
Let X,Y, and Z: boolean variables
10. X + Y = Y + X -- Commutative
11. X • Y = Y • X -- do
12. X + (Y+Z) = (X+Y) + Z -- Associative
13. X•(Y•Z) = (X•Y)•Z -- Associative
14. X•(Y+Z) = X•Y + X•Z -- Distributive
15. X+(Y•Z) = (X+Y) • (X+Z) -- Distributive
16. (X + Y)’ = X’ • Y’
17. (X • Y)’ = X’ + Y’ -- DeMorgan’s
In general,
( X1 + X2 + … + Xn )’ = X1’•X2’ • … •Xn’, and
( X1•X2•… •Xn )’ = X1’ + X2’ + … + Xn’
Oct 15, 2024 Boolean Algebra
Absorption Property
1. x + x•y = x
2. x•(x+y) = x (dual)
Proof:
x + x•y = x•1 + x•y
= x•(1+y)
= x•1
=x
Oct 15, 2024 Boolean Algebra
Power of Duality
1. x + x•y = x is true, so (x + x•y)’=x’
2. (x + x•y)’=x’•(x’+y’)
3. x’•(x’+y’) =x’
4. Let X=x’, Y=y’
5. X•(X+Y) =X, which is the dual of x + x•y = x.
6. The above process can be applied to any
formula. So if a formula is valid, then its dual
must also be valid.
7. Proving one formula also proves its dual.
Oct 15, 2024 Boolean Algebra
Consensus Theorem
1. xy + x’z + yz = xy + x’z
2. (x+y)•(x’+z)•(y+z) = (x+y)•(x’+z) -- (dual)
Proof:
xy + x’z + yz = xy + x’z + (x+x’)yz
= xy + x’z + xyz + x’yz
= (xy + xyz) + (x’z + x’zy)
= xy + x’z
Oct 15, 2024 Boolean Algebra
Truth Tables (revisited)
Enumerates all possible x y z F1 F2 F3
combinations of variable 0 0 0 0 1 1
values and the corresponding 0 0 1 0 0 1
function value 0 1 0 0 0 1
Truth tables for some arbitrary
0 1 1 0 1 1
functions
F1(x,y,z), F2(x,y,z), and F3(x,y,z) 1 0 0 0 1 0
are shown to the right. 1 0 1 0 1 0
1 1 0 0 0 0
1 1 1 1 0 1
Oct 15, 2024 Boolean Algebra
Truth Tables (cont.)
Truth table: a unique representation of a
Boolean function
If two functions have identical truth tables, the
functions are equivalent (and vice-versa).
Truth tables can be used to prove equality
theorems.
However, the size of a truth table grows
exponentially with the number of variables
involved, hence unwieldy. This motivates the use
of Boolean Algebra.
Oct 15, 2024 Boolean Algebra
Boolean expressions-NOT
unique
Unlike truth tables, expressions x y z F G
representing a Boolean function are 0 0 0 1 1
NOT unique.
Example: 0 0 1 0 0
F(x,y,z) = x’•y’•z’ + x’•y•z’ + x•y•z’ 0 1 0 1 1
G(x,y,z) = x’•y’•z’ + y•z’
0 1 1 0 0
The corresponding truth tables for F() 1 0 0 0 0
and G() are to the right. They are
identical. 1 0 1 0 0
Thus, F() = G() 1 1 0 1 1
Oct 15, 2024 Boolean Algebra
1 1 1 0 0
DeMorgan’s Theorem #1
(A · B)’ = A’ + B’
EQUAL
DeMorgan’s Theorem #2
(A + B)’ = A’ · B’
EQUAL
Algebraic Manipulation
Boolean algebra is a useful tool for
simplifying digital circuits.
Why do it? Simpler can mean cheaper,
smaller, faster.
Example: Simplify F = x’yz + x’yz’ + xz.
F = x’yz + x’yz’ + xz
= x’y(z+z’) + xz
= x’y•1 + xz
= x’y + xz
Oct 15, 2024 Boolean Algebra
Algebraic Manipulation (cont.)
Example: Prove
x’y’z’ + x’yz’ + xyz’ = x’z’ + yz’
Proof:
x’y’z’+ x’yz’+ xyz’
= x’y’z’ + x’yz’ + x’yz’ + xyz’
= x’z’(y’+y) + yz’(x’+x)
= x’z’•1 + yz’•1
= x’z’ + yz’
QED.
Oct 15, 2024 Boolean Algebra
Complement of a Function
The complement of a function is derived by
interchanging (• and +), and (1 and 0), and
complementing each variable.
Otherwise, interchange 1s to 0s in the truth
table column showing F.
The complement of a function IS NOT THE
SAME as the dual of a function.
Oct 15, 2024 Boolean Algebra
Complementation: Example
Find G(x,y,z), the complement of
F(x,y,z) = xy’z’ + x’yz
G = F’ = (xy’z’ + x’yz)’
= (xy’z’)’ • (x’yz)’ DeMorgan
= (x’+y+z) • (x+y’+z’) DeMorgan again
Note: The complement of a function can also be
derived by finding the function’s dual, and then
complementing all of the literals
Oct 15, 2024 Boolean Algebra
More Logic Gates
We can construct any combinational circuit with
AND, OR, and NOT gates
Additional logic gates are used for practical
reasons
Oct 15, 2024 Boolean Algebra
NAND and NOR Gate
Oct 15, 2024 Boolean Algebra
NAND Gate
Known as a “universal” gate because ANY
digital circuit can be implemented with NAND
gates alone.
To prove the above, it suffices to show that
AND, OR, and NOT can be implemented
using NAND gates only.
Oct 15, 2024 Boolean Algebra
NAND Gate as an Inverter Gate
X X X (Before Bubble)
X Z X
X Z
0 1
Equivalent to Inverter
1 0
NAND Gate as an AND Gate
XY
X
Z X Y X Y
Y
NAND Gate Inverter
X Y Z
0 0 0
0 1 0
Equivalent to AND Gate
1 0 0
1 1 1
NAND Gate as an OR Gate
X
X Y
Z X Y X Y X Y
Y
Inverters NAND Gate
X Y Z
0 0 0
0 1 1
Equivalent to OR Gate
1 0 1
1 1 1
NOR Gate
Also a “universal” gate because ANY digital
circuit can be implemented with NOR gates
alone.
This can be similarly proven as with the
NAND gate.
Oct 15, 2024 Boolean Algebra
NOR Gate as an Inverter Gate
X X X (Before Bubble)
X Z X
X Z
0 1
Equivalent to Inverter
1 0
NOR Gate as an OR Gate
XY
X
Z X Y X Y
Y
NOR Gate “Inverter”
X Y Z
0 0 0
0 1 1
Equivalent to OR Gate
1 0 1
1 1 1
NOR Gate as an AND Gate
X
X Y
Z X Y X Y X Y
Y
“Inverters” NOR Gate
X Y Z
0 0 0
0 1 0
Equivalent to AND Gate
1 0 0
1 1 1
XOR and XNOR
X Y F = XY
XOR: “not-equal” gate 0 0 0
0 1 1
X F 1 0 1
Y 1 1 0
X Y F = XY
XNOR: “equal” gate 0 0 1
0 1 0
X F
1 0 0
Y 1 1 1
Oct 15, 2024 Boolean Algebra
Exclusive-OR (XOR) Function
XOR (also ) : the “not-equal” function
XOR(X,Y) = X Y = X’Y + XY’
Identities:
X0=X
X 1 = X’
XX=0
X X’ = 1
Properties:
XY=YX
(X Y) W = X ( Y W)
Oct 15, 2024 Boolean Algebra
XOR circuit with 4 NANDs
Oct 15, 2024 Boolean Algebra
Karnaugh Maps
Karnaugh maps (K-maps) are graphical
representations of boolean functions.
One map cell corresponds to a row in the
truth table.
Also, one map cell corresponds to a minterm
or a maxterm in the boolean expression
Multiple-cell areas of the map correspond to
standard terms.
Oct 15, 2024 Boolean Algebra PJF - 44
Two-Variable Map
x2 x1
x1 0 1 x2 0 1
0 1 0 2
0 m0 m1
OR 0 m0 m2
2 3 1 3
1 m2 m3 1 m1 m3
NOTE: ordering of variables is
IMPORTANT for f(x1,x2), x1 is the row, x2 is
the column.
Cell 0 represents x1’x2’; Cell 1 represents
x1’x2; etc. If a minterm is present in the
function, then a 1 is placed in the
Oct 15, 2024 Boolean Algebra
corresponding cell.
Two-Variable Map (cont.)
Any two adjacent cells in the map differ by
ONLY one variable, which appears
complemented in one cell and
uncomplemented in the other.
Example:
m0 (=x1’x2’) is adjacent to m1 (=x1’x2) and m2
(=x1x2’) but NOT m3 (=x1x2)
Oct 15, 2024 Boolean Algebra
2-Variable Map -- Example
f(x1,x2) = x1’x2’+ x1’x2 + x1x2’
= m 0 + m1 + m2
= x 1 ’ + x2 ’ x2
1s placed in K-map for
specified minterms m0, m1, m2 x1 0 1
Grouping (ORing) of 1s allows 0 1
simplification
What (simpler) function is 0 1 1
represented by each dashed
2 3
rectangle?
x ’=m +m
1 0 1 1 1 0
x ’=m +m
2 0 2
Note m0 covered twice
Oct 15, 2024 Boolean Algebra
Minimization as SOP using K-
map
Enter 1s in the K-map for each product term
in the function
Group adjacent K-map cells containing 1s to
obtain a product with fewer variables. Group
size must be in power of 2 (2, 4, 8, …)
Handle “boundary wrap” for K-maps of 3 or
more variables.
Realize that answer may not be unique
Oct 15, 2024 Boolean Algebra
Three-Variable Map
yz
x 00 01 11 10
0 1 3 2
0 m0 m1 m3 m2
4 5 7 6
1 m4 m5 m7 m6
-Note: variable ordering is (x,y,z); yz specifies
column, x specifies row.
-Each cell is adjacent to three other cells (left or
right or top or bottom or edge wrap)
Oct 15, 2024 Boolean Algebra
Three-Variable Map (cont.) minterm
The types of structures that
are either minterms or are
generated by repeated
application of the minimization
theorem on a three variable
map are shown at right.
Groups of 1, 2, 4, 8 are
possible.
group of 2 terms
group of 4 terms
Oct 15, 2024 Boolean Algebra
Simplification
Enterminterms of the Boolean function into
the map, then group terms
Example: f(a,b,c) = a’c + abc + bc’
Result: f(a,b,c) = a’c+ b
abc
1 1 1
1 1
1 1 1
1 1
Oct 15, 2024 Boolean Algebra
More Examples
yz
X 00 01 11 10
f (x, y, z) = ∑ m(2,3,5,7) 0 1 1
1
1 1 1
f1(x, y, z) = x’y + xz
f (x, y, z) = ∑ m (0,1,2,3,6)
2
1 1 1 1
f (x, y, z) = x’+yz’
2 1
Oct 15, 2024 Boolean Algebra
Four-Variable
YZ
Maps
00 01 11 10
WX
00 m0 m1 m3 m2
01 m4 m5 m7 m6
11 m12 m13 m15 m14
10 m8 m9 m11 m10
Top cells are adjacent to bottom cells. Left-edge
cells are adjacent to right-edge cells.
Note variable ordering (WXYZ).
Oct 15, 2024 Boolean Algebra
Four-variable Map
Simplification
One square represents a minterm of 4 literals.
A rectangle of 2 adjacent squares represents a
product term of 3 literals.
A rectangle of 4 squares represents a product
term of 2 literals.
A rectangle of 8 squares represents a product
term of 1 literal.
A rectangle of 16 squares produces a function
that is equal to logic 1.
Oct 15, 2024 Boolean Algebra
Example
Simplify the following Boolean function
(A,B,C,D) = ∑m(0,1,2,4,5,7,8,9,10,12,13).
First put the function g( ) into the map, and then
group as many 1s as possible.
ab cd
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1
1 1 1 1 1 1
g(A,B,C,D) = c’+b’d’+a’bd
Oct 15, 2024 Boolean Algebra
Don't Care Conditions
There may be a combination of input values which
will never occur
if they do occur, the output is of no concern.
The function value for such combinations is called a
don't care.
They are denoted with x or –. Each x may be
arbitrarily assigned the value 0 or 1 in an
implementation.
Don’t cares can be used to further simplify a
function
Oct 15, 2024 Boolean Algebra
Minimization using Don’t
Cares
Treat don't cares as if they are 1s to generate
PIs.
Delete PI's that cover only don't care
minterms.
Treat the covering of remaining don't care
minterms as optional in the selection process
(i.e. they may be, but need not be, covered).
Oct 15, 2024 Boolean Algebra
cd
ab 00 01 11 10
Example 00 0 1 0 1
01 1 1 0 1
Simplify the function f(a,b,c,d) 11 0 0 x x
10 1 1 x x
whose K-map is shown at the
right. 0 1 0 1
f = a’c’d+ab’+cd’+a’bc’ 1 1 0 1
or 0 0 x x
1 1 x x
f = a’c’d+ab’+cd’+a’bd’
0 1 0 1
1 1 0 1
0 0 x x
1 1 x x
Oct 15, 2024 Boolean Algebra
cd
ab
Another Example x 1 0 0
1 x 0 x
Simplify the function 1 x x 1
g(a,b,c,d) whose K-map 0 x x 0
is shown at right. x 1 0 0
g = a’c’+ ab 1 x 0 x
or 1 x x 1
g = a’c’+b’d 0 x x 0
x 1 0 0
1 x 0 x
1 x x 1
0 x x 0
Oct 15, 2024 Boolean Algebra