Digital Signal Processing Reference
In-Depth Information
Truncating the least significant bits to convert the result to Q-3 format, we have
0:010 0:100 ¼ 0:001
Note that 0:001 ¼ 2
3
¼ 0:125. We can also verify that 0.25 0.5 ¼ 0.125.
The Q-format number representation is a better choice than the 2's complement integer repre-
sentation, it can prevent multiplication overflow. But we need to be concerned with the following
problems.
1.
When converting a decimal number to its Q-
N
format, where
N
denotes the number of magnitude
bits, we may lose accuracy due to the truncation error, which is bounded by the size of the interval,
that is, 2
N
.
2.
Addition and subtraction may cause overflow, where adding two positive numbers leads to
a negative number, or adding two negative number yields a positive number; similarly,
subtracting a positive number from a negative number gives a positive number, while
subtracting a negative number from a positive number results in a negative number.
3.
Multiplying two numbers in Q-15 format will lead to a Q-30 format, which has 31 bits in total.
As in Example 9.7, the multiplication of Q-3 yields a Q-6 format, that is, 6 magnitude bits and
a sign bit. In practice, it is common for a DS processor to hold the multiplication result using
a double word size such as MAC operation, as shown in
Figure 9.9
for multiplying two
numbers in Q-15 format. In Q-30 format, there is one sign-extended bit. We may get rid of
it by shifting left by one bit to obtain Q-31 format and maintaining the Q-31 format for
each MAC operation.
Sometimes, the number in Q-31 format needs to be converted to Q-15; for example, the 32-bit data
in the accumulator needs to be sent for 16-bit digital-to-analog conversion (DAC), where the upper
most-significant 16 bits in the Q-30 format must be used to maintain accuracy. We can shift the
number in Q-30 to the right by 15 bits or shift the Q-31 number to the right by 16 bits. The
useful result is stored in the lower 16-bit memory location. Note that after truncation,
the maximum error is bounded by the interval size of 2
15
, which satisfies most applications. In
using the Q-format in the fixed-point DS processor, it is costly to maintain the accuracy of data
manipulation.
4.
Underflow can happen when the result of multiplication is too small to be represented in the
0.0001. To keep the result in Q-2, we truncate the last two bits of 0.0001 to achieve 0.00, which
is zero. Hence, underflow occurs.
Q
S
15 magnitude bits
x
Q
S
15 magnitude bits
Q-30
30 magnitude bits
S
S
FIGURE 9.9
Sign bit extended Q-30 format.
Search WWH ::
Custom Search