# Analog and Digital Conversion/Fixed Wordlength Effects

## Practical Wordlengths

Computer systems, as we know, are commonly 16, 32, or 64 bits. This means that these computers can easily handle data of these lengths. However, smaller hardware and embedded computers can have wordlengths of 4 or 8 bits! If we have a converter that has a resolution of 12 bits, and we attach it to an 8 bit input bus for an embedded controller, we have a severe problem! a full 4 bits of our signal must be truncated.

Also, converters often come prepackaged, with a set number of resolution bits that aren't negotiable. This means that if you need a converter with 13 bits of resolution for your circuit, you will have to make due with a converter that is only 12 bits, or one that is 16!

Some common ADC converter resolution lengths are listed below:

• 4
• 8
• 12
• 16
• 24
• 32

## Round-Off

Let's say that we do have a 12 bit converter, and we need to output the data onto an 8-bit bus. We can either ignore the bottom 4 bits, or the top 4 bits, or we can ignore some combination of both. If we ignore bits from the bottom of the word, we are essentially rounding the signal down, and the signal will lack detail.

Roundoff error is the difference between an approximation of a number used in computation and its exact (correct) value. In certain types of computation, roundoff error can be magnified as any initial errors are carried through one or more intermediate steps.

An egregious example of roundoff error is provided by a short-lived index devised at the Vancouver stock exchange (McCullough and Vinod 1999). At its inception in 1982, the index was given a value of 1000.000. After 22 months of recomputing the index and truncating to three decimal places at each change in market value, the index stood at 524.881, despite the fact that its "true" value should have been 1009.811.

Other sorts of roundoff error can also occur. A notorious example is the fate of the Ariane rocket launched on June 4, 1996 (European Space Agency 1996). In the 37th second of flight, the inertial reference system attempted to convert a 64-bit floating-point number to a 16-bit number, but instead triggered an overflow error which was interpreted by the guidance system as flight data, causing the rocket to veer off course and be destroyed.

The Patriot missile defense system used during the Gulf War was also rendered ineffective due to roundoff error (Skeel 1992, U.S. GAO 1992). The system used an integer timing register which was incremented at intervals of 0.1 s. However, the integers were converted to decimal numbers by multiplying by the binary approximation of 0.1, 0.00011001100110011001100_2=(209715)/(2097152).

As a result, after 100 hours (3.6×10^6 ticks), an error of (1/(10)-(209715)/(2097152))(3600·100·10)=(5625)/(16384) approx 0.3433 second

had accumulated. This discrepancy caused the Patriot system to continuously recycle itself instead of targeting properly. As a result, an Iraqi Scud missile could not be targeted and was allowed to detonate on a barracks, killing 28 people.

## Truncation

The act of simply ignoring bits from either end of the word is called Truncation, but when we truncate the bits from the LSB side of the word, we call that action "Rounding". When we truncate the bits off the top of the machine word, we are potentially losing large amounts of data. For instance, if we have the bit pattern 101001, and we truncate the two MSB bits, we are left with the bit pattern 1001. Let's convert this to decimal:

• 101001 (binary) = 41 (decimal)
• 1001 (binary = 9 (decimal)

There is a big difference betweenthe value 9 and 41. As we can see, all our highest values will appear to be low values, and the output will be nonsensical. Another option is called saturation. Saturation is like rounding, except that we round up. We truncate the top bits off, and if they aren't zero, then we round the rest of the number up to the maximum value. For instance, if we have the same bit pattern as above (101001), and we truncate off the two MSB bits and then we saturate, we will get the value 1111. Now, we can define this value to be an overflow condition, and we won't be compounding needless errors.