Sie sind auf Seite 1von 45

UNIT-I

BINARY SYSTEMS
1.1 DIGITAL SYSTEMS
Digital systems have such a prominent role in everyday life that we refer to the
present technological period as the digital age. Digital systems are used in
communication, business transactions, traffic control, spacecraft guidance, medical
treatment, weather monitoring, the Internet, and many other commercial, industrial,
and scientific enterprises. The general-purpose digital computer is the best-known
example of a digital system.
The most striking property of the digital computer is its generality. It can
follow a sequence of instructions, called a program, that operates on given data. The
user can specify and change the program or the data according to the specific need.
Because of this flexibility, general-purpose digital computers can perform a variety of
information processing tasks that range over a wide spectrum of applications.
One characteristic of digital systems is their ability to represent and manipulate
discrete elements of information. Any set that is restricted to a finite number of
elements contains discrete information. Examples of discrete sets are the 10 decimal
digits, the 26 letters of the alphabet, the 52 playing cards, and the 64 squares of a
chessboard.
Discrete elements of information are represented in a digital system by
physical quantities called signals, such as voltages and currents. Electronic devices
called transistors predominate in the circuitry that implements these signals. The
transistors are generally found in only two stable states (on or off). So, the signals in
most present day electronic digital systems use just two discrete values and are
therefore said to be binary. A binary digit, called a bit, has two values: 0 and 1.
Discrete elements of information are represented with groups of bits called binary
codes. Thus, a digital system is a system that manipulates discrete elements of
information represented internally in binary form. Discrete quantities of information
either emerge from the nature of the data being processed or may be quantized from a
continuous process. For example, students‟s result analysis is processed by means of
discrete data values such as letters of the alphabet (names), digits (marks, roll no.),
and special symbols (such as %). On the other hand, a research scientist may observe
a continuous process, but record only specific quantities in tabular form. The scientist

1
is thus quantizing continuous data, making each number in his or her table a discrete
quantity. In many cases, the quantization of a process can be performed automatically
by an analog-to -digital converter, a device that forms a digital (discrete)
representation of an analog (continuous) quantity.
There are fundamental reasons that commercial products are made with digital
circuits.
 Programmable: Like a digital computer, most digital devices are
programmable. By changing the program in a programmable device, the same
underlying hardware can be used for many different applications, thereby
allowing its cost of development to be spread across a wider customer base.
 Low Cost: Dramatic cost reductions in digital devices have come
about because of advances in digital integrated circuit technology. As the number
of transistors that can be put on a piece of silicon increases to produce complex
functions, the cost per unit decreases and digital devices can be bought at an
increasingly reduced price.
 Speed: Equipment built with digital integrated circuits can perform at a
speed of hundreds of millions of operations per second.
 Reliability: Digital systems can be made to operate with extreme
reliability by using error‐correcting codes.
A digital system is an interconnection of digital modules. To understand the
operation of each digital module, it is necessary to have a basic knowledge of digital
circuits and their logical function.

1.2 NUMBER BASE CONVERSIONS


1.2.1 NUMBER SYSTEM
The numbers are necessary for quantitative analysis. The number systems which are
commonly used in the applications implemented using digital systems are:
 Binary Number System
 Octal Number System
 Decimal Number System
 Hexa Decimal Number System
All the above specified number systems are positional number systems, ie., the
value of the digit (place value) depends on its position in the number.

2
The most familiar number system for human beings is the decimal number
system, but this system is not convenient for digital system which operates on only
two values (on („1‟) or off („0‟)).
The base or radix of a number system („r‟) is defined as the number of distinct
symbols (digits or characters) used in that number system. The range of values for a
digit in a number system with base „r‟ is from 0 to (r-1).
For example, the Base „5‟ number system has 5 digits whose value ranges from 0 to 4.
Number System Radix Digits or characters available in that number system
(„r‟)
Binary 2 "0", "1"
Octal 8 "0", "1", "2", "3", "4", "5", "6", "7"
Decimal 10 "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"
Hexa Decimal 16 "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B",
"C", "D", "E", and "F".
Where “A” stands for 10, “B” for 11 and so on.

1.2.2 NUMBER BASE CONVERSIONS

In general, a number with a decimal point (or radix point) is represented by a


series of coefficients:
an……a2 a1 a0 . a-1 a-2 a-3 …… a-m

In general, a number expressed in a base‐r system has coefficients multiplied


by powers of r:

an X r n + an-1 X r n-1 + ………. + a2 X r2 + a1 X r 1 + a0 +


a-1 X r -1+ a-2 X r -2 + ………. + a-m X r -m

Where the value of coefficient aj ranges from 0 to r - 1.

For example, (7392)10 is written as 7 X 103 + 3 X 102 + 9 X 101 + 2 X 100.

To distinguish between numbers of different bases, we enclose the coefficients


in parentheses and write a subscript equal to the base used.

3
1.2.2.1 Conversion of numbers in any base to Decimal
The conversion of a number in base r to decimal is done by expanding the
number in a power series and adding all the terms. The conversion from any base to
base 10 can be obtained using the formulae

( ) ∑

Where r is the base, aj is the digit at position j, m is the number of digits after the
decimal point, n is the number of digits of the integer part and (N)10 is the obtained
number in decimal. Representations of a number in a different radix are said to be
equivalent if they have the same decimal representation. For example, (0011) 8 =
(1001)2 = (9)10.
Conversion of numbers from Binary to Decimal:

1. Convert (110011)2 to decimal.


(110011)2 = 1 X 25 + 1 X 24 + 0 X 23 + 0 X 22 + 1 X 21 + 1 X 20
= 1 X 32 + 1 X 16 + 0 X 8 + 0 X 4 + 1 X 2 + 1 X 1
= 32 + 16 + 0 + 0 + 2 + 1 = (51)10
(110011)2 = (51)10

2. Convert (11010.11)2 to decimal.


(11010.11)2 = 1 X 24 + 1 X 23 + 0 X 22 + 1 X 21 + 0 X 20 + 1 X 2 -1 + 1 X 2 -2
= 1 X 16 + 1 X 8 + 0 X 4 + 1 X 2 + 0 X 1 + 1 X 0.5 + 1 X 0.25
= 16 + 8 + 0 + 2 + 0 + 0.5 + 0.25 = (26.75) 10
(11010.11)2 = (26.75)10
3. Convert (1010.101)2 to decimal.
(1010.101)2 = 1 X 23 + 0 X 22 + 1 X 21 + 0 X 20 + 1 X 2 -1 + 0 X 2 -2 + 1 X 2 -3
= 1 X 8 + 0 X 4 + 1 X 2 + 0 X 1 + 1 X 0.5 + 0 X 0.25 + 1 X 0.125
= 8 + 0 + 2 + 0 + 0.5 + 0.125 = (10.625)10
(1010.101)2 = (10.625)10
Conversion of numbers from Octal to Decimal:

1. Convert (314)8 to decimal.


(314)8 = 3 X 82 + 1 X 81 + 4 X 80
= 3 X 64 + 1 X 8 + 4 X 1
= 192 + 8 + 4 = (204)10

4
(314)8 = (204)10
2. Convert (12.56)8 to decimal.
(12.56)8 = 1 X 81 + 2 X 80 + 5 X 8 -1 + 6 X 8 -2
= 1 X 8 + 2 X 1 + 5 X 0.125 + 6 X 0.015625
= 8 + 2 + 0.625 + 0.09375 = (10.71875)10
(12.56)8 = (10.71875)10
Conversion of numbers from Hexa Decimal to Decimal:

1. Convert (BF401)16 to decimal.


(BF401)16 = B X 164 + F X 163 + 4 X 162 + 0 X 161 + 1 X 160
= 11 X 65536 + 15 X 4096 + 4 X 256 + 0 X 16 + 1 X 1
= 720896 + 61440 + 1024 + 0 + 1 = (783361)10
(BF401)16 = (783361)10

2. Convert (432.EC)16 to decimal.


(432.EC)16 = 4 X 162 + 3 X 161 + 2 X 160 + E X 16 -1 + C X 16 -2
= 4 X 256 + 3 X 16 + 2 X 1 + 14 X 0.0625 + 12 X 0.00390625
= 1024 + 48 + 2 + 0.875 + 0.046875 = (1074.921875)10
(432.EC)16 = (1074.921875)10
Conversion of numbers from other bases to Decimal:

1. Convert (231.5)5 to decimal.


(231.5)5 = 2 X 52 + 3 X 51 + 1 X 50 + 5 X 5 -1
= 2 X 25 + 3 X 5 + 1 X 1 + 5 X 0.2
= 50 + 15 + 1 + 1 = (67)10
(231.5)5 = (67)10

2. Convert (A12.B)12 to decimal.


(A12.B)12 = A X 122 + 1 X 121 + 2 X 120 + B X 12 -1
= 10 X 144 + 1 X 12 + 2 X 1 + 11 X 0.08333
= 1440 + 12 + 2 + 0.91667 = (1454.91667)10
(A12.B)12 = (1454.91667)10
1.2.2.2 Conversion of numbers in decimal to any base

 The conversion of a decimal integer to a number in base r is done by dividing


the number and all successive quotients by r and accumulating the remainders.

5
 The conversion of a decimal fraction to a number in base r is done by
multiplying that fraction and all successive fractions by r and accumulating
the integers. The process is continued until the fraction becomes 0 or until the
number of digits has sufficient accuracy.
 The conversion of decimal numbers with both integer and fractional parts is
done by converting the integer and the fraction separately and then combining
the two answers.
This procedure is best illustrated by the following examples.
Decimal to Binary Conversion
1. (41)10 = (?)2
Representation I or Representation II

Successive division of Quotients Remainders


2 41
number and its quotients by
2 20 - 1 base value
41/2 20 1
2 10 - 0
20/2 10 0
2 5 - 0
10/2 5 0
2 2 - 1
5/2 2 1
2 1 - 0
2/2 1 0
0 - 1
1/2 0 1

Stop the process when quotient becomes zero. By accumulating the remainders from
bottom to top we get the equivalent binary number of the given decimal number.
(41)10 = (101001)2
2. (0.685)10 = (?)2

Successive multiplication of Fractional Part Integer Part


fractions by base value

0.685 x 2 = 1.37 0.37 1


0.685 x 2 = 1.37 0.74 0
0.74 x 2 = 1.48 0.48 1
0.48 x 2 = 0.96 0.96 0
0.96 x 2 = 1.92 0.92 1
0.92 x 2 = 1.84 0.84 1

6
The process is continued until the fraction becomes 0 or until the number of digits has
sufficient accuracy. By accumulating the integer values only from top to bottom we
get the equivalent binary number of the given decimal fraction.

(0.685)10 = (0.101011…..)2
3. (49.75)10 = (?)2
As the given decimal number has both integer and fractional part, there is a
need to separate the integer and fractional part and each part is to be converted
separately. Finally, the obtained results are to be combined.

Successive multiplication of Fractional Part Integer Part


2 49 fractions by base value
2 24 - 1
0.75 x 2 = 1.5 0.5 1
2 12 - 0
0.5 x 2 = 1.0 0.0 1
2 6 - 0
2 3 - 0
(49)10 = (110001)2
2 1 - 1
(0.75)10 = (0.11)2
0 - 1

(49.75)10 = (110001.11)2
Decimal to Octal Conversion:
1. (143)10 = (?)8
Successive division of Quotients Remainders
8 143 number and its
quotients by base value
8 17 - 7 143/8 17 7
8 2 - 1 17/8 2 1
0 - 2 2/8 0 2

(143)10 = (217)8

7
2. (0.7685)10 = (?)8

Successive multiplication of Fractional Part Integer Part


fractions by base value

0.7685 x 8 = 6.148 0.148 6


0.148 x 8 = 1.184 0.184 1
0.184 x 8 = 1.472 0.472 1
0.472 x 8 = 3.776 0.776 3
0.776 x 8 = 6.208 0.208 6
0.208 x 8 = 1.664 0.664 1

: : :
: : :
(0.7685)10 = (0.611361…..)8

3. (18.76)10 = (?)8

8 18 Successive multiplication of Fractional Part Integer Part


fractions by base value
8 2 - 2
0 - 2 0.76 x 8 = 6.08 0.08 6
0.08 x 8 = 0.64 0.64 0
0.64 x 8 = 5.12 0.12 5

(18)10 = (22)8 : : :
: : :
(0.76)10 = (0.605……)2
(18.76)10 = (22.605……)8
Decimal to Hexadecimal Conversion:
1. (1459)10 = (?)16
Successive division of Quotients Remainders
16 1459 number and its
quotients by base value
16 91 - 3 1459/16 91 3
16 5 - 11 (B) 91/16 5 11 (B)
0 - 5 5/16 0 5

(1459)10 = (5B3)8

8
2. (0.85)10 = (?)16

Successive multiplication of Fractional Part Integer Part


fractions by base value

0.85 x 16 = 13.6 0.6 13 (D)


0.6 x 16 = 9.6 0.6 9
0.6 x 16 = 9.6 0.6 9

: : :
: : :
(0.85)10 = (0.D99…..)8

3. (18.76)10 = (?)16

Successive multiplication of Fractional Part Integer Part


16 18
fractions by base value
16 1 - 2
0 - 1 0.76 x 16 = 12.16 0.16 12 (C)
0.16 x 16 = 0.256 2.56 2
0.56 x 16 = 8.96 0.96 8

: : :
(18)10 = (12)8 : :
:
(0.76)10 = (0.C28)16

(18.76)10 = (12.C28….)16

1.2.2.3 Octal and Hexadecimal Number Conversions


The conversion from and to binary, octal, and hexadecimal plays an important
role in digital computers, because shorter patterns of hex characters are easier to
recognize than long patterns of 1‟s and 0‟s. Since 23=8 and 24=16, each octal digit
corresponds to three binary digits and each hexadecimal digit corresponds to four
binary digits.
Binary to Octal Conversion:
Numbers in Binary can be converted to octal conversion by partitioning the
binary number into groups of three digits each, starting from the binary point and
proceeding to the left and to the right. If there are less than 3 bits in a group pad with
zeros. The corresponding octal digit is then assigned to each group.

9
(10 110 001 101 011 . 111 100 000 110)2 = (26153.7406)8
2 6 1 5 3 . 7 4 0 6

(001 101 011 . 111 100)2 = (153.74)8


1 5 3 . 7 4 7 4

Binary to Hexadecimal Conversion:

Conversion from binary to hexadecimal is similar to that of binary to octal,


except that the binary number is divided into groups of four digits:

(0100 0110 1011 . 1111 0000 0110)2 = (46B.F06)16


4 6 B . F 0 6

Octal or Hexadecimal to Binary Conversion:

Octal or hexadecimal to binary conversion is done by reversing the preceding


process. Each octal digit is converted to its three‐digit binary equivalent also known
as Binary Coded Octal. Similarly, each hexadecimal digit is converted to its four‐
digit binary equivalent also known as Binary Coded Hexadecimal.

(673.124)8 = (110 111 011 . 001 010 100)2


6 7 3 . 1 2 4

(306.D)16 = (0011 0000 0110 . 1101)2


3 0 6 . D
During communication between people (about binary numbers in the
computer), the octal or hexadecimal representation is more desirable because it can be
expressed more compactly with a third or a quarter of the number of digits required
for the equivalent binary number. Thus, most computer manuals use either octal or
hexadecimal numbers to specify binary quantities.

10
Numbers with different bases
Decimal Binary Octal Hexadecimal
(base 10) (base 2) (base 8 (base 16)
00 0000 00 00
01 0001 01 01
02 0010 02 02
03 0011 03 03
04 0100 04 04
05 0101 05 05
06 0110 06 06
07 0111 07 07
08 1000 10 08
09 1001 11 09
10 1010 12 A
11 1011 13 B
12 1100 14 C
13 1101 15 D
14 1110 16 E
15 1111 17 F

1.3 COMPLEMENTS OF NUMBERS


Complements are used in digital computers to simplify the subtraction
operation and for logical manipulation.
There are two types of complements for each base‐r system:
 The radix complement (r‟s complement)
 The diminished radix complement ((r-1)‟s complement).
The diminished radix complement: Let a number N in base r having n digits, the
diminished radix complement, (r - 1)‟s complement of N, is defined as (r n - 1) - N.
For decimal numbers, r =10, so (r-1)’s complement of a decimal number is
obtained by (10n-1)-N. 10n represents a number that consists of a single 1 followed by
n 0‟s. (10n-1) is a number represented by n 9‟s. Hence, the 9‟s complement of a
decimal number is obtained by subtracting each digit from 9.
The 9‟s complement of 546700 is 999999 - 546700 = 453299.
The 9‟s complement of 012398 is 999999 - 012398 = 987601.
For binary numbers, r =2, so (r-1)’s complement of a binary number is
obtained by (2n-1)-N. 2n represents a binary number that consists of a single 1
followed by n 0‟s. (2n-1) is a binary number represented by n 1’s. Hence, the 2‟s
complement of a binary number is obtained by subtracting each bit from 1. In binary
number system we have only two bits either 0 or 1. Subtracting each bit from 1 result

11
in an operation of changing bits from 0 to 1 or from 1 to 0. The 1‟s complement of a
binary number is formed by changing 1‟s to 0‟s and 0‟s to 1‟s.
The 1‟s complement of 1011000 is 0100111.
The 1‟s complement of 0101101 is 1010010.
The (r - 1)‟s complement of octal or hexadecimal numbers is obtained by
subtracting each digit from 7 or F (decimal 15), respectively.
The radix complement: Let a number N in base r having n digits, the radix
complement, r‟s complement of N, is defined as r n – N for N ≠ 0 and 0 for N = 0.
 The r’s complement is obtained by adding 1 to the (r - 1)‟s complement, since
r n - N = [(r n - 1) - N] + 1.
Ex: The 10‟s complement of decimal 2389 is (9999 - 2389) + 1 = 7610 + 1 = 7611.
The 2‟s complement of binary 101100 is (111111 – 101100) + 1
= 010011 + 1 = 010100
 The 10‟s complement of N, can be formed also by leaving all least significant
0‟s unchanged, subtracting the first nonzero least significant digit from 10, and
subtracting all higher significant digits from 9.
Ex: The 10‟s complement of 012398 is 987602
The 10‟s complement of 246700 is 753300
 The 2‟s complement can be formed by leaving all least significant 0‟s and the
first 1 unchanged and replacing 1‟s with 0‟s and 0‟s with 1‟s in all other
higher significant digits.
Ex: The 2‟s complement of 1101100 is 0010100
The 2‟s complement of 0110111 is 1001001
 If the original number N contains a radix point, the point should be removed
temporarily in order to form the r‟s or (r - 1)‟s complement. The radix point is
then restored to the complemented number in the same relative position.
Ex: The 9‟s complement of 54.67 is 45.32, and the 10‟s complement is 45.33
The 1‟s complement of 10101.1010 is 01010.0101, and the 2‟s complement is
01010.0110

 The complement of the complement restores the number to its original value.
The r‟s complement of N is r n - N, so that the complement of the complement
is r n - (r n - N) = N and is equal to the original number.

12
1.3.1 SUBTRACTION WITH COMPLEMENTS
Subtraction of two unsigned numbers using r’s complement:
The subtraction of two n‐digit unsigned numbers M - N in base r can be done
as follows, provided both numbers should contain equal number of digits otherwise
pad with zeros.
1. Add the minuend M to the r‟s complement of the subtrahend N. Mathematically,
M + (r n - N) = M - N + r n.
2. If M ≥ N, the sum will produce an end carry r n, which can be discarded; what is
left is the result M - N.
3. If M < N, the sum does not produce an end carry and is equal to r n - (N - M), which
is the r‟s complement of (N - M). To obtain the answer in a familiar form, take the r‟s
complement of the sum and place a negative sign in front.
1. Using 10‟s complement, subtract 72532 - 3250.
M = 72532, N = 3250
M has 5 digits and N has 4 digits. As both numbers do not contain equal number of
digits, pad with zero for N, then N = 03250.
M = 72532
10‟s complement of N = + 96750
Sum = 169282
Discard end carry 105 = - 100000
Answer= 69282
The occurrence of the end carry signifies that M ≥ N and that the result is therefore
positive.
2. Using 10‟s complement, subtract 3250 - 72532.
M = 3250, N = 72532
M has 4 digits and N has 5 digits. As both numbers do not contain equal number of
digits, pad with zero for M, then M = 03250.
M = 03250
10‟s complement of N = + 27468
Sum = 30718
Answer = - (10‟s complement of 30718) = - 69282
As there is no end carry, it signifies that M < N and that the result is therefore
negative. So, to represent the result in familiar form 10‟s complement of the result is
obtained.
13
3. Using 2‟s complement, subtract 11010 - 01011.
M = 11010, N = 01011
M = 11010
2‟s complement of N = + 10101
Sum = 101111
Discard end carry 105 = - 100000
Answer = 01111
The occurrence of the end carry signifies that M ≥ N and that the result is therefore
positive.
4. Using 2‟s complement, subtract 1011 - 11010.
M = 1011, N = 11010
M has 4 digits and N has 5 digits. As both numbers do not contain equal number of
digits, pad with zero for M, then M = 01011.
M = 01011
2‟s complement of N = + 00110
Sum = 10001
Answer = - (2‟s complement of 10001) = - 01111
As there is no end carry, it signifies that M < N and that the result is therefore
negative. So, to represent the result in familiar form 2‟s complement of the result is
obtained.
Subtraction of two unsigned numbers using (r-1)’s complement:
The (r - 1)‟s complement is one less than the r‟s complement. So, the result of
adding the minuend to the complement of the subtrahend produces a sum that is one
less than the correct difference when an end carry occurs. Removing the end carry and
adding 1 to the sum is referred to as an end‐around carry.
1. Using 9‟s complement, subtract 72532 - 3250.
M = 72532, N = 3250
M has 5 digits and N has 4 digits. As both numbers do not contain equal number of
digits, pad with zero for N, then N = 03250.
M = 72532
9‟s complement of N = + 96749
Sum = 169281
Add end around carry = + 1
Answer= 69282
14
The occurrence of the end carry signifies that M ≥ N and that the result is therefore
positive.
2. Using 9‟s complement, subtract 3250 - 72532.
M = 3250, N = 72532
M has 4 digits and N has 5 digits. As both numbers do not contain equal number of
digits, pad with zero for M, then M = 03250.
M = 03250
9‟s complement of N = + 27467
Sum = 30717
Answer = - (9‟s complement of 30717) = - 69282
As there is no end carry, it signifies that M < N and that the result is therefore
negative. So, to represent the result in familiar form 9‟s complement of the result is
obtained.
3. Using 1‟s complement, subtract 11010 - 01011.
M = 11010, N = 01011
M = 11010
1‟s complement of N = + 10100
Sum = 101110
Add end around carry = + 1
Answer = 01111
The occurrence of the end carry signifies that M ≥ N and that the result is therefore
positive.
4. Using 1‟s complement, subtract 1011 - 11010.
M = 1011, N = 11010
M has 4 digits and N has 5 digits. As both numbers do not contain equal number of
digits, pad with zero for M, then M = 01011.
M = 01011
1‟s complement of N = + 00101
Sum = 10000
Answer = - (1‟s complement of 10001) = - 01111
As there is no end carry, it signifies that M < N and that the result is therefore
negative. So, to represent the result in familiar form 1‟s complement of the result is
obtained.

15
1.4 SIGNED BINARY NUMBERS
Positive integers (including zero) can be represented as unsigned numbers.
The signed numbers represent either positive or negative values. Different notations
used to represent negative numbers are -
 Signed‐magnitude representation
 Signed‐complement representation
 Signed-1‟s‐complement representation
 Signed‐2‟s‐complement representation
Signed‐magnitude representation: In signed magnitude representation the left most
bit is used to represent sign of the number. The sign bit is 0 for positive and 1 for
negative. For example the signed binary numbers are represented in signed magnitude
method as follows:
Sign bit Magnitude Value
1 0 0 0 1 0 1 1 - 11
0 0 0 0 1 0 1 1 + 11

Signed‐complement representation:
In signed-complement representation a negative number is indicated by its
complement. The signed‐complement system can use either the 1‟s or the 2‟s
complement, but the 2‟s complement is the most commonly used for arithmetic
operations.
The following table lists all possible four‐bit signed binary numbers in the
three representations. The equivalent decimal number is also shown for reference.
Note that the positive numbers in all three representations are identical and have 0 in
the leftmost position. The signed‐2‟s‐complement system has only one representation
for 0, which is always positive. The other two systems have either a positive 0 or a
negative 0, something not encountered in ordinary arithmetic. So, they are not used
for arithmetic operations. Note that all negative numbers have a 1 in the leftmost bit
position; that is the way we distinguish them from the positive numbers.

16
All signed and unsigned binary numbers are represented with string of bits.
The value of the number depends on the way it is interpreted. For example, the string
of bits 01001 can be considered as 9 (unsigned binary) or as +9 (signed binary)
because the leftmost bit is 0. The string of bits 11001 represents the binary equivalent
of 25 when considered as an unsigned number and the binary equivalent of -9 when
considered as a signed number.

1.5 BINARY CODE:


Digital system represents and manipulates not only binary numbers, but also many
other discrete elements of information. Any discrete element of information that is
distinct among a group of quantities can be represented with a binary code (a pattern
of 0‟s and 1‟s).
An n-bit binary code is a group of n-bits that assumes up to 2n distinct combinations
of 1‟s and 0‟s with each combination representing one element of the set that is being
coded. The bit combination of an b-bit code is determined from the count in binary
from 0 to (2n-1). Although the minimum number of bits required to code 2n distinct

17
quantities is n, there is no limit on the maximum number of bits may be used for a
binary code, for example 10 decimal digits can be coded with 10 bits also.
Binary codes are mainly classified into 5 groups –
 Weighted binary codes
 Non-weighted binary codes
 Error detecting codes
 Error correcting codes
 Alpha Numeric codes
Based on the properties, binary codes can be classified as –
 Sequential Codes
 Self-Complementing / Reflective Codes
1.5.1 Weighted Binary Codes:
In a weighted binary code, each bit position is assigned a weighting factor in
such a way that each digit can be evaluated by adding the weights of all the 1‟s in the
coded combination. The commonly used weighted codes are-
 8 4 2 1 Code (Binary Coded Decimal)
 2 4 2 1 Code
 5 4 2 1 Code
 5 2 1 1 Code
 8 4 -2 -1 Code
For example, In 8 4 2 1 code the value of 0110 is evaluated as
8 x 0 + 4 x 1 + 2 x 1 + 1 x 0 = 4 + 2 = 6.
In 2 4 2 1 code 1101 can be evaluated as
2 x 1 + 4 x 1 + 2 x 0 + 1 x 1 = 2 + 4 + 1 = 7.
Note: Some digits can be coded in two possible ways in the 2 4 2 1 code. (For
example, the digit 4 can be assigned with 0100 or 1010).
Binary coded Decimal
Even though the most natural system for a computer is binary number system, people
are more accustomed to the decimal system. So, a decimal number is need to be
converted to binary, and then after processing using the digital systems it is to be
converted to decimal.
 The code most commonly used for the decimal digits is the straight binary
assignment, which is known as Binary Coded Decimal (BCD).

18
 The BCD is weighted code with weights 8 4 2 1.
 The 10 decimal digits form a set, which required minimum 4 bits to code a
single digit. Using 4 bits 16 bit combinations can be obtained, out of which 6
combinations are unused.
 The binary numbers 0000 to 1001 are similar to BCD, but 1010 to 1111 are
unused in BCD, and have no meaning in BCD.
 A number with k decimal digits require 4k bits in BCD representation.
 Even though, BCD representation occupies more space than a pure binary
representation, it has an advantage that the input and output data are generated
by people who use decimal system.

Decimal BCD digit


Binary Number
Symbol 8421
0 0000 0000
1 0001 0001
2 0010 0010
3 0011 0011
4 0100 0100
5 0101 0101
6 0110 0110
7 0111 0111
8 1000 1000
9 1001 1001
10 1010 0001 0000
11 1011 0001 0001
12 1100 0001 0010
13 1101 0001 0011
14 1110 0001 0100
15 1111 0001 0101

Ex: (395)10 = (0011 1001 0101)BCD


(97)10 = (1001 0111)BCD
(35)8 = (29)10 = (0010 1001)BCD

19
Other weighted codes:

Decimal BCD
5421 2421 5211 8 4 -2 -1
Symbol 8421
0 0000 0000 0000 0000 0000
1 0001 0001 0001 0001 0111
2 0010 0010 0010 0011 0110
3 0011 0011 0011 0101 0101
4 0100 0100 0100 0111 0100
5 0101 1000 1011 1000 1011
6 0110 1001 1100 1010 1010
7 0111 1010 1101 1100 1001
8 1000 1011 1110 1110 1000
9 1001 1100 1111 1111 1111

In the above specified weighted codes, out of 16 combinations only 10


combinations are used, remaining bit combinations are unused.
1.5.2 Non -weighted Binary Codes:
In non-weighted binary codes, no weightage is assigned to bit positions. The
commonly used non-weighted codes are-
 Excess 3 Code
 Gray Code
Excess 3 Code:
Excess 3 is a non-weighted code. An excess 3 code of a decimal digit can be
obtained by adding 3 to the decimal number and then representing in binary. It is also
self-complementing or reflective code.
Ex: To obtain excess 3 code for 6, 3 is added to 6 (6+ 3 =9) and then represented in its
equivalent binary (1001).
(395)10 in excess 3 code can be represented as 0110 1100 1000
(97)10 in excess 3 code can be represented as 1100 1010
(35)8 in excess 3 code can be represented as (29)10 = 0101 1100

20
Decimal BCD digit
Excess 3 code
Symbol 8421
0 0000 0011
1 0001 0100
2 0010 0101
3 0011 0110
4 0100 0111
5 0101 1000
6 0110 1001
7 0111 1010
8 1000 1011
9 1001 1100

Gray Code:
The gray code is a non-weighted code and it has advantage over straight
binary number sequence is that, successive code words differ by only one bit from
one number to the next. Hence it is also called Unit Distance Code. Since gray code
is a non-weighted code it is seldom used in arithmetic applications, but it is used in
analog to digital converters. It is an example for cyclic code.

Decimal
Binary Number Gray Code
Symbol
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
10 1010 1111

21
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000

Conversion of binary numbers to gray code:


Let binary number sequence of n+1 bits represented as bn bn-1 bn-2 …….b2 b1 b0.
The gray code of the above specified binary sequence can be obtained as
( )( ) ( )( )
Where is XOR operator, it results one if two bits are unequal, otherwise zero.
For example, the gray code for 1110 is obtained as ( )( )( ) = 1001
The gray code for 0101 is obtained as ( )( )( ) = 0111
Conversion of gray code to binary number:
Let gray code of n+1 bits represented as gn gn-1 gn-2 …….g2 g1 g0.
The binary sequence bn bn-1 bn-2 …….b2 b1 b0 of the above specified gray code can be
obtained as ( )( ) ( )( )
Where gn = bn, ( ) ……..and so on.
For example, the binary sequence for gray code 1001 is obtained as
( )( )( ) = 1110.
1 0 0 1

1 1 1 0
1.5.3 Error-Detecting Codes:
During the process of binary data transmission errors may occur. Error detecting
codes are used to detect such type of errors. If a single error transforms a valid code
word into invalid one, it is said to be a single error detecting code.
A parity bit is an extra bit included with the n-bit binary message to make the total
number of 1‟s in the message (including the parity bit) either odd or even.
In the even parity method, parity bit (0 or 1) is added such that the total number of 1‟s
in the coded group must be even (including parity bit). Similarly, odd in odd parity
method.

22
Three bit Even Parity Odd Parity
message Method Method
xyz P xyz P xyz
000 0 000 1 000
001 1 001 0 010
010 1 010 0 010
011 0 011 1 011
100 1 100 0 100
101 0 101 1 101
110 0 110 1 110
111 1 111 0 111

Parity check is commonly used for error detection. Even though parity code is meant
for single error detection, it can detect any odd number of errors, but it is not possible
to correct. Even number of errors cannot be detectable using parity method.
2 out of 5 code:
The 2 out of 5 code consists of all 10 possible combinations of two 1‟s in a 5-
bit code word. With the exception of the code word for decimal 0, the 2 out of 5 code
is a weighted code with weights 0 1 2 4 7. If a single error occurs, it transforms a
valid code word into an invalid one, and making error detection straight forward.

2 out of 5 code
Decimal digit
0 1 2 4 7
0 0 0 0 1 1
1 1 1 0 0 0
2 1 0 1 0 0
3 0 1 1 0 0
4 1 0 0 1 0
5 0 1 0 1 0
6 0 0 1 1 0
7 1 0 0 0 1
8 0 1 0 0 1
9 0 0 1 0 1

23
1.5.4 Error Correcting Codes:
A code is said to be an error correcting code, if the correct code word can always be
deduced from the erroneous word. The minimum distance must be 3 for error
correcting codes, which can correct single error and detect double errors. The distance
between two code words is defined as the number of bits that must change in one code
word so that another code word results. For example, the distance between 1001 and
1010 is 2, since two bits are to be changed. The minimum distance of a code is the
smallest number of bits in which any two code words differ.
Hamming Code:
R.W. Hamming developed a system that provides a methodical way to add
parity bits to the data bits in order to detect and correct errors, which is familiar as
Hamming Code.
The basic principles in constructing a Hamming error correcting code are as follows:
 To each group of „m‟ information or message bits. „k‟ parity bits are added to
form an (m+k) bit code.
 The location of each of the (m+k) bits within a code word is assigned a
decimal value, starting by assigning a 1 to the Most Significant Bit (MSB) and
(m+k) to the Least Significant Bit (LSB).
 The value of k is selected such that it must satisfy the inequality
2k ≥m+k+1
 The parity bits are included in the positions 1, 2, 4, …….. 2 k-1.
 k parity bits are added for the selected bits of each code word so as to get
either even or odd parity.
The process of constructing a Hamming code for message 0100 is explained as
follows:
 The given message is 0100.
 Number of message bits m=4.
 Number of parity bits required is determined by trial and error method, which
satisfies the inequality 2k ≥m+k+1
 k = 3 satisfies the inequality for the given 4-bit message. (23 ≥ 4+3+1)
 The total number of bits in hamming code is
4 message bits + 3 parity bits = 7 bits.
 The bit positions are from 1 to 7, and 3 parity bits are included in positions
1, 2, 4

24
Bit Positions 1 2 3 4 5 6 7
Bit Designations P1 P2 M1 P4 M2 M3 M4
Original message 0 1 0 0
P1 is to set even parity in the bit 1 0 1 0
positions 1, 3, 5, 7
P2 is to set even parity in the bit 0 0 0 0
positions 2, 3, 6, 7
P4 is to set even parity in the bit 1 1 0 0
positions 4, 5, 6, 7
Coded Message 1 0 0 1 1 0 0

The generated hamming code for the given message is 1001100.


Error correction procedure using Hamming coded data:
 At the receiver side, k parity checks are performed on selected bits of each
code word for either even or odd parity (depending on the parity method
adopted at the transmitter).
 The result of each parity check is recorded as 1 or 0, depending on whether an
error has or has not detected. These parity checks results c 1, c2 ….ck form a
binary number, whose value is equal to the decimal value assigned to the
location of the erroneous bit, and is equal to zero if no error occurs.
 The corrected code word can be obtained
Error Position Number
by complementing the bit in the corresponding bit
Position C4 C2 C1
position.
0 (No error) 000
 Since C1 bit is „1‟ for errors in positions
1 001
1, 3, 5, 7 P1 is selected so as to establish
2 010
even/ odd parity in positions 1, 3, 5, 7.
3 011
 Since C2 bit is „1‟ for errors in positions
4 100
2, 3, 6, 7 P2 is selected so as to establish
5 101
even/ odd parity in positions 2, 3, 6, 7.
6 110
 Since C4 bit is „1‟ for errors in positions
7 111
4, 5, 6, 7 P4 is selected so as to establish
even/ odd parity in positions 4, 5, 6, 7.

25
The process of correcting the error in the received Hamming code 1011100 with
even parity:

Parity check
Bit Positions 1 2 3 4 5 6 7
results
Bit Designations P1 P2 M1 P4 M2 M3 M4
Message Received 1 0 0 1 1 1 0
Even parity check C1 in 1 0 1 0 0, no error
the bit positions 1, 3, 5, 7
Even parity check C2 in 0 0 1 0 1, error occurred
the bit positions 2, 3, 6, 7
Even parity check C4 in 1 1 1 0 1, error occured
the bit positions 4, 5, 6, 7
Corrected Message 1 0 0 1 1 0 0

The parity check results C4 C2 C1 represents the bit position with error ie.,
110. So the bit in the 6th position is completed to get the correct message.
Hamming codes with even parity for BCD

Decimal digit BCD Hamming Code word


0 0000 0000000
1 0001 1101001
2 0010 0101010
3 0011 1000011
4 0100 1001100
5 0101 0100101
6 0110 1100110
7 0111 0001111
8 1000 1110000
9 1001 0011001

1.5.5 Alpha Numeric Codes


Many applications of digital computers require the handling not only of
numbers, but also of other characters or symbols, such as the letters of the alphabet.
An alphanumeric character set is a set of elements that includes the 10 decimal digits,

26
the 26 letters of the alphabet, and a number of special characters. The commonly used
alphanumeric codes are:
 ASCII
 EBCDIC
 Hollerith
ASCII:
 ASCII stands for American Standard Code for Information Interchange.
 It is a standard binary code with 7 bits used for representing alphanumeric
character set of 128 symbols.
 It is generally represented using 8 bits, with one bit unused, which is reserved
for future extension by setting MSB to 0, or can be used as parity bit.
 The ASCII code contains – 94 graphic characters, which can be printed and 34
non printable characters.
 The 94 graphic characters include –
26 upper case letters (A to Z)
26 lower case letters (a to z)
10 decimal digits (0 to 9)
32 special printable characters, such as %, &, etc.
 The 34 control characters are designated in the ASCII table with abbreviated
names, which is used as control functions.
 Three types of control characters are
 Format effectors – controls the layout of printing – Back space,
enter, tab, etc.
 Information separators – to separate the data into divisions –
paragraphs, page breaks, etc.
 Communication control characters – used in Transmission of text
between remote devices – start of text, end of text, etc.
EBCDIC:
 EBCDIC stands for Extended Binary Coded Decimal Information Code.
 It is especially used in IBM computers.
 It is 8 bit code with 256 possible symbols.
Hollerith Code:
 It is a 12 bit code.
 Used in punched card readers of large computers.
27
Represent ECE in ASCII code by using even parity.

Given Symbols E C E

ASCII code in decimal 69 67 69

8-bit ASCII code with even parity 11000101 11000011 11000101

28
1.5.6 Sequential Codes
In Sequential codes each binary code is one binary number greater than its
preceding code. The 8,4,2,1 code, excess-3 code are examples for sequential codes.

1.5.7 Self - Complementing or Reflective Codes


Self – Complementing codes have the property that the 9‟s complement of a
decimal number is obtained directly by changing 1‟s to 0‟s and 0‟s to 1‟s (i.e., by
complementing each bit in the pattern). The 2,4,2,1 code, excess-3 code, 5,2,1,1 code
are examples for self-complementing codes.
For example, Decimal 395 is represented in the excess‐3 code as 0110 1100
1000. The 9‟s complement of 395 is 604 which is represented in excess-3 code as
1001 0011 0111, which is obtained simply by complementing each bit of the code (as
with the 1‟s complement of binary numbers).

1.6 BINARY STORAGE AND REGISTERS:


A binary cell is a device that possesses two stable states and is capable of
storing one bit (0 or 1) of information. Based on the excitations signals, the cell is set
to one of the two stable states. The output of the cell is a physical quantity that
distinguishes between two states. The information stored in a cell is 1, when the cell is
in one stable state and 0 when the cell is in the other stable state.
Registers:
A register is a group of binary cells. A register with n cells can store any
discrete quantity of information that contains n bits, which can be in one of 2 n
possible states.
The content of a register is a function of the interpretation given to the
information stored in it. The same data can be interpreted differently for different
types of data depending on the application.
For example, the same 16 bit register contents can be interpreted differently
based on the way of interpretation.
 If a register represents a binary integer, then the register can store any
binary number from 0 to 216 – 1.
 If the register stores alpha numeric characters, it represents two
meaningful characters.
 If the register contains BCD code, it stores 4 digits.

29
Register Transfer:
In digital systems, a register transfer operation is a basic operation that
consists of a transfer of binary information from one set of registers into another set of
registers. The transfer may be direct, from one register to another, or may pass
through data processing circuits to perform an operation.
1.7 BINARY LOGIC:
Binary logic deals with variables that take on two discrete values (0 or 1) and with
operators that assume logical meaning. The binary logic consists or binary variables
and a set of logical operations. The variables are designated by letters of the alphabet,
such as A, B, C, x, y, z, etc., with each variable having two and only two distinct
possible values 0 and 1. There are 3 basic logic operations: AND, OR, and NOT.
Binary arithmetic and binary logic are different, for example, in binary arithmetic,
1+1=10 while in binary logic 1+1=1.

1.7.1 Basic Logic Gates:


Logic gates are electronic circuits that operate on one or more input signals to
produce an output signal.
The AND Gate:
The AND gate implements the AND function, z = x.y. The output of the gate is at
logic 1 when both of the inputs are at logic 1, otherwise results in logic 0.

Logic Symbol Truth Table


Inputs Output
x y z = x.y
0 0 0
0 1 0
1 0 0
1 1 1

The AND function can have any number of inputs. However, for practical
reasons, commercial AND gates are most commonly manufactured with 2, 3, or 4
inputs.

30
The OR Gate:
The OR gate implements the OR function, z = x+y. The output of the gate is at logic 1
when either of the inputs is at logic 1, otherwise results in logic 0.
Logic Symbol Truth Table
Inputs Output
x y z = x+y
0 0 0
0 1 1
1 0 1
1 1 1
The OR function can have any number of inputs. However, for practical
reasons, commercial OR gates are most commonly manufactured with 2, 3, or 4
inputs.
The NOT Gate or Inverter:
The NOT gate has only one input and one output. The output is complement of the
input i.e., y=x‟.
Logic Symbol Truth Table
Input Output
x y= x’
0 1
1 0

The bubble at the output denotes the logical inversion.

31
BOOLEAN ALGEBRA AND LOGIC GATES
1.8 BOOLEAN ALGEBRA
Boolean algebra was an algebraic system developed by George Boole in 1854. The
two valued Boolean algebra is also known as Switching Algebra. Boolean algebra is
an algebraic structure defined on a set of elements B, together with two binary
operators (+, .) provided the following Huntington postulates are satisfied.
1. (a) The structure is closed with respect to the operator +.
(b) The structure is closed with respect to the operator . .
2. (a) The element 0 is an identity element with respect to +;
that is, x + 0 =0 + x = x.
(b) The element 1 is an identity element with respect to . ;
that is, x . 1 = 1 . x = x.
3. (a) The structure is commutative with respect to +; that is, x + y = y + x.
(b) The structure is commutative with respect to . ; that is, x . y = y . x.
4. (a) The operator . is distributive over +; that is, x . (y + z) = (x . y) + (x . z).
(b) The operator + is distributive over . ; that is, x + (y . z) = (x + y) . (x + z).
5. For every element x Є B, there exists an element x’ Є B (called the
complement of x) such that (a) x + x‟ = 1 and (b) x . x’ = 0.
6. There exist at least two elements x, y Є B such that x ≠ y.
The two valued Boolean algebra:
The two valued Boolean algebra is defined on a set B = {0,1} with two binary
operators + and., whose rules are defined as below:

x y x+y
x y x.y
0 0 0
0 0 0 0 1 0
0 1 0 1 0 0
1 0 0 1 1 1
1 1 1

x x’
0 1
1 0

32
1. That the structure is closed with respect to the two operators is obvious from the
tables, since the result of each operation is either 1 or 0 and 1, 0 Є B.
2. From the tables, we see that
(a) 0 + 0 =0; 0+ 1 = 1 + 0 = 1;
(b) 1 .1 = 1; 1.0 = 0.1 = 0.
This establishes the two identity elements, 0 for + and 1 for . as defined by postulate 2.
3. The commutative laws are obvious from the symmetry of the binary operator tables.
4. (a) The distributive law x . (y + z) = (x . y) + (x . z) can be shown to hold from the
operator tables by forming a truth table of all possible values of x, y, and z. For each
combination, we derive x . (y + z) and show that the value is the same as the value of
(x . y) + (x . z):

(b) The distributive law of + over . can be shown to hold by means of a truth table
similar to the one in part (a).
5. From the complement table, it is easily shown that
(a) x + x’ = 1, since 0 + 0‟ = 0 + 1 = 1 and 1 + 1‟ = 1 + 0 = 1.
(b) x . x’ = 0, since 0 . 0‟ = 0 . 1 = 0 and 1 . 1‟ = 1 . 0 = 0.
Thus, postulate 5 is verified.
6. Postulate 6 is satisfied because the two‐valued Boolean algebra has two elements, 1
and 0, with 1 ≠ 0.
1.8.1 Basic Theorems and Properties and Boolean algebra:
Duality: The important property of Boolean algebra is duality principle and states
that every algebraic expression deducible from the postulates of Boolean algebra
remains valid if the operators and identity elements are interchanged. The dual of an
algebraic expression can be obtained by simply interchanging OR and AND operators
and replacing 1‟s by 0‟s and 0‟s by 1‟s.

33
Postulate 2 (a) x+0=x (b) x.1=x
Postulate 3, Commutative (a) x+y=y+x (b) x.y=y.x
Postulate 4, Distributive (a) x.(y+z) = x.y + x.z (b) x+yz=(x+y).(x+z)
Postulate 5 (a) x + x’ = 1 (b) x . x’=0
Theorem 1 (a) x+x=x (b) x . x=x
Theorem 2 (a) x+1=1 (b) x . 0=0
Theorem 3, Involution (x’)’=x
Theorem 4, Associative (a) x+(y+z)=(x+y)+z (b) x(yz)=(xy)z
Theorem 5, DeMorgan (a) (x+y)’ = x’y’ (b) (xy)’=x’+y’
Theorem 6, Absorption (a) x+xy=x (b) x(x+y)=x

Theorem Proofs:
THEOREM 1(a): x + x = x.
Statement Justification
x + x = (x + x) . 1 x . 1 = x , postulate 2(b)
= (x + x)(x + x’) x + x’ = 1, postulate 5(a)
= x + xx’ (x+y).(x+z)=x+yz, postulate 4(b)
=x+0 x . x’=0, postulate 5(b)
=x x + 0 = x, postulate 2(a)
THEOREM 1(b): x . x = x.
Statement Justification
x . x = xx + 0 x + 0 = x , postulate 2(a)
= xx + xx’ x . x’=0, postulate 5(b)
= x(x + x‟) x.y + x.z=x.(y+z), postulate 4(a)
=x.1 x + x’ = 1, postulate 5(a)
=x x . 1 = x, postulate 2(b)
Note that theorem 1(b) is the dual of theorem 1(a) and that each step of the proof in
part (b) is the dual of its counterpart in part (a). Any dual theorem can be similarly
derived from the proof of its corresponding theorem.
THEOREM 2(a): x + 1 = 1.
Statement Justification
x + 1 = (x +1) . 1 x . 1 = x, postulate 2(b)
= (x + 1)(x + x’) x + x’ = 1, postulate 5(a)
= x + 1.x’ (x+y).(x+z)=x+yz, postulate 4(b)
34
= x + x‟ x . 1 = x, postulate 2(b)
=1 x + x’ = 1, postulate 5(a)
THEOREM 2(b): x . 0 = 0. (Can be proved by duality)
Operator Precedence
The operator precedence for evaluating Boolean expressions is
(1) Parentheses,
(2) NOT,
(3) AND, and
(4) OR.
In other words, expressions inside parentheses must be evaluated before all other
operations. The next operation that holds precedence is the complement, and then
follows the AND and, finally, the OR.
THEOREM 4(a):
The validity of the associative law and DeMorgan‟s theorem can be easily
verified with truth tables. The truth table for the Associative law, x+(y+z)=(x+y)+z,
is as follows:
x y z (y+z) x+ (y+z) (x+ y) (x+y)+z
0 0 0 0 0 0 0
0 0 1 1 1 0 1
0 1 0 1 1 1 1
0 1 1 1 1 1 1
1 0 0 0 1 1 1
1 0 1 1 1 1 1
1 1 0 1 1 1 1
1 1 1 1 1 1 1

THEOREM 5(a):
The validity of the associative law and DeMorgan‟s theorem can be easily
verified with truth tables. The truth table for the DeMorgan‟s theorem, (x + y)‟ = x’y’,
is as follows:
x y x+ y (x+ y)’ x’ y’ x’ . y’
0 0 0 1 1 1 1
0 1 1 0 1 0 0
1 0 1 0 0 1 0
1 1 1 0 0 0 0

35
THEOREM 6(a): x + xy = x.
Statement Justification
x + xy = x . 1 + xy x.1=x
= x(1 + y) xy+xz=x(y+z)
= x(y + 1) x+y=y+x
=x.1 x+1=1
=x x.1=x
THEOREM 6(b): x(x + y) = x by duality.
1.9 BOOLEAN FUNCTIONS
A Boolean function described by an algebraic expression consists of binary
variables, the constants 0 and 1, and the logic operation symbols. For a given value of
the binary variables, the function can be equal to either 1 or 0.
Ex: F = x + y’z
A Boolean function can be represented in a truth table. The number of rows in
the truth table is 2n, where n is the number of variables in the function. The binary
combinations for the truth table are obtained from the binary numbers by counting
from 0 through 2n - 1. Following Table shows the truth table for the function F.
x y z y’ y’z F = x + y’z
0 0 0 1 0 0
0 0 1 1 1 1
0 1 0 0 0 0
0 1 1 0 0 0
1 0 0 1 0 1
1 0 1 1 1 1
1 1 0 0 0 1
1 1 1 0 0 1

When a Boolean expression is implemented with logic gates, each term


requires a gate and each variable within the term designates an input to the gate. We
define a literal to be a single variable within a term, in complemented or un-
complemented form. By manipulating a Boolean expression according to the rules of
Boolean algebra, it is sometimes possible to obtain a simpler expression for the same
function and thus reduce the number of gates in the circuit and the number of inputs to
the gate which in turn reduce the circuit complexity and also the cost of the circuit.
Consider, for example, the following Boolean function:
F = x’y’z + x’yz + xy’.

36
Now consider the possible simplification of the function by applying some of the
identities of Boolean algebra:
F = x’y’z + x’yz + xy’ = x’z (y’+ y) + xy’ = x’z + xy’.
The function is reduced to only two terms.
1.9.1 Complement of a Function
The complement of a function F is F‟ and is obtained from an interchange of
0‟s for 1‟s and 1‟s for 0‟s in the value of F.
x y z F = x + y’z F‟= (x + y’z)’
0 0 0 0 1
0 0 1 1 0
0 1 0 0 1
0 1 1 0 1
1 0 0 1 0
1 0 1 1 0
1 1 0 1 0
1 1 1 1 0

The complement of a function may be derived algebraically through


DeMorgan‟s theorems. DeMorgan‟s theorems can be extended to three or more
variables. DeMorgan‟s theorems for any number of variables resemble the two‐
variable case in form and can be derived by successive substitutions, which can be
generalized as follows:
(A + B + C + D + ……+ F)‟ = A’B’C’D’ …..F’
(ABCD….F)‟ = A’ + B’ + C’ + D’ + …..+ F’
The generalized form of DeMorgan‟s theorems states that the complement of a
function is obtained by interchanging AND and OR operators and complementing
each literal.
A simpler procedure for deriving the complement of a function is to take the
dual of the function and complement each literal. The dual of a function is obtained
from the interchange of AND and OR operators and 1‟s and 0‟s.
The complement of a function, F = x’yz’ + x’y’z is obtained as follows:
The dual of F is (x’ + y + z’)(x’ + y’ + z).
Complement each literal: (x + y’ + z)(x + y + z’) = F ’.

37
1.10 CANONICAL AND STANDARD FORMS
A Boolean function can be expressed in two forms:
 Canonical form
 Sum of minterms
 Product of Maxterms
 Standard form
 Sum of Products (SOP)
 Product of Sums (POS)
1.10.1 CANONICAL FORM:
A Boolean function expressed in sum of minterms or product of maxterms
form is said to be in canonical form. With n variables, 2n minterms / maxterms can be
formed; 22n functions can be formed by using 2n minterms / maxterms.
Minterm: A minterm is a product term (AND term), where each term consists of all
variables of the function in either complemented (if value is 0) or un-complemented
( if value is 1) form. It is also known as Standard Product Term.
Maxterm: A maxterm is a sum term (OR term), where each term consists of all
variables of the function in either complemented (if value is 1) or un-complemented
( if value is 0) form. It is also known as Standard Sum Term.
Minters and Maxterms formed by 3-binary variables
Minterm Maxterm
x y z
term Designation term Designation

0 0 0 x’y’z’ m0 x+y+z M0

0 0 1 x’y’z m1 x+y+z’ M1

0 1 0 x’yz’ m2 x+y’+z M2

0 1 1 x’yz m3 x+y’+z’ M3

1 0 0 xy’z’ m4 x’+y+z M4

1 0 1 xy’z m5 x’+y+z’ M5

1 1 0 xyz’ m6 x’+y’+z M6

1 1 1 xyz m7 x’+y’+z’ M7

38
Let us consider the function F = x + y’z represented in canonical form as follows:
x Y z F = x + y’z F‟= (x + y’z)’
0 0 0 0 1
0 0 1 1 0
0 1 0 0 1
0 1 1 0 1
1 0 0 1 0
1 0 1 1 0
1 1 0 1 0
1 1 1 1 0

Canonical Sum of Minterms or Sum of Standard Products:


A Boolean function can be expressed algebraically from a given truth table by
forming a minterm for each combination of the variables that produces a 1 in the
function and then taking the OR of all those terms. For example, the value of function
F in above given Table is 1 for the minterms 1, 4, 5, 6, 7. So, the function can be
expressed in canonical sum of minterms or sum of standard products form as follows:
F = m1 + m4 +m5 + m6 + m7.
or
F= Σ(1, 4, 5, 6, 7)
or
F = x’y’z + xy’z’ + xy’z + xyz’ + xyz
The Complement of the function can be represented in canonical sum of
minterms form by the minterms for which the value of F is 0.
F‟ = m0 + m2 +m3
or
F= Σ(0, 2, 3)
or
F = x’y’z’ + x’yz’ + xy’z’

Canonical Product of Maxterms or Product of Standard Sums:


The maxterm with subscript j is a complement of the minterm with the same
subscript j and vice versa.
(mj)’ = Mj
So, the function F, can be expressed in canonical Product of Maxterms or
Product of Standard Sums form as follows:

39
F = M0 . M2 . M3
or
F= Π(0, 2, 3)
or
F = (x+y+z)( x+y’+z)(x+y’+z’)
The Complement of the function can be represented in canonical sum of
minterms form by the minterms for which the value of F is 0.
F‟ = M1 . M4 . M5 . M6 . M7
or
F= Π(1, 4, 5, 6, 7)
or
F = (x+y+z’)(x’+y+z)(x’+y+z’)(x’+y’+z)(x’+y’+z’)

1.10.2 STANDARD FORM:


The canonical form representations for a function can be easily obtained from
the truth table. These forms are very seldom the ones with the least number of literals,
because each minterm or maxterm must contain, by definition, all the variables, either
complemented or un-complemented.
The terms that form the Boolean functions in standard form may contain one,
two, or any number of literals. There are two types of standard forms:
 Sum of Products (SOP)
 Products of Sums (POS)
SOP: The sum of products is a Boolean expression containing AND terms, called
product terms, with one or more literals each. The sum denotes the ORing of these
terms. An example of a function expressed as a sum of products is
F1 = y’ + xy + x’yz’
The logic diagram of expression in SOP form consists of a group of AND
gates followed by a single OR gate, which is also called two-level AND – OR
implementation.
POS: A product of sums is a Boolean expression containing OR terms, called sum
terms. Each term may have any number of literals. The product denotes the ANDing
of these terms. An example of a function expressed as a product of sums is
F2 = x(y’ + z)(x’ + y + z’)

40
The gate structure of the product‐of‐sums expression consists of a group of
OR gates for the sum terms (except for a single literal), followed by an AND gate,
which is also called two-level OR – A ND implementation.
NON STANDARD FORM:
A Boolean function may be expressed in a nonstandard form which is neither
in sum‐of‐products nor in product‐of‐sums form. For example, the function in non-
standard form is represented as:
F3 = AB + C(D + E)
A function in non-standard form can be changed to a standard form by using
the distributive law, so that it can be implemented using two-level gate networks.
F3 = AB + C(D + E) = AB + CD + CE
1.10.3 Conversion from standard form to canonical form
1. Express the Boolean function F(A, B, C) = A + B’C as a sum of minterms.
Solution: The function has three variables: A, B, and C. In canonical form each term
should contain all variables of the function. The first term A is missing two variables;
therefore,
A = A(B + B’) = AB + AB’
This function is still missing one variable, so
A = AB(C + C’) + AB’(C + C’) = ABC + ABC’ + AB’C + AB’C‟
The second term B’C is missing one variable; hence,
B’C = B’C(A + A’) = AB’C + A’B’C
Combining all terms, we have
F = A + B’C= ABC + ABC’ + AB’C + AB’C’ + A’B’C
But AB’C appears twice, and according to theorem 1 (x + x = x), it is possible to
remove one of those occurrences. Rearranging the minterms in ascending order, we
finally obtain
F = A’B’C + AB’C’ + AB’C + ABC’ + ABC
= m1 + m4 + m5 + m6 + m7 = Σ(1, 4, 5, 6, 7)
2. Express the Boolean function F = xy + x’z as a product of maxterms.
Solution: First, convert the function into OR terms by using the distributive law:
F = xy + x‟z = (xy + x’)(xy + z)
= (x + x’)(y + x’)(x + z)(y + z)
= (x’ + y)(x + z)(y + z)

41
The function has three variables: x, y, and z. Each OR term is missing one variable;
therefore,
x’ + y = x’ + y + zz’ = (x’ + y + z)(x’ + y + z’)
x + z = x + z + yy’ = (x + y + z)(x + y’ + z)
y + z = y + z + xx’ = (x + y + z)(x’ + y + z)
Combining all the terms and removing those which appear more than once, we finally
obtain
F = (x + y + z)(x + y’ + z)(x’ + y + z)(x’ + y + z’)
= M0M2M4M5 = Π(0, 2, 4, 5)
1.11 OTHER LOGIC OPERATIONS
22n functions can be formed using n binary variables. Thus, for two variables,
n = 2, and the number of possible Boolean functions is 16. The truth tables for the 16
functions formed with two binary variables are listed in following Table. Each of the
16 columns, F0 to F15, represents a truth table of one possible function for the two
variables, x and y which are determined from the 16 binary combinations that can be
assigned to F. The 16 functions listed can be subdivided into three categories:
1. Two functions that produce a constant 0 or 1.
2. Four functions with unary operations: complement and transfer.
3. Ten functions with binary operators that define eight different operations: AND,
OR, NAND, NOR, exclusive‐OR, equivalence, inhibition, and implication.
 Constants for binary functions can be equal to only 1 or 0.
 The complement function produces the complement of each of the binary
variables.
 A function that is equal to an input variable has been given the name transfer,
because the variable x or y is transferred through the gate that forms the
function without changing its value.
 Out of ten functions, four functions (inhibition and implication) are used by
logicians, but are seldom used in computer logic.
 In the remaining 6 functions, the AND and OR operators have been mentioned
in conjunction with Boolean algebra. The other four functions (NAND, NOR,
XOR, X-NOR) are used extensively in the design of digital systems.

42
1.12 DIGITAL LOGIC GATES
Logic Gate is a digital circuit which performs some logic functions. The logic
gates can be broadly classified in three categories:
 Basic Gates – AND, OR, NOT
 Universal Gates – NAND, NOR
 Exclusive Gates - XOR, XNOR
Factors to be weighed in considering the construction of other types of logic gates are:
(1) The feasibility and economy of producing the gate with physical components,
(2) The possibility of extending the gate to more than two inputs,
(3)The basic properties of the binary operator, such as commutativity and
associativity, and
(4) The ability of the gate to implement Boolean functions alone or in conjunction
with other gates.
Extension of gates to multiple inputs:
The AND, OR gates can be extended to multiple inputs as they satisfy both
commutative and associative property. The NAND and NOR functions are
commutative, but they are not associative (i.e., (x ↓ y) ↓ z ≠ x ↓ (y ↓ z)), hence the
definition of the operation is to be modified slightly to extend the gate to have more
than two inputs. To overcome this difficulty, we define the multiple NOR (or NAND)
gate as a complemented OR (or AND) gate. Thus, by definition, we have
x ↓ y ↓ z = (x + y + z)‟
x ↑ y ↑ z = (xyz)‟

43
Positive and Negative Logic
The binary signal at the inputs and outputs of any gate has one of two values,
except during transition. One signal value represents logic 1 and the other logic 0.
Since two signal values are assigned to two logic values, there exist two different
assignments of signal values to logic levels.
Positive Logic: Choosing the high‐level H to represent logic 1 defines a positive
logic system.
Negative Logic: Choosing the low‐level L to represent logic 1 defines a negative
logic system.

44
Simplification of Boolean functions using algebraic method:

1. A+A‟B = (A+A‟)(A+B)
= 1. (A+B)
= (A+B)
2. AB+A‟B = B(A+A‟)
=B
3. AB+ABC = AB(1+C)
= AB

45

Das könnte Ihnen auch gefallen