31.3 Saturation, Scaling, and Overflow

In the majority of DSP applications, overflow or underflow during computation is not desirable. It is best to design for appropriate scaling of the data path and avoid the possibility of overflow and underflow. However, such scaling can significantly limit the usable data range. Hence, many algorithm implementations relax the scaling and introduce saturation operations that clip the values that would otherwise overflow to the maximum or minimum limit of the data range.

Some of the general purpose DSP library module functions accumulate a series of values before producing the final result. Examples of these accumulations could include the vector dot product calculation, the FIR filter, the sum of squared values and even the FFT transform. All of these functions, with the exception of the FFT, include a parameter that controls the output scaling, i.e., additional amount of right shift applied when the result is converted to a Q15 value. The FFT results are automatically scaled down by 2log2(N).