Digi Ts Sir
Digi Ts Sir
&
Digital Logic
Overview
• Binary logic and Gates
• Boolean Algebra
– Basic Properties
– Algebraic Manipulation
• Standard and Canonical Forms
– Minterms and Maxterms (Canonical forms)
– SOP and POS (Standard forms)
• Karnaugh Maps (K-Maps)
– 2, 3, 4, and 5 variable maps
– Simplification using K-Maps
• K-Map Manipulation
– Implicants: Prime, Essential
– Don’t Cares
• More Logic Gates
Computers: ???
Binary Numbers
CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 4
What information do we
need to represent?
Numbers
Integers (234, 456)
Positive/negative value (-100, -23)
Floating point numbers ( 12.345,
3.14159)
Text
Characters (letters, digits, symbols)
Other
Graphics, Sound, Video, …
CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 5
Numbering Systems
We use the decimal numbering system
10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
For example: 12
Why use 10 digits (symbols)?
Roman: I (=1) V (=5) X (=10) L (=50),
C(=100)
XII = 12, Pentium III
What if we only had one symbol?
IIIII IIIII II = 12
What system do computers use?
CMPUT101 Introduction to Computing (c) Yngvi Bjornsson 6
The Binary Numbering
System
All computers use the binary numbering
system
Only two digits: 0, 1
For example: 10, 10001, 10110
Similar to decimal, except uses a different base
Binary (base-2): 0, 1
Decimal (base-10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
Octal (base-8): 0, 1, 2, 3, 4, 5, 6, 7
Hexadecimal (base-16):
• 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F (A=10, ...,
F=15)
22 21 20
101 1 0 1
1x4 + 0x2 + 1x1
4 + 0 +1 =5
0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
… 23 22 21 20 2-1 2-2 …
8 4 2 1 ½ ¼
4 + 1 + ½+ ¼ = 5.75
0 1 0 1 1 1
+ .10111 x 2+3
0 1 0 1 1 1 0 0 0 0 0 0 0 0 1 1
Mantissa (10 bits) Exponent (6 bits)
Assumed binary point
CMPUT101 Introduction to
(c) Yngvi Bjornsson 17
Computing
Representing Text
How can we represent text in a binary form?
Assign to each character a positive integer value
(for example, A is 65, B is 66, …)
Then we can store the numbers in their binary form!
The mapping of text to numbers Code
mapping
Need standard code mappings (why?):
ASCII (American Standard Code for Information
Interchange) => each letter 8-bits
• only 256 different characters can be represented (28)
Unicode => each letter 16-bits
CMPUT101 Introduction to
(c) Yngvi Bjornsson 18
Computing
ASCII Code mapping Table
Char Integer Binary Char Integer Binary
32 00100000 A 65 01000001
! 33 00100001 B 66 01000010
“ 34 00100010 C 67 01000011
… … … … … …
… … … … … …
CMPUT101 Introduction to
(c) Yngvi Bjornsson 19
Computing
Example of Representing
Text
Representing the word “Hello” in
ASCII
Look the value for each character up in the
table
(Convert
H decimal
e value
l to lbinary) o
72 101 108 108 111
01001000 01100101 01101100 01101100 01101111
CMPUT101 Introduction to
(c) Yngvi Bjornsson 20
Computing
Representing Other
Information
We need to represent other
information in a computer as well
Pictures ( BMP, JPEG, GIF, … )
Sound ( MP3, WAVE, MIDI, AU, … )
Video ( MPG, AVI, MP4, …)
Different formats, but all
represent the data in binary form!
CMPUT101 Introduction to
(c) Yngvi Bjornsson 21
Computing
Why do Computers Use
Binary Numbers?
Why not use the decimal systems,
like humans?
The main reason for using binary
numbers is:
Reliability
Why is that?
Electrical devices work best in a
bistable environment, that is, there are
only two separate states (e.g. on/off).
When using binary numbers, the
computers only need to represent two
digits: 0 and 1
CMPUT101 Introduction to
(c) Yngvi Bjornsson 22
Computing
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
1 0 0 1 0 1 0 1
1 1 1 1 1 1 1 0
2017.07.07 Boolean Algebra PJF - 27
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
A A
F G A H
B B
F = A•B G = A+B H = A’
1
F=A•B 0 Basic
Gate
Output 1 Assumption:
G=A+B 0 Zero time for
Signals
1 signals to
H=A’ 0 propagate
Through gates
2017.07.07 Boolean Algebra PJF - 30
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
C
A F
A F
C
B
A G
1. X +0 =X -- Zero Axiom
2. X •1 =X -- Unit Axiom
3. X +1 =1 -- Unit Property
4. X •0 =0 -- Zero Property
5. X + X = X -- Idepotence
6. X • X = X -- Idepotence
7. X + X’ = 1 -- Complement
8. X • X’ = 0 -- Complement
9. (X’)’ = X -- Involution
1 1 0 0 0 0
F3(x,y,z) are shown to the
right.
1 1 1 1 0 1
2017.07.07 Boolean Algebra PJF - 43
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.
2017.07.07 Boolean Algebra PJF - 44
Boolean expressions-NOT
unique
• Unlike truth tables, expressions x y z F G
representing a Boolean function
0 0 0 1 1
0 0 1 0 0
are NOT unique.
• Example:
– F(x,y,z) = x’•y’•z’ + x’•y•z’ + x•y•z’ 0 1 0 1 1
0 1 1 0 0
– G(x,y,z) = x’•y’•z’ + y•z’
1 0 0 0 0
• The corresponding truth tables for
F() and G() are to the right. They
are identical. 1 0 1 0 0
1 1 0 1 1
• Thus, F() = G()
0 1 1 x’yz = m3 x+y’+z’= M3
• Example:
1 0 0 xy’z’ = m4 x’+y+z = M4
Assume 3
1 0 1 xy’z = m5 x’+y+z’ =
variables x,y,z M5
(order is fixed) 1 1 0 xyz’ = m6 x’+y’+z =
M6
1 1 1
2017.07.07 Boolean Algebra
xyz = m7 x’+y’+z’ =
PJF - 54
Canonical Forms (Unique)
• Any Boolean function F( ) can be
expressed as a unique sum of
minterms and a unique product of
maxterms (under a fixed variable
ordering).
• In other words, every function F() has
two canonical forms:
– Canonical Sum-Of-Products (sum of
minterms)
– Canonical Product-Of-Sums (product of
maxterms)
2017.07.07 Boolean Algebra PJF - 55
Canonical Forms (cont.)
• Canonical Sum-Of-Products:
The minterms included are those mj
such that F( ) = 1 in row j of the truth
table for F( ).
• Canonical Product-Of-Sums:
The maxterms included are those Mj
such that F( ) = 0 in row j of the truth
table for F( ).
0 m0 m1 m3 m2
4 5 7 6
1 m4 m5 m7 m6
group of 4 terms
2017.07.07 Boolean Algebra PJF - 69
Simplification
• Enter minterms of the Boolean
function into the map, then group
terms
• Example: f(a,b,c) = a’c + abc + bc’
abc
• Result: f(a,b,c) = a’c+ b
1 1 1
1 1
1 1 1
1 1
2017.07.07 Boolean Algebra PJF - 70
More Examples
yz
X 00 01 11 10
• f1(x, y, z) = ∑ m(2,3,5,7) 0 1 1
f1(x, y, z) = x’y + xz
1 1 1
• f2(x, y, z) = ∑ m (0,1,2,3,6)
1 1 1 1
f2(x, y, z) = x’+yz’
1
00 01 11 10
WX
00 m0 m1 m3 m2
01 m4 m5 m7 m6
10 m8 m9 m11 m10
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
2017.07.07 Boolean Algebra PJF - 74
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
2017.07.07 Boolean Algebra PJF - 75
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).
X X F
F = ((X•Y)’)’
Y Y X•Y
= (X’+Y’)’
= X’’•Y’’
= X•Y
X X
F = (X’•Y’)’ F=
= X’’+Y’’ X+Y
Y Y
= X+Y
Two-level implementations
a) Original SOP
b) Implementation with NANDs
Verify:
(a) G = WXY + YZ
X Y F = X Y
XNOR: “equal” gate
0 0 1
X F 0 1 0
1 0 0
Y
1 1 1
2017.07.07 Boolean Algebra PJF - 98
Exclusive-OR (XOR) Function
• XOR (also ) : the “not-equal” function
• XOR(X,Y) = X Y = X’Y + XY’
• Identities:
– X 0=X
– X 1 = X’
– X X=0
– X X’ = 1
• Properties:
–XY=YX
– (X Y) W = X ( Y W)