CS270: INTRODUCTION TO COMPUTER
ENGINEERING
Combinational Logic Design
Introduction to Computer Engineering 19th Sept. 2017 1
Content
• Boolean Algebra
• Basic Logic Gates
• Converting decimal numbers to binary
• Converting binary numbers to decimal
Introduction to Computer Engineering 19th Sept. 2017 2
Boolean Algebra
• A Boolean operator can be completely described
using a truth table
• The truth table for the • The truth table for the
Boolean operator AND is Boolean operator OR is
also known as “product” also known as “sum”
X AND Y X OR Y
X Y XY X Y X+Y
0 0 0 0 0 0
0 1 0 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
Introduction to Computer Engineering 19th Sept. 2017 3
Boolean Algebra (contd.)
• The truth table for the Boolean NOT operator is
shown below
• The NOT operation is most often designated by an
overbar. It is sometimes indicated by a prime mark
( ‘ ) or an “elbow” ().
NOT X
X X
0 1
1 0
Introduction to Computer Engineering 19th Sept. 2017 4
Boolean Algebra (contd.)
• A Boolean function has:
• at least one Boolean variable,
• at least one Boolean operator, and
• at least one input from the set {0,1}.
• It produces an output that is also a member of the set
{0,1}
• As above, hence the significance of the binary
numbering system is so handy in digital (systems)
Introduction to Computer Engineering 19th Sept. 2017 5
Basic Logic Gates
• NOT, AND, and OR Gates
• NAND and NOR Gates
• DeMorgan’s Theorem
• Exclusive-OR (XOR) Gate
• Multiple-input Gates
Introduction to Computer Engineering 19th Sept. 2017 6
NOT Gate (Inverter)
NOT X Y
X Y 0 1
1 0
Y = ~X
Introduction to Computer Engineering 19th Sept. 2017 7
NOT
• Y = ~X (Verilog)
• Y = !X (ABEL)
• Y = not X (VHDL)
• Y = X’
• Y= X
• Y=X (textook)
• not(Y,X) (Verilog)
Introduction to Computer Engineering 19th Sept. 2017 8
AND Gate
AND Truth Table
X Y Z
X 0 0 0
Z 0 1 0
Y 1 0 0
1 1 1
X*Y = Z
Introduction to Computer Engineering 19th Sept. 2017 9
AND
• X&Y (Verilog and ABEL)
• X and Y (VHDL)
•
V
X Y
•
U
X Y
• X*Y
• XY (textbook)
• and (Z,X,Y) (Verilog)
Introduction to Computer Engineering 19th Sept. 2017 10
OR Gate
OR Truth Table
X Y Z
X 0 0 0
Z
Y 0 1 1
1 0 1
X+Y=Z 1 1 1
Introduction to Computer Engineering 19th Sept. 2017 11
OR
• X|Y (Verilog)
• X#Y (ABEL)
• X or Y (VHDL)
• X+Y (textbook)
• XVY
• XUY
• or (Z,X,Y) (Verilog)
Introduction to Computer Engineering 19th Sept. 2017 12
NAND Gate
NAND Truth Table
X Y Z
X 0 0 1
Z 0 1 1
Y 1 0 1
1 1 0
Z = ~(X & Y)
nand (Z,X,Y)
Introduction to Computer Engineering 19th Sept. 2017 13
NAND Gate (contd.)
NOT-AND Truth Table
X Y W Z
X 0 0 0 1
W 0 1 0 1
Z
Y 1 0 0 1
1 1 1 0
W=X&Y
Z = ~W = ~(X & Y)
Introduction to Computer Engineering 19th Sept. 2017 14
NOR Gate
NOR Truth Table
X Y Z
X 0 0 1
Z 0 1 0
Y
1 0 0
Z = ~(X | Y) 1 1 0
nor(Z,X,Y)
Introduction to Computer Engineering 19th Sept. 2017 15
NOR Gate (contd.)
NOT-OR Truth Table
X Y W Z
X W 0 0 0 1
Z 0 1 1 0
Y
1 0 1 0
W=X|Y 1 1 1 0
Z = ~W = ~(X | Y)
Introduction to Computer Engineering 19th Sept. 2017 16
Revision
Introduction to Computer Engineering 19th Sept. 2017 17
Review of Boolean Algebra
• NOT is a horizontal bar above the number
0 =1
1 =0
• OR is a plus
0+0 = 0
0+1 = 1
1+0 = 1
1+1 = 1
• AND is multiplication
0*0 = 0
0*1 = 0
1*0 = 0
1*1 = 1
Introduction to Computer Engineering 19th Sept. 2017 18
Review of Boolean Algebra (contd.)
• Most Boolean identities have an AND (product)
form as well as an OR (sum) form. To give the
identities using both forms. The first group is rather
intuitive:
Identity Name AND Form OR Form
Identity Law 1x = x 0+x=x
Null Law 0x = x 1+x=1
Idempotent Law xx = x x+x=x
Inverse Law x x=0 x+ x =1
Introduction to Computer Engineering 19th Sept. 2017 19
Review of Boolean Algebra (contd.)
• The second group of Boolean identities should be
familiar from the study of algebra:
Identity Name AND Form OR Form
Commutative Law xy = yx x+y=y+x
Associative Law (xy) z = x (yz) (x + y) + z = x + (y + z)
Distributive Law x + yz = (x + y) (x + z) x (y + z) = xy + xz
Introduction to Computer Engineering 19th Sept. 2017 20
Review of Boolean Algebra (contd.)
• The last group of Boolean identities are perhaps the
most useful.
• These laws are also familiar to the set theory or formal
logic:
Identity Name AND Form OR Form
Absorption Law x (x + y) = x x + xy = x
DeMorgan’s Law ( xy ) = x + y (x + y) = x y
Double Complement Law x =x
Introduction to Computer Engineering 19th Sept. 2017 21
Review of Boolean Algebra (contd.)
• Sometimes it is more economical to build a circuit
using the complement of a function (and
complementing its result) than it is to implement
the function directly.
• DeMorgan’s law provides an easy way of finding
the complement of a Boolean function.
• Recall DeMorgan’s law states:
(xy) = x + y and x+y = x y
Introduction to Computer Engineering 19th Sept. 2017 22
Summary of Basic Logic Gates
x
• NOT x
x xy x xyz
• AND y y
z
x x+y x x+y+z
y
• OR y z
23
Introduction to Computer Engineering 19th Sept. 2017
Summary of Basic Logic Gates (contd.)
x xy
• NAND y
x x+y
• NOR y
x xÅy
• XOR y
24
Introduction to Computer Engineering 19th Sept. 2017
Review of Boolean Algebra Expression
• Example 1:
translate ( x + y + z)( x y z) to a Boolean logic
expression:
( xyz)(xyz)
• A boolean function cab ne defined as:
F(x,y) = (xy)(xy)
• A “truth table” can be presented as:
X Y F(x,y)
0 0 0
0 1 0
1 0 0
1 1 0
Introduction to Computer Engineering 19th Sept. 2017 25
Converting decimal numbers to
binary
• 53 = 32 + 16 + 4 + 1
= 25 + 24 + 22 + 20
= 1*25 + 1*24 + 0*23 + 1*22 + 0*21 + 1*20
= 110101 in binary
= 00110101 as a full byte in binary
• 211= 128 + 64 + 16 + 2 + 1
= 27 + 26 + 24 + 21 + 20
= 1*27 + 1*26 + 0*25 + 1*24 + 0*23 + 0*22 +
1*21 + 1*20
= 11010011 in binary
26
Introduction to Computer Engineering 19th Sept. 2017
Converting binary numbers to
decimal
• What is 10011010 in decimal?
10011010 = 1*27 + 0*26 + 0*25 + 1*24 + 1*23 +
0*22 + 1*21 + 0*20
= 27 + 24 + 23 + 21
= 128 + 16 + 8 + 2
= 154
• What is 00101001 in decimal?
00101001 = 0*27 + 0*26 + 1*25 + 0*24 + 1*23 +
0*22 + 0*21 + 1*20
= 25 + 23 + 20
= 32 + 8 + 1
= 41 27
Introduction to Computer Engineering 19th Sept. 2017
End
Introduction to Computer Engineering 19th Sept. 2017 28