## Saturday, 5 October 2013

BCD, or binary-coded decimal, represents the 10 decimal digits in terms of binary numbers. It is possible to build digital hardware that man-ip-ulates BCD directly, and such hardware could be found in early com-puters and many hand-held calculators. The BCD system was chosen for the internal number system in these machines because it is easy to convert it to alphanumeric representations for printouts and displays. The compelling advantages of BCD have waned over time, and these digits are supported by more modern hardware simply to provide backward compatibility with earlier generations of machines. In this section, we briefly examine the approaches for constructing BCD arithmetic -elements.

### 5.4.1 BCD Number Representation

We have met BCD representation in the previous chapters. The decimal digits 0 through 9 are represented by the 4-bit binary strings 0000 through 1001. The remaining 4-bit encodings, 10102 through 11112, are treated as don't cares.

Just as in conventional decimal addition, BCD addition is performed one decimal digit at a time. The question is, what happens when the sum exceeds what can be represented in 4 bits? Stated differently, what are the conditions under which a carry is generated to the next highest-order BCD digit?
For example, let's consider the addition of the two BCD digits 5 and 3:

Now consider the sum of 5 and 8:

The sum is 11012 = 13, but this result should be correctly represented as 0001 0011 in BCD notation. Fortunately, there is a simple way to find the correct result. We add 6 `(`01102`)` to the digit sum if it exceeds 9. Let's examine the following cases:

In both cases, by adding six we obtain the correct answer in BCD. This observation is critical to the design of a BCD adder, as we shall see in the next subsection.

Figure 5.27 gives a block diagram implementation for a BCD adder. The first row of full adders implements a conventional 4-bit binary adder. The second row provides the capability to add 01102 when the sum obtained by the first row exceeds 9 `(`10012`)`.