Main Content

The Summation Process

Addition is the most common arithmetic operation a processor performs. When two n-bit numbers are added together, it is always possible to produce a result with n + 1 nonzero digits due to a carry from the leftmost digit.

Suppose you want to sum three numbers. Each of these numbers is represented by an 8-bit word, and each has a different binary-point-only scaling. Additionally, the output is restricted to an 8-bit word with binary-point-only scaling of 2-3.

The summation is shown in the following model for the input values 19.875, 5.4375, and 4.84375.

The sum follows these steps:

  1. Because the biases are matched, the initial value of Qa is trivial:

    Qa=00000.000.

  2. The first number to be summed (19.875) has a fractional slope that matches the output fractional slope. Furthermore, the binary points and storage types are identical, so the conversion is trivial:

    Qb=10011.111,QTemp=Qb.

  3. The summation operation is performed:

    Qa=Qa+QTemp=10011.111.

  4. The second number to be summed (5.4375) has a fractional slope that matches the output fractional slope, so a slope adjustment is not needed. The storage data types also match, but the difference in binary points requires that both the bits and the binary point be shifted one place to the right:

    Qc=0101.0111,QTemp=convert(Qc)QTemp=00101.011.

    Note that a loss in precision of one bit occurs, with the resulting value of QTemp determined by the rounding mode. For this example, round-to-floor is used. Overflow cannot occur in this case because the bits and binary point are both shifted to the right.

  5. The summation operation is performed:

    Qa=Qa+QTemp     10011.111=+00101.01111001.010=25.250.

    Note that overflow did not occur, but it is possible for this operation.

  6. The third number to be summed (4.84375) has a fractional slope that matches the output fractional slope, so a slope adjustment is not needed. The storage data types also match, but the difference in binary points requires that both the bits and the binary point be shifted two places to the right:

    Qd=100.11011,QTemp=convert(Qd)QTemp=00100.110.

    Note that a loss in precision of two bit occurs, with the resulting value of QTemp determined by the rounding mode. For this example, round-to-floor is used. Overflow cannot occur in this case because the bits and binary point are both shifted to the right.

  7. The summation operation is performed:

    Qa=Qa+QTemp     11001.010=+00100.11011110.000=30.000.

    Note that overflow did not occur, but it is possible for this operation.

As shown here, the result of step 7 differs from the ideal sum:

 10011.111   0101.0111=+100.1101111110.001=30.125.

Blocks that perform addition and subtraction include the Sum, Gain, and Discrete FIR Filter blocks.