Chapter 5
Chapter 5
ARITHMETIC
CIRCUITS
Objectives
Binary addition is performed in the same way as decimal addition except that
the values of individual digits can only be 0 or 1. The addition of a one-bit
number has 4 possible combinations as shown below.
When adding a larger numbers that has multiple bits, it is still necessary to
add each pair of bits with a carry-in Cin. For example, A=1101 (13) and
B=0110 (6).
The 1s column is producing the outputs Sum S and Carry Out Cout.
1
The carry out C0 is carried to 2s column as Cin. In the 2s column, we have
producing the outputs S dan C The Co is carried to the 4s
2 out.
The 1s column adds 2 bits and generates 2 outputs S and Co. This is
known as a half adder operation.
The half adder truth table and circuit are shown below.
63 Arithmetic Circuits
The 2s, 4s and 8s columns add 3 bits and generates S and Cout,
which known as a full adder operation.
The full adder truth table and circuit are shown below.
64 Arithmetic Circuits
To construct a 4 bit parallel adder, a single half adder and three full adder
circuits are used. The top half adder adds the 1s column ( ) and
generates S1 and Co. The 2s, 4s and 8s columns use a full adder. Note that
the carry out Co is connected to the Cin of the next adder.
7483 is a commercial 4-bit full adder. It has four full adders connected as
shown below. To perform a 4 bit addition, the Cin is connected to GND (0).
65 Arithmetic Circuits
An 8-bit parallel adder is constructed using two 7483 ICs. The Cout of the first
IC is connected to the Cin of the preceding IC.
Example 1: Find the 2’s complement number for +30 and -30.
011110
100001
+1
100010
68 Arithmetic Circuits
00011110
11100001
+1
11100010
Example 3: Determine the decimal value for the following 2’s complement
number: a. 00100010 b. 10100010 c. 11111111
a. From the sign bit, 00100010 is a positive number. The decimal value is
+34.
b. From the sign bit, 10100010 is a negative number. Complement each bit
and add 1. The decimal value is -94.
c. From the sign bit, 11111111 is a negative number. Complement each bit
and add 1. The decimal value is -1.
The number of bits available in the computer’s arithmetic unit, limits the
range of numbers that can be represented in the machine. Numbers that fall
outside this range cannot be handled by the system. Machines that uses 2’s
complement number system can represent integers in the range
Example 1: Determine the range of integers that can be represented in the 2’s
complement number system having n bits:
a. n= 8 bit b. n=16 bit c. n= 32 bit
8-1 8-1
a. - 2 to + 2 -1 : -128 (10000000) to +127 (01111111)
b. - 32,768 to + 32,767
c. – 2,147,483,648 to 2,147,483,647
We will now learn how to add and subtract using 2’s complement system.
Four cases will be considered: A+B, A-B, -A+B and –A-B.
Since both A and B are positive, the result will also be positive. So, there is no
need to use the 2’s complement.
Example 1: 2+ 4 = +6
There are cases when an operation produces a result that exceeds the range of
the number system, producing a condition known as overflow. When we add
two numbers with the same sign, which produce a sum that is larger than the
largest representable number, we can obtain an incorrect result. As a rule,
addition overflow occurs whenever the sign of the sum is different from the
signs of both addends.
70 Arithmetic Circuits
Example 1: 6+3=-7
The result 1001 is interpreted as -7. The sign bit shows that it is a negative
number. The correct answer is +9, which is outside the 4-bit 2’s complement
range [-8,+7]. Hence an overflow condition has occurred. The sum of the two
given numbers requires more than the allotted 4 bits to represent it.
The result 10011 is interpreted as -13. The correct answer is +19, which is
outside the 5-bit 2’s complement range [-16,+15]. The sum of the two given
numbers requires more than the allotted 5 bits to represent it.
The range for a 5-bit 2’s complement is [-16,+15]. Since the sign bit is 0, it
correctly represents the desired answer which is interpreted as +9.
The range for a 6-bit 2’s complement is [+32,-31]. Since the sign bit is 0, it
correctly represents the desired answer which is interpreted as +19.
The sum is +46 which requires at least 7 bits, where the range for a 7-bit 2’s
complement is [-64,+63].
Example 1: -3-2 = -5
Adding two negative numbers will generate a negative sum as indicated by the
1 sign bit. We ignore the carry beyond the sign bit. Therefore, the result is
1011 = -5.
Example 2: -12-5
The sum is -17 which requires 6 bits. The range for a 6-bit 2’s complement is
[-32,+31].
Suppose we use 5 bits to compute -12-5, the answer is 01111 = +15. Note that
the sign bit (0) is incorrect, indicating an overflow. The desired result (-17)
exceeds the number range for a 5-bit 2’s complement [-16,+15].
Case 3: A-B
Example 1: 3-2 = 1
Add the two numbers. Ignore the carry beyond the sign bit. The result is 0001
= +1.
Example 2: 12-5
Example 3: 5-12
Case 4: -A+B
Add the two numbers. Ignore the carry beyond the sign bit. The result is 1111
= -1.
The 4-bit parallel adder can be modified slightly to form a subtractor circuit.
Subtraction S= A-B in the 2’s complement number system is performed as
follows:
The 2’s complement for B is obtained by complementing each bit and then
adding 1 to the LSB.
74 Arithmetic Circuits
The diagram shown below is a 4-bit subtractor circuit using a 7483 adder and
NOT gates.
This circuit can only accept values between -7 (1001) and +7 (0111), and the
result is also limited to values between -7 to +7. Some arithmetic operation
can result in an overflow condition if the output result is beyond the range of
valid numbers.
Example 1: 7-1=6
75 Arithmetic Circuits
Example 2: 7-0=7
This circuit can accept values between -127 (10000001) and +127
(01111111), and the result is also limited to values between -127 to +127.
Example 1: 127-0=127
76 Arithmetic Circuits
Example 2: 7-1=6
The 4-bit adder and subtractor circuits are almost identical. These circuits
can be combined to form an adder-subtractor circuit. The circuit has an
additional input called the control input. If the control input is 0, the circuit
performs addition, , where Cin=0. If the control input is 1, the
circuit performs subtraction , where Cin=1.
77 Arithmetic Circuits
The 4 bit adder-subtractor circuit is shown below. When the control input is
1, the input Cin=1 and the XOR gate will act as inverter to perform
subtraction. When the control input is 0, the input Cin=0 and the XOR gate
has no effect on B.
78 Arithmetic Circuits
5.9 Exercises