2. UNIT – I Number System and Boolean
algebra And Switching Functions: Review of
number systems, Complements of Numbers,
Codes- Binary Codes, Binary Coded Decimal
Code and its Properties, Unit Distance Codes,
Error Detecting and Correcting Codes.
Boolean Algebra: Basic Theorems and
Properties, Switching Functions, Canonical
and Standard Form, Algebraic Simplification
of Digital Logic Gates, Properties of XOR
Gates, Universal Gates, Multilevel NAND/NOR
realizations.
GNIT ECE 2
3. 1.1 Review of number systems
1.2 Complements of Numbers
1.3 Codes- Binary Codes
1.4 Binary Coded Decimal Code and its Properties
1.5 Unit Distance Codes
1.6 Error Detecting and Correcting Codes
1.7 Boolean Algebra: Basic Theorems and Properties
1.8 Switching Functions
1.9 Canonical and Standard Form
1.10 Algebraic Simplification of Digital Logic Gates
1.11 Properties of XOR Gates
1.12 Universal Gates
1.13 Multilevel NAND/NOR realizations
GNIT ECE 3
4. Base (also called radix) = 10
10 digits { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
Digit Position
Integer & fraction
Digit Weight
Weight = (Base) Position
Magnitude
Sum of “Digit x Weight”
Formal Notation
d2*B
2
+d1*B
1
+d0*B
0
+d-1*B
-1
+d-2*B
-2
GNIT ECE 4
5. Base = 2
2 digits { 0, 1 }, called binary digits or “bits”
Weights
Weight = (Base)
Position
Magnitude
Sum of “Bit x Weight”
Formal Notation
Groups of bits 4 bits = Nibble
8 bits = Byte
1 0 -1
2 -2
2 1 1/2
4 1/4
1 0 1 0 1
1 *22
+0 *21
+1 *20
+0 *2-1
+1 *2-
2
=(5.25)10
(101.01)2
1 0 1 1
1 1 0 0 0 1 0 1
GNIT ECE 5
21. There are two types of complements for each base-r system: the radix
complement and diminished radix complement.
Diminished Radix Complement - (r-1)’s Complement
Given a number N in base r having n digits, the (r–1)’s
complement of N is defined as:
(rn –1) – N
Example for 6-digit decimal numbers:
9’s complement is (rn – 1)–N = (106–1)–N = 999999–N
9’s complement of 546700 is 999999–546700 = 453299
Example for 7-digit binary numbers:
1’s complement is (rn – 1) – N = (27–1)–N = 1111111–N
1’s complement of 1011000 is 1111111–1011000 = 0100111
Observation:
Subtraction from (rn – 1) will never require a borrow
Diminished radix complement can be computed digit-by-digit
For binary: 1 – 0 = 1 and 1 – 1 = 0
GNIT ECE 21
22. 1’s Complement (Diminished Radix Complement)
All ‘0’s become ‘1’s
All ‘1’s become ‘0’s
Example (10110000)2
(01001111)2
If you add a number and its 1’s complement …
1 0 1 1 0 0 0 0
+ 0 1 0 0 1 1 1 1
1 1 1 1 1 1 1 1
GNIT ECE 22
23. Radix Complement
Example: Base-10
Example: Base-2
The r's complement of an n-digit number N in base r is defined as
rn – N for N ≠ 0 and as 0 for N = 0. Comparing with the (r 1) 's
complement, we note that the r's complement is obtained by adding 1 to
the (r 1) 's complement, since rn – N = [(rn 1) – N] + 1.
The 10's complement of 012398 is 987602
The 10's complement of 246700 is 753300
The 2's complement of 1101100 is 0010100
The 2's complement of 0110111 is 1001001
GNIT ECE 23
24. 2’s Complement (Radix Complement)
Take 1’s complement then add 1
Toggle all bits to the left of the first ‘1’ from the right
Example:
Number:
1’s Comp.:
0 1 0 1 0 0 0 0
1 0 1 1 0 0 0 0
0 1 0 0 1 1 1 1
+ 1
OR
1 0 1 1 0 0 0 0
0
0
0
0
1
0
1
0
GNIT ECE 24
25. Subtraction with Complements
The subtraction of two n-digit unsigned numbers
M – N in base r can be done as follows:
GNIT ECE 25
26. Example 1.5
Using 10's complement, subtract 72532 – 3250.
Example 1.6
Using 10's complement, subtract 3250 – 72532.
There is no end carry.
Therefore, the answer is – (10's complement of 30718) = 69282.
GNIT ECE 26
27. Example 1.7
Given the two binary numbers X = 1010100 and Y
= 1000011, perform the subtraction (a) X – Y ;
and (b) Y X, by using 2's complement.
There is no end carry.
Therefore, the answer is
Y – X = (2's complement
of 1101111) = 0010001.
GNIT ECE 27
28. Subtraction of unsigned numbers can also be done by means of the (r
1)'s complement. Remember that the (r 1) 's complement is one less
then the r's complement.
Example 1.8
Repeat Example 1.7, but this time using 1's complement.
There is no end carry,
Therefore, the answer is Y –
X = (1's complement of
1101110) = 0010001.
GNIT ECE 28
29. Example:
Consider decimal 185 and its corresponding value
in BCD and binary:
BCD addition
GNIT ECE 29
30. Example:
Consider the addition of 184 + 576 = 760 in BCD:
Decimal Arithmetic: (+375) + (-240) = +135
Hint 6: using 10’s of BCD
GNIT ECE 30
32. Gray Code
The advantage is that only
bit in the code group changes
in going from one number to
the next.
Error detection.
Representation of analog data.
Low power design.
000 001
010
100
110 111
101
011
1-1 and onto!! GNIT ECE 32
33. American Standard Code for Information Interchange (ASCII)
Character Code
GNIT ECE 33
35. Error-Detecting Code
To detect errors in data communication and
processing, an eighth bit is sometimes added to
the ASCII character to indicate its parity.
A parity bit is an extra bit included with a
message to make the total number of 1's either
even or odd.
Example:
Consider the following two characters and their
even and odd parity:
GNIT ECE 35
36. BCD Code
A number with k decimal digits
will require 4k bits in BCD.
Decimal 396 is represented in
BCD with 12bits as 0011 1001
0110, with each group of 4 bits
representing one decimal digit.
A decimal number in BCD is
the same as its equivalent
binary number only when the
number is between 0 and 9.
The binary combinations 1010
through 1111 are not used and
have no meaning in BCD.
GNIT ECE 36
37. Binary code Gray code
1.5 Unit Distance Codes
The most common example of a unit distance code (Successive values differ by only one bit). See Table 2-10 page
52.
GNIT ECE 37
39. The binary value B = bn…b2 b1 b0 can be
converted to Gray code G = gn…g2 g1 g0.
With gi = bi+1 bi or G = B B/2
Examples:
If B =110 then G = 110 011 = 101
If B = 10110111then
G = 10110111
1011011
= 11101100
GNIT ECE 39
41. Hamming codes:
Hamming code not only provides the detection of a
bit error, but also identifies which bit is in error so
that it can be corrected. Thus hamming code is
called error detecting and error correcting code. The
code uses a no. of parity bits located at certain
positions in the code group. Hamming code can be
constructed for single error correction.
Number of parity bits:
No. of parity bits dependent on the number of
information bits. If the no. of information bits is
designed x, the no. of parity bits, P is determined by
the following relationship.
2p > = x+p+1------------------- 1
GNIT ECE 41
42. Example: Encode the binary word 1011 into seven bit even parity
hamming code.
Sol: Step 1: Find the no. of parity bits required. Let P=3, then
Then 2p= 23 = 8 and x+p+1=4+3+1=8
Three parity bits are sufficient
Therefore, Total code bits = 4+3 = 7
Step 2: Construct a bit location table
Bit designation D7 D6 D5 P4 D3 P2
P1
Bit location 7 6 5 4 3 2
1
Binary location 111 110 101 100 011 010
001
Number
Information bits(Dn) 1 0 1 1
Parity bits(Pn) 0 0
1
GNIT ECE 42
43. Step 3: Determine the parity bits
For P1: Bit locations 3, 5, 7 have three 1’s
and therefore to have an even parity P1 must
be 1.
For P2: Bit locations 3, 6, 7 have two 1’s and
therefore to have an even parity P2 must be
0.
For P4: Bit locations 5, 6, 7 have two 1’s and
therefore to have an even parity P4 must be
0.
Step 4: Enter the parity bits into the table to
form a seven bit hamming code = 1010101.
Digital systems
Digital systems
GNIT ECE 43
44. American Standard Code for Information
Interchange (Refer to Table 1.7)
A popular code used to represent information
sent as character-based data.
It uses 7-bits to represent:
94 Graphic printing characters.
34 Non-printing characters.
Some non-printing characters are used for text
format (e.g. BS = Backspace, CR = carriage
return).
Other non-printing characters are used for
record marking and flow control (e.g. STX and
ETX start and end text areas).
GNIT ECE 44
45. ASCII has some interesting properties:
Digits 0 to 9 span Hexadecimal values 3016 to 3916
Upper case A-Z span 4116 to 5A16
Lower case a-z span 6116 to 7A16
Lower to upper case translation (and vice versa)
occurs by flipping bit 6.
GNIT ECE 45
46. 0
1
1
0
X
NOT
X
Z =
Truth table a 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:
1
1
1
0
0
1
0
1
0
0
0
0
Z = X·Y
Y
X
AND OR
X Y Z = X+Y
0 0 0
0 1 1
1 0 1
1 1 1
GNIT ECE 46
47. 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
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
GNIT ECE 47
48. 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
GNIT ECE 48
49. Example: F = (A + C) · B + 0
dual F = (A · C + B) · 1 = A · C + B
Example: G = X · Y + (W + Z)
dual G =
Example: H = A · B + A · C + B · C
dual H =
Unless it happens to be self-dual, the dual of
an expression does not equal the expression
itself
Are any of these functions self-dual?
(A+B)(A+C)(B+C)=(A+BC)(B+C)=AB+AC+BC
(X+Y) · (W · Z) = (X+Y) · (W+Z)
(A+B) · (A+C) · (B+C)
H is self-dual
GNIT ECE 49
50. The order of evaluation is:
1. Parentheses
2. NOT
3. AND
4. OR
Consequence: Parentheses appear
around OR expressions
Example: F = A(B + C)(C + D)
GNIT ECE 50
51. 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.
GNIT ECE 51
52. 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
GNIT ECE 52
53. Minimization
X Y + X Y = Y
Absorption
X + X = X
Simplification
X + X Y = X + Y
DeMorgan’s
X + Y = X · Y
Minimization (dual)
(X+Y)(X+Y) = Y
Absorption (dual)
X · (X + Y) = X
Simplification (dual)
X · (X + Y) = X · Y
DeMorgan’s (dual)
X · Y = X + Y
GNIT ECE 53
54. Generalized DeMorgan’s Theorem:
X1 + X2 + … + Xn = X1 · X2 · … · Xn
X1 · X2 · … · Xn = X1 + X2 + … + Xn
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
GNIT ECE 54
55. Use DeMorgan's Theorem:
1. Interchange AND and OR operators
2. Complement each constant and
literal
Example: Complement G = (a + bc)d
+ e
G = (a (b + c) + d) e
GNIT ECE 55
56. An application of Boolean algebra
Simplify to contain the smallest number of
literals (variables that may or may not be
complemented)
= AB + ABCD + A C D + A C D + A B D
= AB + AB(CD) + A C (D + D) + A B D
= AB + A C + A B D = B(A + AD) +AC
= B (A + D) + A C (has only 5 literals)
GNIT ECE 56
57. A B S C(arry)
0 0 0 0
1 0 1 0
0 1 1 0
1 1 0 1
Notice that the carry results are the same as AND
C = A B
GNIT ECE 57
58. Minterms and Maxterms
Sum-of-Minterm (SOM) Canonical Form
Product-of-Maxterm (POM) Canonical Form
Representation of Complements of Functions
Conversions between Representations
GNIT ECE 58
59. 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 (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.
Y
X
XY
Y
X
Y
X
x
GNIT ECE 59
60. 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:
X+Y(both normal)
X+Y(x normal, y complemented)
X+Y (x complement , y normal)
X+Y(both complement)
GNIT ECE 60
61. 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
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
GNIT ECE 61
62. M3 = x + y + z
m3 = x y z
3
1
1
0
M4 = x + y + z
m4 = x y z
4
0
0
1
M5 = x + y + z
m5 = x y z
5
1
0
1
M6 = x + y + z
m6 = x y z
6
0
1
1
1
1
0
0
y
1
0
0
0
x
1
0
1
0
z
M7 = x + y + z
m7 = x y z
7
M2 = x + y + z
m2 = x y z
2
M1 = x + y + z
m1 = x y z
1
M0 = x + y + z
m0 = x y z
0
Maxterm
Minterm
Index
Maxterm Mi is the complement of minterm mi
Mi = mi and mi = Mi
GNIT ECE 62
63. 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
GNIT ECE 63
64. 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
B
C
B
A
C
B
A +
+
C
·
)
C
B
(A
·
B)
(A +
+
+
C)
(A
C)
B
(A +
+
B)
(A
C
A
C
B
A +
+
GNIT ECE 64
65. 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.
GNIT ECE 65
66. 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
)
7
,
6
,
5
,
4
,
1
(
)
C
,
B
,
A
(
F S
=
GNIT ECE 66
67. In order for current to flow, both switches
must be closed
Logic notation AB = C
(Sometimes AB = C)
A B C
0 0 0
0 1 0
1 0 0
1 1 1
GNIT ECE 67
68. Current flows if either switch is closed
Logic notation A + B = C
A B C
0 0 0
0 1 1
1 0 1
1 1 1
GNIT ECE 68
69. Commutation
o A + B = B + A
o A B = B A
Same as
Same as
GNIT ECE 69
76. Exclusive OR/ Exclusive NOR
The eXclusive OR (XOR) function is an important Boolean
function used extensively in logic circuits.
The XOR function may be;
implemented directly as an electronic circuit (truly a gate)
or
implemented by interconnecting other gate types (used
as a convenient representation)
The eXclusive NOR function is the complement of the
XOR function
By our definition, XOR and XNOR gates are complex
gates.
Chapter 2
- Part 3
76
77. Uses for the XOR and XNORs gate include:
Adders/subtractors/multipliers
Counters/incrementers/decrementers
Parity generators/checkers
Definitions
The XOR function is:
The eXclusive NOR (XNOR) function, otherwise
known as equivalence is:
Strictly speaking, XOR and XNOR gates do no
exist for more that two inputs. Instead, they
are replaced by odd and even functions.
Y
X
Y
X
Y
X +
=
Y
X
Y
X
Y
X +
=
Chapter 2
- Part 3
77
78. Operator Rules: XOR XNOR
The XOR function means:
X OR Y, but NOT BOTH
XOR is known as equivalence function, why?
X Y X Y
0 0 0
0 1 1
1 0 1
1 1 0
X Y
0 0 1
0 1 0
1 0 0
1 1 1
(X Y)
Chapter 2
- Part 3
78
79. The XOR function can be extended to 3 or more
variables. For more than 2 variables, it is called
an odd function or modulo 2 sum (Mod 2 sum),
not an XOR:
The complement of the odd function is the even
function.
The XOR identities: =
= X
1
X
X
0
X
1
X
X
0
X
X =
=
X
Y
Y
X
=
Z
Y
X
)
Z
Y
(
X
Z
)
Y
X
(
=
=
+
+
+
=
Z
Y
X
Z
Y
X
Z
Y
X
Z
Y
X
Z
Y
X
Chapter 2
- Part 3
79
80. XOR symbol:
XNOR symbol:
Shaped symbols exist only for two inputs
Chapter 2
- Part 3
80
81. 1.12 Universal Gates
Nand and Nor gates are called Universal gates
as any Boolean function can be realized with the
help of Nand and Nor gates only
GNIT ECE 81
87. GNIT ECE
Add inverters in two-level implementation
into the cost picture
Attempt to “combine” inverters to reduce
the term count
Attempt to reduce literal + term count by
factoring expression into POSOP or SOPOS
87
88. GNIT ECE
F = A B’ + A C’ + B A’ + B C’
= A A’ + A B’ + A C’ + B A’ + B B’ + B C’
= A (A’ + B’ + C’) + B (A’ + B’ + C’)
F
A
C
B
7 inputs and 4 gates
15 inputs and 8 gates*
* Counting inverters (NOTS) as 1 input and 1 gate
88
89. GNIT ECE
F = AB + AD’ + BC + CD’ 12 inputs & 5 gates
= A(B + D’) + C(B + D’) 8 inputs & 5 gates
F
A
C
B
D
89