58
Digital Electronics
0110 1000 represents the excess-3 code for the true result. The result in BCD code is 1001 0011 0101,
which is the BCD equivalent of 935. This is the correct answer as the addition of the given BCD
numbers 0011 0101 0110 = (356) 10 and 0101 0111 1001 = (579) 10 yields (935) 10 only.
Example 3.7
Perform (185) 10 − (8) 10 using the excess-3 code.
Solution
• (185) 10 = (0001 1000 0101) BCD .The excess-3 equivalent of (0001 1000 0101) BCD = 0100 1011
1000.
• (8) 10 = (008) 10 = (0000 0000 1000) BCD . The excess-3 equivalent of (0000 0000 1000) BCD = 0011
0011 1011.
• Subtraction is performed as follows:
0100 1011 1000
− 0011 0011 1011
0001 0111 1101
• In the subtraction operation, the least significant column of four-bit groups needed a borrow, while
the other two columns did not need any borrow. Also, the least significant column has produced an
invalid BCD code group. Subtracting 0011 from the result of this column and adding 0011 to the
results of other two columns, we get 0100 1010 1010. This now constitutes the result of subtraction
expressed in excess-3 code.
• The result in BCD code is therefore 0001 0111 0111.
• The decimal equivalent of 0001 0111 0111 is 177, which is the correct result.
3.5 Binary Multiplication
The basic rules of binary multiplication are governed by the way an AND gate functions when the
two bits to be multiplied are fed as inputs to the gate. Logic gates are discussed in detail in the next
chapter. As of now, it would suffice to say that the result of multiplying two bits is the same as the
output of the AND gate with the two bits applied as inputs to the gate. The basic rules of multiplication
are listed as follows:
1. 0 × 0 = 0.
2. 0 × 1 = 0.
3. 1 × 0 = 0.
4. 1 × 1 = 1.
One of the methods for multiplication of larger-bit binary numbers is similar to what we are
familiar with in the case of decimal numbers. This is called the ‘repeated left-shift and add’ algorithm.
Microprocessors and microcomputers, however, use what is known as the ‘repeated add and right-shift’
algorithm to do binary multiplication as it is comparatively much more convenient to implement than
the ‘repeated left-shift and add’ algorithm. The two algorithms are briefly described below. Also, binary
multiplication of mixed binary numbers is done by performing multiplication without considering the
Digital Electronics
0110 1000 represents the excess-3 code for the true result. The result in BCD code is 1001 0011 0101,
which is the BCD equivalent of 935. This is the correct answer as the addition of the given BCD
numbers 0011 0101 0110 = (356) 10 and 0101 0111 1001 = (579) 10 yields (935) 10 only.
Example 3.7
Perform (185) 10 − (8) 10 using the excess-3 code.
Solution
• (185) 10 = (0001 1000 0101) BCD .The excess-3 equivalent of (0001 1000 0101) BCD = 0100 1011
1000.
• (8) 10 = (008) 10 = (0000 0000 1000) BCD . The excess-3 equivalent of (0000 0000 1000) BCD = 0011
0011 1011.
• Subtraction is performed as follows:
0100 1011 1000
− 0011 0011 1011
0001 0111 1101
• In the subtraction operation, the least significant column of four-bit groups needed a borrow, while
the other two columns did not need any borrow. Also, the least significant column has produced an
invalid BCD code group. Subtracting 0011 from the result of this column and adding 0011 to the
results of other two columns, we get 0100 1010 1010. This now constitutes the result of subtraction
expressed in excess-3 code.
• The result in BCD code is therefore 0001 0111 0111.
• The decimal equivalent of 0001 0111 0111 is 177, which is the correct result.
3.5 Binary Multiplication
The basic rules of binary multiplication are governed by the way an AND gate functions when the
two bits to be multiplied are fed as inputs to the gate. Logic gates are discussed in detail in the next
chapter. As of now, it would suffice to say that the result of multiplying two bits is the same as the
output of the AND gate with the two bits applied as inputs to the gate. The basic rules of multiplication
are listed as follows:
1. 0 × 0 = 0.
2. 0 × 1 = 0.
3. 1 × 0 = 0.
4. 1 × 1 = 1.
One of the methods for multiplication of larger-bit binary numbers is similar to what we are
familiar with in the case of decimal numbers. This is called the ‘repeated left-shift and add’ algorithm.
Microprocessors and microcomputers, however, use what is known as the ‘repeated add and right-shift’
algorithm to do binary multiplication as it is comparatively much more convenient to implement than
the ‘repeated left-shift and add’ algorithm. The two algorithms are briefly described below. Also, binary
multiplication of mixed binary numbers is done by performing multiplication without considering the
