**3.2.2 HARDWARE IMPLEMENTATION OF ADDERS AND SUBTRACTORS**

Up until now we have focused on algorithms for addition and subtraction. Now we will take a look at implementations of simple adders and subtractors.

**Ripple-Carry Addition and Ripple-Borrow Subtraction**

In Appendix A, a design of a four-bit ripple-carry adder is explored. The adder is modeled after the way that we normally perform decimal addition by hand, by summing digits in one column at a time while moving from right to left. In this section, we review the

Figure 3-2 shows a 4-bit ripple-carry adder that is developed in Appendix A. Two binary nnumbers A and B are added from right to left, creating a sum and a carry at the outputs of each full adder for each bit position.**ripple-carry adder**, and then take a look at**a****ripple-borrow subtractor**. We then combine the two into a single addition/subtraction unit.Four 4-bit ripple-carry adders are cascaded in Figure 3-3 to add two 16-bit numbers. The rightmost full adder has a carry-in of 0. Although the rightmost full adder can be simpliﬁed as a result of the carry-in of 0, we will use the more general form and force c0 to 0 in order to simplify subtraction later on.

**Subtraction**of binary numbers proceeds in a fashion analogous to addition. We can subtract oone number from another by working in a single column at a time,subtracting digits of the

**subtrahend**bi, from the minuend ai, as we move from right to left. As in decimal subtraction, if the subtrahend is larger than the minuend or there is a borrow from a previous digit then a borrow must be propagated to the next most signiﬁcant bit. Figure 3-4 shows the truth table and a “black-box” circuit for subtraction.

Full subtractors can be cascaded to form

**ripple-borrow**subtractors in the same

manner that full adders are cascaded to form ripple-carry adders. Figure 3-5 illustrates a four-bit ripple-borrow subtractor that is made up of four full subtractors.

As discussed above, an alternative method of implementing subtraction is to form the two’s complement negative of the subtrahend and add it to the minuend.

The circuit that is shown in Figure 3-6 performs both addition and subtraction on four-bit two’s complement numbers by allowing the bi inputs to be complemented when subtraction is desired. An ADD/SUBTRACT control line determines which function is performed. The bar over the ADD symbol indicates the ADD operation is active when the signal is low. That is, if the control

line is 0, then the ai and bi inputs are passed through to the adder, and the sum is generated at the si outputs. If the control line is 1, then the ai inputs are passed through to the adder, but the

bi inputs are one’s complemented by the XOR gates before they are passed on to the adder. In order to form the two’s complement negative, we must add 1 to the one’s complement negative, which is accomplished by setting the

line is 0, then the ai and bi inputs are passed through to the adder, and the sum is generated at the si outputs. If the control line is 1, then the ai inputs are passed through to the adder, but the

bi inputs are one’s complemented by the XOR gates before they are passed on to the adder. In order to form the two’s complement negative, we must add 1 to the one’s complement negative, which is accomplished by setting the

*carry_in*line (c0) to 1 with the control input. In this way, we can share the adder hardware among both the adder and the subtractor.
## No comments:

## Post a Comment