2. LOGO
Contents
•2.1 Binary, Octal, Hexadecimal and their
interconversion
•2.2 1’s and 2’s complement.
•2.3 Binary Arithmetic. & Number Systems – BCD,
EBCDIC, ASCII, De-Morgan’s Theorem, Duality
Theorem, K-Map, Sum of product, Product of Sum,
Algebra Rules, Laws, Logic Circuits, NOT,AND, OR,
NAND, NOR, XOR, XNOR, Gated diagrams
3. LOGO
Data Representation
Information that a Computer is dealing with
* Data
- Numeric Data
Numbers( Integer, real)
- Non-numeric Data
Letters, Symbols
* Relationship between data elements
- Data Structures
Linear Lists, Trees, Rings, etc
* Program(Instruction)
4. LOGO
NUMERIC DATA REPRESENTATION
Data
Numeric data - numbers(integer, real)
Non-numeric data - symbols, letters
Number System
Nonpositional number system
- Roman number system
Positional number system
- Each digit position has a value called a weight
associated with it
- Decimal, Octal, Hexadecimal, Binary
Base (or radix) R number
- Uses R distinct symbols for each digit
- Example AR = an-1 an-2 ... a1 a0 .a-1…a-m
- V(AR ) =
1n
mi
i
i Ra
R = 10 Decimal number system, R = 2 Binary
R = 8 Octal, R = 16 Hexadecimal
Radix point(.) separates the integer
portion and the fractional portion
5. LOGOWHY POSITIONAL NUMBER SYSTEM IN DIGITAL
COMPUTERS ?
Major Consideration is the COST and TIME
- Cost of building hardware
Arithmetic and Logic Unit, CPU, Communications
- Time to processing
Arithmetic - Addition of Numbers - Table for Addition
* Non-positional Number System
- Table for addition is infinite
--> Impossible to build, very expensive even
if it can be built
* Positional Number System
- Table for Addition is finite
--> Physically realizable, but cost wise
the smaller the table size, the less
expensive --> Binary is favorable to Decimal
6. LOGO
S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
The decimal system (base 10)
The word decimal is derived from the Latin root decem
(ten). In this system the base b = 10 and we use ten
symbols
The symbols in this system are often referred to as
decimal digits or just digits.
8. LOGOExample 2.1
The following shows the place values for the integer +224
in the decimal system.
Note that the digit 2 in position 1 has the value 20, but the
same digit in position 2 has the value 200. Also note that
we normally drop the plus sign, but it is implicit.
9. LOGOExample 2.2
The following shows the place values for the decimal
number −7508. We have used 1, 10, 100, and 1000 instead
of powers of 10.
Note that the digit 2 in position 1 has the value 20, but the
same digit in position 2 has the value 200. Also note that
we normally drop the plus sign, but it is implicit.
( ) Values
11. LOGO
The word binary is derived from the Latin root bini (or
two by two). In this system the base b = 2 and we use
only two symbols,
The binary system (base 2)
S = {0, 1}
The symbols in this system are often referred to as
binary digits or bits (binary digit).
13. LOGOExample 2.4
The following shows that the number (11001)2 in binary is
the same as 25 in decimal. The subscript 2 shows that the
base is 2.
The equivalent decimal number is N = 16 + 8 + 0 + 0 + 1 =
25.
15. LOGO
The word hexadecimal is derived from the Greek root hex (six)
and the Latin root decem (ten). In this system the base
b = 16 and we use sixteen symbols to represent a number. The
set of symbols is
The hexadecimal system (base 16)
S = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F}
Note that the symbols A, B, C, D, E, F are equivalent to
10, 11, 12, 13, 14, and 15 respectively. The symbols in
this system are often referred to as hexadecimal digits.
17. LOGOExample 2.6
The following shows that the number (2AE)16 in
hexadecimal is equivalent to 686 in decimal.
The equivalent decimal number is N = 512 + 160 + 14 =
686.
18. LOGO
The word octal is derived from the Latin root octo
(eight). In this system the base b = 8 and we use eight
symbols to represent a number. The set of symbols is
The octal system (base 8)
S = {0, 1, 2, 3, 4, 5, 6, 7}
20. LOGOExample 2.7
The following shows that the number (1256)8 in octal is the
same as 686 in decimal.
Note that the decimal number is N = 512 + 128 + 40 + 6 =
686.
21. LOGO
Table 2.1 shows a summary of the four positional
number systems discussed in this chapter.
Summary of the four positional systems
22. LOGO
Table 2.2 shows how the number 0 to 15 is
represented in different systems.
26. LOGOExample 2.9
The following shows how to convert the hexadecimal
number (1A.23)16 to decimal.
Note that the result in the decimal notation is not exact,
because
3 × 16−2 = 0.01171875. We have rounded this value to
three digits (0.012).
27. LOGOExample 2.10
The following shows how to convert (23.17)8 to decimal.
This means that (23.17)8 ≈ 19.234 in decimal. Again, we
have rounded up 7 × 8−2 = 0.109375.
28. LOGO
Decimal to any base
Figure 2.6 Converting other bases to decimal (integral part)
30. LOGOExample 2.11
The following shows how to convert 35 in decimal to binary.
We start with the number in decimal, we move to the left
while continuously finding the quotients and the remainder
of division by 2. The result is 35 = (100011)2.
31. LOGOExample 2.12
The following shows how to convert 126 in decimal to its
equivalent in the octal system. We move to the right while
continuously finding the quotients and the remainder of
division by 8. The result is 126 = (176)8.
32. LOGOExample 2.13
The following shows how we convert 126 in decimal to its
equivalent in the hexadecimal system. We move to the right
while continuously finding the quotients and the remainder
of division by 16. The result is 126 = (7E)16
35. LOGOExample 2.14
Convert the decimal number 0.625 to binary.
Since the number 0.625 = (0.101)2 has no integral part, the
example shows how the fractional part is calculated.
36. LOGOExample 2.15
The following shows how to convert 0.634 to octal using a
maximum of four digits. The result is 0.634 = (0.5044)8.
Note that we multiple by 8 (base octal).
37. LOGOExample 2.16
The following shows how to convert 178.6 in decimal to
hexadecimal using only one digit to the right of the decimal
point. The result is 178.6 = (B2.9)16 Note that we divide or
multiple by 16 (base hexadecimal).
39. LOGOExample 2.19
Show the hexadecimal equivalent of the binary number
(110011100010)2.
Solution
We first arrange the binary number in 4-bit patterns:
100 1110
0010
Note that the leftmost pattern can have one to four bits. We
then use the equivalent of each pattern shown in Table 2.2
to change the number to hexadecimal: (4E2)16.
40. LOGOExample 2.20
What is the binary equivalent of (24C)16?
Solution
Each hexadecimal digit is converted to 4-bit patterns:
2 → 0010, 4 → 0100, and C →
1100
The result is (001001001100)2.
42. LOGOExample 2.21
Show the octal equivalent of the binary number
(101110010)2.
Solution
Each group of three bits is translated into one octal digit.
The equivalent of each 3-bit group is shown in Table 2.2
The result is (562)8.
101 110 010
43. LOGOExample 2.22
What is the binary equivalent of for (24)8?
Solution
Write each octal digit as its equivalent bit pattern to get
2 → 010 and 4 →
100
The result is (010100)2.
45. LOGOCOMPLEMENT OF NUMBERS
Two types of complements for base R number system:
- R's complement and (R-1)'s complement
The (R-1)'s Complement
Subtract each digit of a number from (R-1)
Example
- 9's complement of 83510 is 16410
- 1's complement of 10102 is 01012(bit by bit complement operation)
The R's Complement
Add 1 to the low-order digit of its (R-1)'s complement
Example
- 10's complement of 83510 is 16410 + 1 = 16510
- 2's complement of 10102 is 01012 + 1 = 01102
46. LOGOFIXED POINT NUMBERS
Binary Fixed-Point Representation
X = xnxn-1xn-2 ... x1x0. x-1x-2 ... x-m
Sign Bit(xn): 0 for positive - 1 for negative
Remaining Bits(xn-1xn-2 ... x1x0. x-1x-2 ... x-m)
Numbers: Fixed Point Numbers and Floating Point Numbers
47. LOGOSIGNED NUMBERS
Signed magnitude representation
Signed 1's complement representation
Signed 2's complement representation
Example: Represent +9 and -9 in 7 bit-binary number
Only one way to represent +9 ==> 0 001001
Three different ways to represent -9:
In signed-magnitude: 1 001001
In signed-1's complement: 1 110110
In signed-2's complement: 1 110111
In general, in computers, fixed point numbers are represented
either integer part only or fractional part only.
Need to be able to represent both positive and negative numbers
- Following 3 representations
48. LOGO
CHARACTERISTICS OF 3 DIFFERENT
REPRESENTATIONS
Complement
Signed magnitude: Complement only the sign bit
Signed 1's complement: Complement all the bits including sign bit
Signed 2's complement: Take the 2's complement of the
number,
49. LOGO
ARITHMETIC ADDITION:
SIGNED MAGNITUDE
[1] Compare their signs
[2] If two signs are the same ,
ADD the two magnitudes - Look out for an overflow
[3] If not the same , compare the relative magnitudes of the numbers and
then SUBTRACT the smaller from the larger --> need a subtractor to add
[4] Determine the sign of the result
6 0110
+) 9 1001
15 1111 -> 01111
9 1001
- ) 6 0110
3 0011 -> 00011
9 1001
-) 6 0110
- 3 0011 -> 10011
6 0110
+) 9 1001
-15 1111 -> 11111
6 + 9 -6 + 9
6 + (- 9) -6 + (-9)
Overflow 9 + 9 or (-9) + (-9)
9 1001
+) 9 1001
(1)0010overflow
50. LOGO
ARITHMETIC ADDITION:
SIGNED 2’s COMPLEMENT
Example
6 0 0110
9 0 1001
15 0 1111
-6 1 1010
9 0 1001
3 0 0011
6 0 0110
-9 1 0111
-3 1 1101
-9 1 0111
-9 1 0111
-18 (1)0 1110
Add the two numbers, including their sign bit, and discard any carry out of
leftmost (sign) bit - Look out for an overflow
overflow9 0 1001
9 0 1001+)
+) +)
+) +)
18 1 0010
2 operands have the same sign
and the result sign changes
xn-1yn-1s’n-1 + x’n-1y’n-1sn-1 = cn-1 cn
x’n-1y’n-1sn-1
(cn-1 cn)
xn-1yn s’n-1
(cn-1 cn)
51. LOGO
ARITHMETIC ADDITION:
SIGNED 1’s COMPLEMENT
Add the two numbers, including their sign bits.
- If there is a carry out of the most significant (sign) bit, the result is
incremented by 1
and the carry is discarded.
6 0 0110
-9 1 0110
-3 1 1100
-6 1 1001
9 0 1001
(1) 0(1)0010
1
3 0 0011
+) +)
+)
end-around carry
-9 1 0110
-9 1 0110
(1)0 1100
1
0 1101
+)
+)
9 0 1001
9 0 1001
1 (1)0010
+)
overflow
Example
not overflow (cn-1 cn) = 0
(cn-1 cn)
52. LOGOCOMPARISON OF REPRESENTATIONS
* Easiness of negative conversion
S + M > 1’s Complement > 2’s Complement
* Hardware
- S+M: Needs an adder and a subtractor for Addition
- 1’s and 2’s Complement: Need only an adder
* Speed of Arithmetic
2’s Complement > 1’s Complement(end-around C)
* Recognition of Zero
2’s Complement is fast
53. LOGO
ARITHMETIC SUBTRACTION
Take the complement of the subtrahend (including the sign bit)
and add it to the minuend including the sign bits.
( A ) - ( - B ) = ( A ) + B
( A ) - B = ( A ) + ( - B )
Arithmetic Subtraction in 2’s complement
54. LOGO
FLOATING POINT
NUMBER REPRESENTATION
* The location of the fractional point is not fixed to a certain location
* The range of the representable numbers is wide
F = EM
mn ekek-1 ... e0 mn-1mn-2 … m0 . m-1 … m-m
sign exponent mantissa
- Mantissa
Signed fixed point number, either an integer or a fractional number
- Exponent
Designates the position of the radix point
Decimal Value
V(F) = V(M) * RV(E) M: Mantissa
E: Exponent
R: Radix
55. LOGOFLOATING POINT NUMBERS
0 .1234567 0 04
sign sign
mantissa exponent
==> +.1234567 x 10+04
Example
A binary number +1001.11 in 16-bit floating point number representation
(6-bit exponent and 10-bit fractional mantissa)
0 0 00100 100111000
0 0 00101 010011100
Example
Note:
In Floating Point Number representation, only Mantissa(M) and
Exponent(E) are explicitly represented. The Radix(R) and the position
of the Radix Point are implied.
Exponent MantissaSign
or
56. LOGOCHARACTERISTICS OF FLOATING POINT
NUMBER REPRESENTATIONS
Normal Form
- There are many different floating point number representations of
the same number
→ Need for a unified representation in a given computer
- the most significant position of the mantissa contains a non-zero digit
Representation of Zero
- Zero
Mantissa = 0
- Real Zero
Mantissa = 0
Exponent
= smallest representable number
which is represented as
00 ... 0
Easily identified by the hardware
57. LOGO
INTERNAL REPRESENTATION AND
EXTERNAL REPRESENTATION
CPU
Memory
Internal
Representation Human
Device
Another
Computer
External
Representation
External
Representation
External
Representation
58. LOGOEXTERNAL REPRESENTATION
Decimal BCD Code
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
Numbers
Most of numbers stored in the computer are eventually changed
by some kinds of calculations
→ Internal Representation for calculation efficiency
→ Final results need to be converted to as External Representation
for presentability
Alphabets, Symbols, and some Numbers
Elements of these information do not change in the course of processing
→ No needs for Internal Representation since they are not used
for calculations
→ External Representation for processing and preventability
Example
Decimal Number: 4-bit Binary Code
BCD(Binary Coded Decimal)
59. LOGOOTHER DECIMAL CODES
Decimal BCD(8421) 2421 84-2-1 Excess-3
0 0000 0000 0000 0011
1 0001 0001 0111 0100
2 0010 0010 0110 0101
3 0011 0011 0101 0110
4 0100 0100 0100 0111
5 0101 1011 1011 1000
6 0110 1100 1010 1001
7 0111 1101 1001 1010
8 1000 1110 1000 1011
9 1001 1111 1111 1100 d3 d2 d1 d0: symbol in the codes
BCD: d3 x 8 + d2 x 4 + d1 x 2 + d0 x 1
8421 code.
2421: d3 x 2 + d2 x 4 + d1 x 2 + d0 x 1
84-2-1: d3 x 8 + d2 x 4 + d1 x (-2) + d0 x (-1)
Excess-3: BCD + 3
Note: 8,4,2,-2,1,-1 in this table is the weight
associated with each bit position.
BCD: It is difficult to obtain the 9's complement.
However, it is easily obtained with the other codes listed above.
→ Self-complementing codes
61. LOGOGRAY CODE - ANALYSIS
Letting gngn-1 ... g1 g0 be the (n+1)-bit Gray code
for the binary number bnbn-1 ... b1b0
gi = bi bi+1 , 0 i n-1
gn = bn
and
bn-i = gn gn-1 . . . gn-i
bn = gn
0 0 0 0 00 0 000
1 0 1 0 01 0 001
1 1 0 11 0 011
1 0 0 10 0 010
1 10 0 110
1 11 0 111
1 01 0 101
1 00 0 100
1 100
1 101
1 111
1 010
1 011
1 001
1 101
1 000
The Gray code has a reflection property
- easy to construct a table without calculation,
- for any n: reflect case n-1 about a
mirror at its bottom and prefix 0 and 1
to top and bottom halves, respectively
Reflection of Gray codes
Note:
62. LOGOGRAY CODE - APPLICATIONS
-Represent analog data with continuous change.
-- Gray code counters are used to provide the timing sequences that
control operations in digital sequence.
63. LOGO
CHARACTER REPRESENTATION
ASCII
ASCII (American Standard Code for Information Interchange) Code
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
NUL
SOH
STX
ETX
EOT
ENQ
ACK
BEL
BS
HT
LF
VT
FF
CR
SO
SI
SP
!
“
#
$
%
&
‘
(
)
*
+
,
-
.
/
0
1
2
3
4
5
6
7
8
9
:
;
<
=
>
?
@
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
[
]
m
n
‘
a
b
c
d
e
f
g
h
I
j
k
l
m
n
o
P
q
r
s
t
u
v
w
x
y
z
{
|
}
~
DEL
0 1 2 3 4 5 6 7
DLE
DC1
DC2
DC3
DC4
NAK
SYN
ETB
CAN
EM
SUB
ESC
FS
GS
RS
US
LSB
(4 bits)
MSB (3 bits)
64. LOGO
CONTROL CHARACTER
REPRESENTAION (ACSII)
NUL Null
SOH Start of Heading (CC)
STX Start of Text (CC)
ETX End of Text (CC)
EOT End of Transmission (CC)
ENQ Enquiry (CC)
ACK Acknowledge (CC)
BEL Bell
BS Backspace (FE)
HT Horizontal Tab. (FE)
LF Line Feed (FE)
VT Vertical Tab. (FE)
FF Form Feed (FE)
CR Carriage Return (FE)
SO Shift Out
SI Shift In
DLE Data Link Escape (CC)
(CC) Communication Control
(FE) Format Effector
(IS) Information Separator
DC1 Device Control 1
DC2 Device Control 2
DC3 Device Control 3
DC4 Device Control 4
NAK Negative Acknowledge (CC)
SYN Synchronous Idle (CC)
ETB End of Transmission Block (CC)
CAN Cancel
EM End of Medium
SUB Substitute
ESC Escape
FS File Separator (IS)
GS Group Separator (IS)
RS Record Separator (IS)
US Unit Separator (IS)
DEL Delete
65. LOGOERROR DETECTING CODES
Parity System
- Simplest method for error detection
- One parity bit attached to the information
- Even Parity and Odd Parity
Even Parity
- One bit is attached to the information so that
the total number of 1 bits is an even number
1011001 0
1010010 1
Odd Parity
- One bit is attached to the information so that
the total number of 1 bits is an odd number
1011001 1
1010010 0
66. LOGO
Parity Bit Generation
For b6b5... b0(7-bit information); even parity bit beven
beven = b6 b5 ... b0
For odd parity bit
bodd = beven 1 = beven
PARITY BIT GENERATION
68. LOGO
Boolean Algebra
Binary systems were known in the ancient Chinese civilisation and
by the classical Greek philosophers who created a well structured
binary system, called propositional logic.
Propositions may be TRUE or FALSE, and are stated as functions
of other propositions which are connected by the three basic logical
connectives: AND, OR, and NOT.
E.x.
“I will take an umbrella with me if it is raining or the weather forecast is
bad”
69. LOGO
“If I do not take the car then I will take the umbrella if it is raining or
the weather forecast is bad”
(Take Umbrella) = ( NOT (Take Car ) ) AND ( (Bad Forecast ) OR
(Raining ) )
71. LOGO
(A`)` = A
A .A` = 0
A + A` = 1
General rules like the distributive, commutative, and associative
rules hold for the AND and OR binary operators as follows.
Associative (A . B) . C = A . (B . C)
(A + B) + C = A + (B + C)
Commutative A . B = B . A
A + B = B + A
Distributive A . (B + C) = A . B + A . C
A + (B . C) = (A + B). (A + C)
There are three important groups of simplification rules. The first
one uses just one variable:
A . A = A
A + A = A
72. LOGO
The second group uses Boolean constants 0 and 1:
A .0 = 0
A .1 = A
A + 0 = A
A + 1 = 1
The third group involves two or more variables and contains a large
number of possible simplification rules (or theorems) such as:
A + A (B) = A
proof:
A + A . B = A . (1 + B)
= A . 1
= A
73. LOGO
There are two important rules which constitute de Morgan’s theorem:
(A + B)’ = A’ . B’
(A B)`= A` + B`
This theorem is widely used in Boolean logic design. The theorem
holds for any number of terms, so:
(A + B + C)` = ((A + B) + C)` = ((A + B)`) C` = A`. B`. C`
and similarly:
(A .B. C. .......... X)` = A` + B` + C` + ............ + X`
You may have noticed by now that rules are often given in pairs. It
makes sense that in a binary system there is
some kind of symmetry between the two operators. For Boolean
algebra this symmetry is called duality.
Every equation has its dual which one can generate by replacing the
AND operators with ORs (and vice versa) and the constants 0 with 1s
(and vice versa).
74. LOGO
the dual equation of the important simplifying rule:
A + A. B = A
is:
A .(A + B) = A (proof: A . A + A . B = A + A . B = A )
Do not mix up or get confused between a dual expression which is
generated by the above rules and the complement
(or inverted) expression which is generated by applying the NOT
operator. The rules are similar, but they mean very different things.
Finally, let us simplify the proposition I am not taking an umbrella.
(U)` = (C`. (W + R))`
apply de Morgan’s theorem U0 = (C`)` + (W + R)`
apply de Morgan’s theorem again U`= (C`)` +W`. R`
and simplify U` = C +W`. R`
75. LOGOTheorem: Absorption Law
For every pair of elements a , b B,
1. a + a · b = a
2. a · ( a + b ) = a
Proof:
(1)
abaaba 1
ba 1
1 ba
1 a
a
Identity
Commutativity
Distributivity
Identity
Theorem: For any a B,
a + 1 = 1
(2) duality.
76. LOGO
Theorem: Associative Law
In a Boolean algebra, each of the binary operations ( + )
and ( · ) is associative. That is, for every a , b , c B,
1. a + ( b + c ) = ( a + b ) + c
2. a · ( b · c ) = ( a · b ) · c
77. LOGO
cbacbaA
cbcbaacbaA Distributivity
cbaaacba
acabaa
aca
a
acbaa
Commutativity
Distributivity
Distributivity
Absorption Law
Absorption Law
acaba Idempotent Law
Proof:
(1) Let
81. LOGO
Theorem 11: DeMorgan’s Law
For every pair of elements a , b B,
1. ( a + b )’ = a’· b’
2. ( a · b )’= a’+ b’
Proof:
(1) We first prove that (a+b) is the complement of a’·b’.
Thus, (a+b)’= a’·b’
By the definition of the complement and its uniqueness, it suffices to
show: (i) (a+b)+(a’b’) = 1 and
(ii) (a+b)(a’b’) = 0.
(2) Duality (a·b)’= a’+b’
82. LOGO
bbaabababa
bbaaab
bbaaab
11 ab
11
1
Distributivity
Commutativity
Associativity
a’and b’are the complements of a
and b respectively
Theorem: For any a B,
a + 1 = 1
Idempotent Law
83. LOGO
babababa
bbaaba
bbaaab
bbaaab
bbaaab
00 ab
00
0
Commutativity
Distributivity
Commutativity
Associativity
Commutativity
a’and b’are the complements of a
and b respectively
Theorem: For any a B,
a · 0 = 0
Idempotent Law
84. LOGOMinimization of Boolean expressions
The minimization will result in reduction of the number of
gates (resulting from less number of terms) and the
number of inputs per gate (resulting from less number of
variables per term)
The minimization will reduce cost, efficiency and power
consumption.
y(x+x`)=y.1=y
y+xx`=y+0=y
(x`y+xy`)=xy
(x`y`+xy)=(xy)`
85. LOGO
Binary Logic and Gates
Binary variables take on one of two values.
Logical operators operate on binary values
and binary variables.
Basic logical operators are the logic
functions AND, OR and NOT.
Logic gates implement logic functions.
Boolean Algebra: a useful mathematical
system for specifying and transforming
logic functions.
We study Boolean algebra as a foundation
for designing and analyzing digital
systems!
86. LOGO
Binary Variables
Recall that the two binary values have different names:
True/False
On/Off
Yes/No
1/0
We use 1 and 0 to denote the two values.
Variable identifier examples:
A, B, y, z, or X1 for now
RESET, START_IT, or ADD1 later
87. LOGO
Logical Operations
The three basic logical operations are:
AND
OR
NOT
AND is denoted by a dot (·).
OR is denoted by a plus (+).
NOT is denoted by an overbar ( ¯ ), a single quote mark (')
after, or (~) before the variable.
88. LOGO
Examples:
is read “Y is equal to A AND B.”
is read “z is equal to x OR y.”
is read “X is equal to NOT A.”
Notation Examples
Note: The statement:
1 + 1 = 2 (read “one plus one equals two”)
is not the same as
1 + 1 = 1 (read “1 or 1 equals 1”).
BAY .
yxz
AX
89. LOGO
Operator Definitions
Operations are defined on the
values "0" and "1" for each
operator:
AND
0 · 0 = 0
0 · 1 = 0
1 · 0 = 0
1 · 1 = 1
OR
0 + 0 = 0
0 + 1 = 1
1 + 0 = 1
1 + 1 = 1
NOT
10
01
90. LOGO
01
10
X
NOT
XZ
Truth Tables
Tabular listing of the values of a function for all possible
combinations of values on its arguments
Example: Truth tables for the basic logic operations:
111
001
010
000
Z = X·YYX
AND OR
X Y Z = X+Y
0 0 0
0 1 1
1 0 1
1 1 1
91. LOGO
Truth Tables – Cont’d
Used to evaluate any logic function
Consider F(X, Y, Z) = X Y + Y Z
X Y Z X Y Y Y Z F = X Y + Y Z
0 0 0 0 1 0 0
0 0 1 0 1 1 1
0 1 0 0 0 0 0
0 1 1 0 0 0 0
1 0 0 0 1 0 0
1 0 1 0 1 1 1
1 1 0 1 0 0 1
1 1 1 1 0 0 1
92. LOGO
Using Switches
Inputs:
logic 1 is switch closed
logic 0 is switch open
Outputs:
logic 1 is light on
logic 0 is light off.
NOT input:
logic 1 is switch open
logic 0 is switch closed
Logic Function Implementation
Switches in series => AND
Switches in parallel => OR
C
Normally-closed switch => NOT
93. LOGO
Example: Logic Using Switches
Light is on (L = 1) for
L(A, B, C, D) =
and off (L = 0), otherwise.
Useful model for relay and CMOS gate
circuits, the foundation of current digital
logic circuits
Logic Function Implementation – cont’d
B
A
D
C
A (B C + D) = A B C + A D
94. LOGO
Logic Gates
In the earliest computers, switches were opened
and closed by magnetic fields produced by
energizing coils in relays. The switches in turn
opened and closed the current paths.
Later, vacuum tubes that open and close current
paths electronically replaced relays.
Today, transistors are used as electronic
switches that open and close current paths.
95. LOGO
Logic Gate Symbols and Behavior
Logic gates have special symbols:
And waveform behavior in time as follows:
X 0 0 1 1
Y 0 1 0 1
X · Y(AND) 0 0 0 1
X + Y(OR) 0 1 1 1
(NOT) X 1 1 0 0
OR gate
X
Y
Z = X + Y
X
Y
Z = X · Y
AND gate
X Z = X
NOT gate or
inverter
96. LOGO
Logic Diagrams and Expressions
Boolean equations, truth tables and logic diagrams describe the
same function!
Truth tables are unique, but expressions and logic diagrams are
not. This gives flexibility in implementing functions.
X
Y F
Z
Logic Diagram
Logic Equation
ZYXF
Truth Table
11 1 1
11 1 0
11 0 1
11 0 0
00 1 1
00 1 0
10 0 1
00 0 0
X Y Z ZYXF ×
97. LOGO
1.
3.
5.
7.
9.
11.
13.
15.
17.
Commutative
Associative
Distributive
DeMorgan’s
2.
4.
6.
8.
X . 1 X=
X . 0 0=
X . X X=
0=X . X
Boolean Algebra
10.
12.
14.
16.
X + Y Y + X=
(X + Y) Z+ X + (Y Z)+=
X(Y + Z) XY XZ+=
X + Y X . Y=
XY YX=
(XY) Z X(Y Z)=
X + YZ (X + Y) (X + Z)=
X . Y X + Y=
X + 0 X=
+X 1 1=
X + X X=
1=X + X
X = X
Invented by George Boole in 1854
An algebraic structure defined by a set B = {0, 1}, together with two
binary operators (+ and ·) and a unary operator ( )
Idempotence
Complement
Involution
Identity element
98. LOGO
Some Properties of Boolean Algebra
Boolean Algebra is defined in general by a set B that can
have more than two values
A two-valued Boolean algebra is also know as Switching
Algebra. The Boolean set B is restricted to 0 and 1. Switching
circuits can be represented by this algebra.
The dual of an algebraic expression is obtained by
interchanging + and · and interchanging 0’s and 1’s.
The identities appear in dual pairs. When there is only one
identity on a line the identity is self-dual, i. e., the dual
expression = the original expression.
Sometimes, the dot symbol ‘’ (AND operator) is not written
when the meaning is clear
99. LOGO
Boolean Algebraic Proof – Example 1
A + A · B = A (Absorption Theorem)
Proof Steps Justification
A + A · B
= A · 1 + A · B Identity element: A · 1 = A
= A · ( 1 + B) Distributive
= A · 1 1 + B = 1
= A Identity element
Our primary reason for doing proofs is to learn:
Careful and efficient use of the identities and
theorems of Boolean algebra, and
How to choose the appropriate identity or theorem to
apply to make forward progress, irrespective of the
application.
100. LOGO
AB + AC + BC = AB + AC (Consensus Theorem)
Proof Steps Justification
= AB + AC + BC
= AB + AC + 1 · BC Identity element
= AB + AC + (A + A) · BC Complement
= AB + AC + ABC + ABC Distributive
= AB + ABC + AC + ACB Commutative
= AB · 1 + ABC + AC · 1 + ACB Identity element
= AB (1+C) + AC (1 + B) Distributive
= AB . 1 + AC . 1 1+X = 1
= AB + AC Identity element
Boolean Algebraic Proof – Example 2
102. LOGO
Truth Table to Verify DeMorgan’s
X Y X·Y X+Y X Y X+Y X · Y X·Y X+Y
0 0 0 0 1 1 1 1 1 1
0 1 0 1 1 0 0 0 1 1
1 0 0 1 0 1 0 0 1 1
1 1 1 1 0 0 0 0 0 0
X + Y = X · Y X · Y = X + Y
Generalized DeMorgan’s Theorem:
X1 + X2 + … + Xn = X1 · X2 · … · Xn
X1 · X2 · … · Xn = X1 + X2 + … + Xn
103. LOGO
Next … Canonical Forms
Minterms and Maxterms
Sum-of-Minterm (SOM) Canonical Form
Product-of-Maxterm (POM) Canonical Form
Representation of Complements of Functions
Conversions between Representations
104. LOGO
Minterms
Minterms are AND terms with every variable present in
either true or complemented form.
Given that each binary variable may appear normal
(e.g., x) or complemented (e.g., x ), there are 2n
minterms for n variables.
Example: Two variables (X and Y) produce
2 x 2 = 4 combinations:
(both normal)
(X normal, Y complemented)
(X complemented, Y normal)
(both complemented)
Thus there are four minterms of two variables.
YX
XY
YX
YX
105. LOGO
Maxterms
Maxterms are OR terms with every variable
in true or complemented form.
Given that each binary variable may appear
normal (e.g., x) or complemented (e.g., x),
there are 2n maxterms for n variables.
Example: Two variables (X and Y) produce
2 x 2 = 4 combinations:
(both normal)
(x normal, y complemented)
(x complemented, y normal)
(both complemented)
YX
YX
YX
YX
106. LOGO
Two variable minterms and maxterms.
The minterm mi should evaluate to 1 for
each combination of x and y.
The maxterm is the complement of the
minterm
Minterms & Maxterms for 2 variables
x y Index Minterm Maxterm
0 0 0 m0 = x y M0 = x + y
0 1 1 m1 = x y M1 = x + y
1 0 2 m2 = x y M2 = x + y
1 1 3 m3 = x y M3 = x + y
107. LOGO
Minterms & Maxterms for 3 variables
M3 = x + y + zm3 = x y z3110
M4 = x + y + zm4 = x y z4001
M5 = x + y + zm5 = x y z5101
M6 = x + y + zm6 = x y z6011
1
1
0
0
y
1
0
0
0
x
1
0
1
0
z
M7 = x + y + zm7 = x y z7
M2 = x + y + zm2 = x y z2
M1 = x + y + zm1 = x y z1
M0 = x + y + zm0 = x y z0
MaxtermMintermIndex
Maxterm Mi is the complement of minterm mi
Mi = mi and mi = Mi
108. LOGO
Purpose of the Index
Minterms and Maxterms are designated with an
index
The index number corresponds to a binary pattern
The index for the minterm or maxterm, expressed
as a binary number, is used to determine whether
the variable is shown in the true or complemented
form
For Minterms:
‘1’ means the variable is “Not Complemented” and
‘0’ means the variable is “Complemented”.
For Maxterms:
‘0’ means the variable is “Not Complemented” and
‘1’ means the variable is “Complemented”.
109. LOGO
Sum-Of-Minterm (SOM)
Sum-Of-Minterm (SOM) canonical form:
Sum of minterms of entries that evaluate to ‘1’
x y z F Minterm
0 0 0 0
0 0 1 1 m1 = x y z
0 1 0 0
0 1 1 0
1 0 0 0
1 0 1 0
1 1 0 1 m6 = x y z
1 1 1 1 m7 = x y z
F = m1 + m6 + m7 = ∑ (1, 6, 7) = x y z + x y z + x
y z
Focus on
the ‘1’
entries
113. LOGO
Observations
We can implement any function by "ORing" the minterms
corresponding to the ‘1’ entries in the function table. A minterm
evaluates to ‘1’ for its corresponding entry.
We can implement any function by "ANDing" the maxterms
corresponding to ‘0’ entries in the function table. A maxterm
evaluates to ‘0’ for its corresponding entry.
The same Boolean function can be expressed in two canonical
ways: Sum-of-Minterms (SOM) and Product-of-Maxterms (POM).
If a Boolean function has fewer ‘1’ entries then the SOM canonical
form will contain fewer literals than POM. However, if it has fewer
‘0’ entries then the POM form will have fewer literals than SOM.
115. LOGO
Converting to Product-of-Maxterms Form
A function that is not in the Product-of-Minterms form can
be converted to that form by means of a truth table
Consider again: F = y + x z
x y z F Minterm
0 0 0 1
0 0 1 1
0 1 0 1
0 1 1 0 M3 = (x+y+z)
1 0 0 1
1 0 1 1
1 1 0 0 M6 = (x+y+z)
1 1 1 0 M7 = (x+y+z)
F = ∏(3, 6, 7) =
M3 · M6 · M7 =
(x+y+z) (x+y+z) (x+y+z)
116. LOGO
Conversions Between Canonical Forms
F = m1+m2+m3+m5+m7 = ∑(1, 2, 3, 5, 7) =
x y z + x y z + x y z + x y z + x y z
F = M0 · M4 · M6 = ∏(0, 4, 6) =
(x+y+z)(x+y+z)(x+y+z)
x y z F Minterm Maxterm
0 0 0 0 M0 = (x + y + z)
0 0 1 1 m1 = x y z
0 1 0 1 m2 = x y z
0 1 1 1 m3 = x y z
1 0 0 0 M4 = (x + y + z)
1 0 1 1 m5 = x y z
1 1 0 0 M6 = (x + y + z)
1 1 1 1 m7 = x y z
117. LOGO
Algebraic Conversion to Sum-of-Minterms
Expand all terms first to explicitly list all
minterms
AND any term missing a variable v with (v + v)
Example 1: f = x + x y (2 variables)
f = x (y + y) + x y
f = x y + x y + x y
f = m3 + m2 + m0 = ∑(0, 2, 3)
Example 2: g = a + b c (3 variables)
g = a (b + b)(c + c) + (a + a) b c
g = a b c + a b c + a b c + a b c + a b c + a b c
g = a b c + a b c + a b c + a b c + a b c
g = m1 + m4 + m5 + m6 + m7 = ∑ (1, 4, 5, 6, 7)
118. LOGOAlgebraic Conversion to Product-of-
Maxterms
Expand all terms first to explicitly list all
maxterms
OR any term missing a variable v with v · v
Example 1: f = x + x y (2
variables)
Apply 2nd distributive law:
f = (x + x) (x + y) = 1 · (x + y) = (x + y) = M1
Example 2: g = a c + b c + a b (3 variables)
g = (a c + b c + a) (a c + b c + b)(distributive)
g = (c + b c + a) (a c + c + b) (x + x y =
x + y)
119. LOGOFunction Complements
The complement of a function expressed
as a sum of minterms is constructed by
selecting the minterms missing in the
sum-of-minterms canonical form
Alternatively, the complement of a
function expressed by a Sum of Minterms
form is simply the Product of Maxterms
with the same indices
Example: Given F(x, y, z) = ∑ (1, 3, 5, 7)
F(x, y, z) = ∑ (0, 2, 4, 6)
F(x, y, z) = ∏ (1, 3, 5, 7)
120. LOGOSummary of Minterms and
Maxterms
There are 2n minterms and maxterms for Boolean
functions with n variables.
Minterms and maxterms are indexed from 0 to 2n
– 1
Any Boolean function can be expressed as a
logical sum of minterms and as a logical product
of maxterms
The complement of a function contains those
minterms not included in the original function
The complement of a sum-of-minterms is a
product-of-maxterms with the same indices
121. LOGO
Standard Sum-of-Products (SOP) form:
equations are written as an OR of AND terms
Standard Product-of-Sums (POS) form:
equations are written as an AND of OR terms
Examples:
SOP:
POS:
These “mixed” forms are neither SOP nor
POS
Standard Forms
BCBACBA
C·)CB(A·B)(A
C)(AC)B(A
B)(ACACBA
122. LOGOStandard Sum-of-Products (SOP)
A sum of minterms form for n variables can be written down
directly from a truth table.
Implementation of this form is a two-level network of gates such
that:
The first level consists of n-input AND gates
The second level is a single OR gate
This form often can be simplified so that the corresponding
circuit is simpler.
123. LOGO
A Simplification Example:
Writing the minterm expression:
F = A B C + A B C + A B C + ABC + ABC
Simplifying:
F = A B C + A (B C + B C + B C + B C)
F = A B C + A (B (C + C) + B (C + C))
F = A B C + A (B + B)
F = A B C + A
F = B C + A
Simplified F contains 3 literals compared to
15
Standard Sum-of-Products (SOP)
)7,6,5,4,1()C,B,A(F S
125. LOGO
SOP and POS Observations
The previous examples show that:
Canonical Forms (Sum-of-minterms, Product-of-
Maxterms), or other standard forms (SOP, POS) differ
in complexity
Boolean algebra can be used to manipulate equations
into simpler forms
Simpler equations lead to simpler implementations
Questions:
How can we attain a “simplest” expression?
Is there only one minimum cost circuit?
The next part will deal with these issues
127. LOGO
Minimization of Boolean
expressions
The minimization will result in reduction of the number of
gates (resulting from less number of terms) and the
number of inputs per gate (resulting from less number of
variables per term)
The minimization will reduce cost, efficiency and power
consumption.
y(x+x`)=y.1=y
y+xx`=y+0=y
(x`y+xy`)=xy
(x`y`+xy)=(xy)`
128. LOGO
Minimum SOP and POS
The minimum sum of products (MSOP) of a function, f, is a SOP
representation of f that contains the fewest number of product terms
and fewest number of literals of any SOP representation of f.
129. LOGO
Minimum SOP and POS
f= (xyz +x`yz+ xy`z+ …..)
Is called sum of products.
The + is sum operator which is an OR gate.
The product such as xy is an AND gate for the two inputs x and y.
130. LOGO
Example Minimize the following Boolean function
using sum of products (SOP):
f(a,b,c,d) = m(3,7,11,12,13,14,15)
abcd
3 0011
7 0111
11 1011
12 1100
13 1101
14 1110
15 1111
a`b`cd
a`bcd
ab`cd
abc`d`
abc`d
abcd`
abcd
132. LOGO
Minimum product of sums (MPOS)
The minimum product of sums (MPOS) of a function, f, is a POS
representation of f that contains the fewest number of sum terms and
the fewest number of literals of any POS representation of f.
The zeros are considered exactly the same as ones in the case of sum
of product (SOP)
134. LOGO
Karnaugh Maps (K-maps)
Karnaugh maps -- A tool for representing Boolean functions of up to
six variables.
K-maps are tables of rows and columns with entries represent 1`s or
0`s of SOP and POS representations.
135. LOGO
Karnaugh Maps (K-maps)
An n-variable K-map has 2n
cells with each cell
corresponding to an n-variable truth table value.
K-map cells are labeled with the corresponding
truth-table row.
K-map cells are arranged such that adjacent
cells correspond to truth rows that differ in only
one bit position (logical adjacency).
136. LOGO
Karnaugh Maps (K-maps)
If mi is a minterm of f, then place a 1 in cell i of the K-map.
If Mi is a maxterm of f, then place a 0 in cell i.
If di is a don’t care of f, then place a d or x in cell i.
138. LOGO
Three variable map
f(A,B,C) =
m(0,3,5)=
A`B`C`+A`BC+AB`C
1
1
A`BC
1
AB`C
A`B`
0 0
A`B
0 1
A B
1 1
A B`
1 0
C`
0
C
1
A`B`C`
139. LOGO
Maxterm example
f(A,B,C) = M(1,2,4,6,7)
=(A+B+C`)(A+B`+C)(A`+B+C) )(A`+B`+C) (A`+B`+C`)
Note that the complements are (0,3,5) which are the minterms
of the previous example
0 0 0
0 0
A`B` A`B AB AB`
C`
C
(A+B) (A+B`) (A`+B`) (A`+B)
C
C`
140. LOGO
Four variable example
(a) Minterm form. (b) Maxterm form.
f(a,b,Q,G) = m(0,3,5,7,10,11,12,13,14,15) = M(1,2,4,6,8,9)
141. LOGOSimplification of Boolean Functions
Using K-maps
K-map cells that are physically adjacent are also
logically adjacent. Also, cells on an edge of a K-map are
logically adjacent to cells on the opposite edge of the
map.
If two logically adjacent cells both contain logical 1s, the
two cells can be combined to eliminate the variable that
has value 1 in one cell’s label and value 0 in the other.
142. LOGOSimplification of Boolean Functions
Using K-maps
This is equivalent to the algebraic operation, aP + a P =P where P
is a product term not containing a or a.
A group of cells can be combined only if all cells in the group have
the same value for some set of variables.
143. LOGO
Simplification Guidelines for K-maps
Always combine as many cells in a group as
possible. This will result in the fewest number of
literals in the term that represents the group.
Make as few groupings as possible to cover all
minterms. This will result in the fewest product
terms.
Always begin with the largest group, which
means if you can find eight members group is
better than two four groups and one four group is
better than pair of two-group.
144. LOGOExample
Simplify f= A`BC`+ A B C`+ A B C using;
(a) Sum of minterms. (b) Maxterms.
C
AB
00 01 11 10
0 2 6 4
1 3 7 5
0
1
B
0
0C
A
C
AB
00 01 11 10
0 2 6 4
1 3 7 5
0
1C
A
B
(b) (c)
Universal set
BC
A
B AB
AB
C
BC
1 1
1 0
0
(a)
0
a- f(A,B,C) = AB + BC b- f(A,B,C) = B(A + C)
F`= B`+ A`C F = B(A+C`)
Each cell of an n-variable K-map has n logically
adjacent cells.
145. LOGO
Example Simplify
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
A
C
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
1
A
C
1 1
(a) (b)
1
1
1
1 1
1 1
1 1
1 1
1 1 1
1
1 1
11 1
1
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
A
C
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
1
A
C
1 1
(c) (d)
1
1
1
1 1
1 1
1 1
1 1
1 1 1
1
1 1
11 1
1
f(A,B,C,D) = m(2,3,4,5,7,8,10,13,15)
146. LOGO
Example Multiple selections
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
A
C
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
1
A
C
1 1
(a) (b)
1
1
1
1 1
1 1
1 1
1 1
1 1 1
1
1 1
11 1
1
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
A
C
1 1
1 1
1 1
1 1
1
(c)
f(A,B,C,D) = m(2,3,4,5,7,8,10,13,15)
c produces less terms than a
147. LOGO
Example Redundant selections
f(A,B,C,D) = m(0,5,7,8,10,12,14,15)
1
1 1
1
1 11
1
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
A
C
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
A
C
(a) (b)
1
1 1
1
1
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
A
C
CD
AB
00 01 11 10
0 4 12 8
1 5 13 9
3 7 15 11
2 6 14 10
00
01
11
10
B
D
A
C
1
(c) (d)
1
1
1
1 1
1
1
1 11
1
1
1 1
1
1 11
1
1
1 1
1
1 11
1
152. LOGODifferent styles of drawing maps
f(A,B,C) = m(1,2,3,6) = AC + BC
1
C
AB
00 01 11 10
0 2 6 4
3 7 5
0
1
B
1 1
1 1
A
C
BC
A 00 01 11 10
0
1
1 1 1
1
1
1 1
1
C
AB
0 1
00
01
11
10
153. LOGO
•Minterms that may produce either 0 or 1 for the function.
•They are marked with an ´ in the K-map.
•This happens, for example, when we don’t input certain minterms
to the Boolean function.
•These don’t-care conditions can be used to provide further
simplification of the algebraic expression.
(Example) F = A`B`C`+A`BC` + ABC`
d=A`B`C +A`BC + AB`C
F = A` + BC`
Don’t-care condition
154. LOGO
Five variable K-maps
Use Two Four-variable K-Maps
bc
de 00 01 11 10
00
01
11
10
bc
de 00 01 11 10
00
01
11
10
a`=0 map a=1 map
1
1
1
1
1
1
1
1
1 1
f(a,b,c,d,e) = m(0,5,7,13,15,16,21,23,29,31)
a` f
0 1
1
2
3
4
5 1
6
7 1
8
9
10
11
12
13 1
14
15 1
a f
16 1
17
18
19
20
21 1
22
23 1
24
25
26
27
28
29 1
30
31 1