Study Material For BEE (Textbook) Part-1
Study Material For BEE (Textbook) Part-1
1.1 INTRODUCTION
The term digital in digital circuits is derived from the way circuits perform operations
by counting digits. Adigital circuit operates with binary numbers, i.e., only in two
states. The output of the circuit is either low (0) or high (1) in a positive logic system.
In general, 0 represents zero volts and 1represents five volts. If the situation is
reverse, it is known as a negative logic system.
In digital systems, as explained above, the data is usually in binary states
(0 and l)and is processed and stored electronically to prevent errors due to noise and
interfering signals. At present, digital technology has progressed remarkably from
vacuum-tube circuits to integrated circuits, microprocessors and microcontrollers.
Digital circuits find applications in computers, telephony, data processing, radar navi
gation, military systems, medical instruments and consumer products. The general
properties of number systems, methods of conversion from one to another, arithmetic
operations, weighted codes, non-weighted codes, error detecting and correcting codes
are discussed in this chapter.
1.2 NUMBER SYSTEM
The decimal number system (0, 1,2, .., 9) is commonly used eventhough there are
many other number systems like binary, octal, hexadecimal, etc. It is possible to ex
press a number in any base or radix X". In the binary system, the base is 2. In general.
any number with radix X, having mdigits to the left and n digits to the right of the
decimal point, can be expressed as:
is a,(Xyt a,mui
tlhc digit in (Xyt..
postuon.t a,(k +a,(Xy", +a6,()'+
Ine coeriicient b,(1)
is termed ?t.+Mostb()"
as the where
Sign1ticant
Digit (MSD)and b. is termed as the Least Significant Digit (LSD).
1.2.1 Binary Numbers
The Binary number system is simple because it consists of only twodigits, i.e. O
and 1.
Just as the decimal system with its ten digits is a base-ten system, the binary system
with its two digits is a base-two system. The position of 0or Iin a binary number
indicates its "weight" within the number. In a binary number, the weight of each sue
cessively higher position to the left is an increasing power of two.
2 Digital Cireuits and Design
Positional Weights
Similarly. binary numbers are also represented by positional weights.
For example.
(198),0 = (11000110);
-lx2'+1x2° +0x2 +0x2* +0x2' +Ix2' +0x20
= 128 +
64+0+0+0+4+2+0= 198
In the digital system, each of the binary
agroup of4 and 8 bits are called a nibble and a byte
digits is called a bit and
respectively. The highest
decimal
number that can be represented by n-bits binary number is 2"- I(beginning with
zero). Thus, with an 8-bit binary number, the maximum decimal number that can be
represented is 28- | = 255.
1.2.2 Decimal-Binary Conversion
An easy method of converting a decimal number into a binary number is by
the decimal number by 2 progressively, until the quotient of zero is dividing
obtained. The
binary number is obtained by taking the remainder after each division in the reverse
order. This method is popularly known as the double-dabble method. The
for decimal to binary conversion is described in the following example. procedure
Example I.1 Convert the decimal number 53-625 into an equivalent binary number.
Solution
Multiplication Generated
1nteger
(0-625 x2 = 125’ 1 ’ MSB
0-250 x 2= 0-50’
0-500 x2= 1·00-> 1
0-000 x 2 = 0.00 ->
Further multiplication by two is not possible since the product is zero. The binary
equivalent is obtained by reading the carry terins from top to bottom. Thus, (0-625))o
is (0:101),. The combined number will give the binary
equivalent as
(53-625)0 =(110101-101)).
Example 1.2 Convert the binary number (101111-1101), intoits decimal equivalent.
Solution Abinary number can be converted into a decimal number by multiplying
the binary numbers l or 0 by their weight and adding the products.
101 111
Lix20 = 1
lx 2 = 2
-lx 22 = 4
-1 x 23 = 8
-0x 24 =
-l x 29 = 32
47
The Octal number system uses the digits 0, 1, 2,3,4, 5, 6 and 7, The base or radix of
this system is eight. Each significant position in an octal number has a positiOnal
4 Digital Circuits and Design
weight. The least significant position has aweight of 8", i.e. I; the higher signiticans
positions are given weights in the ascending powers of eight, i.e. 8',8,83
respectively. The octal equivalent of adecimalnumber can be obtained by dividing a
given decimal number by 8 repeatedly, untila quotient of 0is obtained. The procedure
is exactly the same as the double-dabble method explained earlier. The decimal to
octal conversion method is explained in the following example.
Reading the remainders from bottom to top, the decimal number (444)0 is equiva
lent to octal (674):
Fractional conversion:
Multiplication Generated integer
0.456x8= 3-648’ 3
0-648 x8=5·184-’ 5
0-184 x8= l·472 ’
0.472 x 8= 3·776 -’ 3
0-776x8= 6-208 -’ 6
The conversion from an octal to decimal number can be done by multiplying cach
significant digit of the octal number by its respective weight and adding the products.
The following example illustrates the conversion from octal to decimal.
Example 1.4 Convert the octal numbers (a) (237)% and (b) (120), to decimals.
Solution (a) (237), = 2x8 +3x8' +7x8
= 2x64+3×8+7x1
=128+24 +7
= (159)0
(b) (120)% = 1x8 +2x8' +0x8°
= lx64 +2x8 +0xI
= 64 +16+0
= (80),0
Number Svstem and Codes 5
Example 1.5 Convert (a) (115)10 and (b) (235),o to hexadecimal numbers.
Solution
(a) Division Remainder
16) 115
16)7 3
16) 0 7
Reading the remainders from bottom to top, the decimal number (1 150 is equiva
lent to the hexadecimal (73)16. The hexadecimal (73)16 can also be represented as
73 H.
(b) Division Remainder
16) 235
16)14 11’B
16) 0 14’ E
Reading the remainders from bottom to top, the decimal number (235)o is equiva
lent to hexadecimal (EB)\6
6 Digiial Circuits and Design
= (2619),0
(b) 2F3H =(2F3),, = 2x16* +Fx16' +3x16°
= 2x 256+15x16+3x1
= 512+240+3
= (755),0
Conversion from
hexadecimal to octal and vice versa is sometimes required. To con
vert a hexadecimal number to octal, the follov. ing
steps can be applied.
() Convert the given hexadecimal
number to its binary
(ii) Form groups of 3bits, starting from the LSB (least equivalent.
(iii) Write the equivalent octal number for each significant digit).
group 3 bits.
of
Number System and Codes 7
For example,
(47)16 =(0100 0111)2
= (01000111))
= (107)%
Thus, 47 in hexadecimal is equivalent to 107 in the
octalnumber system.
To convert an octal number to
hexadecimal, the steps are as follows:
(i) Convert the given octal
number to its binary
(ii) Formn groups of 4 bits, starting from the LSB.equivalent.
(ii)) Write the equivalent
hexadecimal number for each group of 4 bits.
For example,
(32)% =(011 010,2
= (01 1010),
= (1A)6
Thus, 32 in octal is equivalent to lA in the
hexadecimalnumber system.
1.3 FLOATING POINT
OF NUMBERS REPRESENTATION
In the decimal system, very large and very
small numbers are
notation as follows: 4-69x10 and 1-601lx10 Binary expressed in scientific
numbers can also be ex
pressed by the floating point representation. The floating point
number consists of two parts: the first part represents representation of a
a signed, fixed point number
called the mantissa (m); the second part designates the
position of the decimal (or
binary) point and is called the exponent (e). The fixed point
tion or an integer. The number of bits required to mantissa may be a frac
express the exponent and mantissa is
determined by the accuracy desired from the computing system as well as its
ity to handle such numbers. For example, the capabil
sented in floating point as follows:
decimal number + 6132.789 is repre
sign sign
0-6132789 0 04
mantissa exponent
The mantissa has a0 in the leftmost position to
is considered to be a fixed point denote a plus. Here, the mantissa
fraction. This representation is equivalent to the
number expressed as a fraction 10 times by an exponent, that is
Because of this analogy, the mantissa is sometimes called j lClion 0.6132780 1oni.
par.
Consider, for example acompuci that assumes integer representation for the
mantissa and radix 8 for the numbers. Theoctal number + 36.754
floating point representation will look like this: =36754 x 8 in its
sign Sign
0 36754 I03
Imant1ssa exponent
8 Digital Circuits and Design
Arithmetic operations in a computer are done using binary numbers and not decimal
numbers and these take place in its arithmetic unit. The electronic circuit of a binary
adder with suitable shift register can perform all arithmetic operations.
1.4.1 Binary Arithmetic
The arithmeticrules for Addition,Subtraction, Multiplication and Division of binary
numbers are given below:
Addition Substraction Multiplication Division
(i) 0+0 =0 0-0= 0 0 x0= 0 0x1=0
(ii) 0+ | = 1 1-0=1 0x|=0 1x | =1
(i) 1+0= 1 1-|=0 1x0 =0 0 x0 =not allowed
(iv) 1+ |= 10 10-1 =I 1x |= 1 l x0=not allowed
Binary addition Two binary numbers can be added in the same way as two deC
mal numbers are added. The addition is carried out from the least significant bits and
rnrepds to higher significant bits, adding the carry resulting from the previoUs
addition each timt. Cunnider the addition of the binary number 1010 and
1l.
MSB LSB Daaimal
15
|010 10
I100 I 25
The addition carried out above can be explained as follows:
Step I The least significant bits are added, i.e. 0 + |=lwith acarry 0.
Number System and Codes 9
Step 2 The carry in the previous step is added to the next
ie. 1+1+0 =0 with acarry 1. higher significant bits,
Step 3 The carry in the above step is added to the next higher
i.e. 0 + 1+|=0 with a carry 1. significant bits.
Step 4 The preceding carry is added to the most significant bits, i.e.
with a carry 1. |+|+|=1
Thus, the sum is 1 1001. The addition is also shown in the decimal
number system
in order to compare the results.
Binary subtraction Binary subtraction is also carried out in the same way as deci
mal numbers are subtracted. The subtraction is carried out from the least
significant
bits and proceeds to the higher significant bits. When I is subtracted from 0, a l is
borrowed from the immediate higher significant bit. The following problem explains
the steps involved. Suppose that 1001 is subtracted from 1101.
Case 1:
Decimal
1 001
0 11 I 7
0 01 0 2
The steps are described below.
Step I The least significant bits in the first column are landLU-., ne diflerence
is 1 -] =0.
Step 2 In the coeo1d UUmn, it IS not possible to subtract the 1from 0. So. a l has to
be borrowed from the next MSB (3rd bit). But since the 3rd bit is also 0,
.borrowing has to be done from the MSB (4th bit). The borrowing of 1from
the 4th bit (with weight 8) results in I and 10 with weight 4 in the 3rd column
and Oin 4th column as shown above. Now, the subtraction is performed as
10 -|= 1.
Step 3 In the third column, the difference is given by 1- |=0.
10 Digital Circuits and Design
Example 1.8 Multiply the following binary numbers: (a) 1011 and 1101, (b) 100110
and 1001 and (c) 1·01 and 101.
Solution
(a) 1011xl101
10 1 1
101 1
0 0 0 0
1 0 11
1 0 1 1
0 11 1 1
(b) 100110 x 1001
100 11 0
x 10 0 1
1 00 1 10
0 0 0 0 0 0
00 0 0 0 0
1 0 0 1 1 0
10 1 0 10 1 1 0
(c) 1.01×10.1
1. 0 1
1 0.
1 0 1
10 1
1 1: 0 0 1
Number System and Codes 1
Binary division Division in binary follows the same procedure as division in deci
mal. Division by 0 is meaningless. An example is given below.
Example 1.10 Subtract (1010), from (|111), using the l's complement method.
Also subtract using direct method and compare.
12 DigitalCircuits and Design
Solution
Direct subtraction l'sComplement method
-I 0 1 0 I's Complement ’ IIT1(+)
0 10 I
0 1 0 1 Carry ’ I0 10 0
Add Carry
0 10 |
Subtraction of alarger number from a smaller one by the l's complement method
involves the following steps:
(i) Determine the 1's complement of the larger number.
(ii) Add this to the smaller number.
(iii) The answer is the l's complement of the true
There is no carry.
result and is opposite in sign.
Example 1.13 Subtract (1010), from (1000), using 2's complement method. Sub
tract by direct method also and compare.
Solution
Direct subtraction 2's Complement method
1 00 0 0 00(+)
-1 0 10 2's Complement 01 1 0
0 01 0 No carry 11 1 0
No carry is obtained. Thus, the difference is negative and the true answer is the
2's complement of (1110),, i.e. (0010), .
Though both l's and 2's complement methods of subtraction seem complex com
pared to the direct method of subtraction, both have distinct advantages when applied
using logic circuits, because they allow subtraction to be done using only addition.
The l's and 2's complements of abinary number can be easily arrived at using logic
circuits; the advantage in 2's complement method is that the end-around-carry opera
tion present in the l's complement method is not involved here.
1.5.3 Signed Binary Number Representation
Binary numbers are represented with a separate sign bit along with the magnitude, as
shown below. For example, in an 8-bit binary number, the MSB is the sign bit and the
remaining 7 bits correspond to magnitude. The magnitude part contains true binary
equivalent of the number for positive numbers, while 2's complement form of the
number for negative numbers. For example, +13, 0, -46 are represented as follows:
Sign Magnitude
+3 0 000 1101
000 0000
When the number of bits in the sum exceeds the number of bits in each of the numbers
added, overflow results. This appears in the ninth significant place, and is also called
the excess-one. Overflow causes a sign change.
Assume that both the input numbers are in the range of-128 to +127. The problem
arises onlywhen the arithmetic circuit adds two positive numbers or two negative num
bers. In such a case, it is possible for the sum to be outside the range of-128 to +127.
Case 1 Two Positive Numbers
Consider the addition of +120 and +65. As the decimal sum of +120 and +65 is
+185, an overflow occurs into the MSD position. This overflow forces the sign bit of
the answer to change.
+120 0111 1000
+ 65 +0100 0001
(185) 1011 1001
As the sign bit is 1, i.e. negative, the answer is not
correct.
Number System and Codes 17
Example 1.14 Find the 9's complement of each of the following decimal numbers:
(a) 19 (b) 146 (c) 469 and (d) 4397
Solution Subtract each digit in the number from 9 to get the 9's complement.
18 Digital Circuits and Design
(a) 99
19
80 -’ 9's Complement of 19
(b) 999
146
853 ’ 9's Complement of 146
(c) 999
469
530 ’ 9's Complement of 469
(d) 9999
- 4397
5602 ’ 9's Complement of 4397
1.6.1 9's Complement Subtraction
Subtraction of a smaller decimal number from a
system is done by the addition of the 9's complementlarger one in the 9's complement
of the subtrahend to the minuend
and then adding the carry to the result. Subtraction of a
larger
one does not produce a carry, and the result is a negative in thenumber from a smaller
This procedure has a distinct advantage in certain types of 9's complement form.
arithmetic logic.
Example 1.15 Perform the following subtractions by using the 9's
(a) 18-06, (b) 39-23, (c) 34-49 and (d) 49-84. complement method:
Solution
(a) Regular subtraction 9's Complement subtraction
18 18
06
+93 -9's Complement of 6
12 -()11
+1 Add carry to result
12
(b) 39 39
-23 +76 49's Complement of 23
16 -(1)15
+1 Add carry to result
16
(c) 34 34
- 49 + 50
-15
+9'sComplement of 49
84
(d) 49
-15 9's Complement of 84
49
84
+ 15 +9'sComplement of 84
-35 64
0- 9's
+1
Complement of 9
l+ 10'sComplement of 9
(b) 99
46
53 4- 9'sComplement of 46
+1
54 - 10' s Complement of 46
(c) 999
739
260 9's Complement of 739
+1
261 10's Complement of 739
1.7.1 10's Complement Subtraction
In the 10's complement method of
subtraction,the minuend is added to the 10's comple
ment of the subtrahend and the carry is dropped.
1.8.2 BCDSubtraction
Metlhod I Table 1.2shows an algorithnm for BCD
ofthe BCD subtrahend is entered into adder 1, and thesubtraction.
The J's complement
istransferred to adder 2, where either a 1010 or 0000 iscomplement (true) of the result
added,
of the total result. Examples of a positive and negative total depending the sign
on
result are given in Table
1.2. Arrows indicate EAC (end-around-carry) or carry to the next
decade.
Table 1.2 Algorithm for BCD subtraction
Decade Signof totalresult
result
(+) EAC=1 ()EAC =0
Transfer true results Transfer 1's complement
of adder| of result of adder 1
0000 added 1010 added
in adder 2 in adder2
C=0 1010added in 0000 added
adder 2 in adder 2
Total Result Positive:
Method II Another method in BCD subtraction is the addition of the 9's comple.
ment of the subtrahend to the minuend.
Example 1.19 Subtract 748 from 983 using 9's complement method.
Solution
983 983
-748 + 251 + 9's Complement of 748
235 234
+EAC
235
Ignore carry
(b) 473 473
438 + 562 + 10'sComplement of 438
35 035
Ignore carry
(c) 357 357
- 294 +706 t- 10's Complement of 294
63 063
Ignore carry
Example 1.22 Carry out BCD subtraction for (68)-(61) using 10's complement
method.
Solution
68 68 0110 1000
-61 39 10's Complement of 61 0011 |001
07 I 07 1010 000
Ignore carry 0110 0110 Add 6
| 0000 011|
Ignore carry
1.9 CODES