Digital Signal Processing Reference
In-Depth Information
3.4.3 Floating-point Multiplication
The following steps are used to perform floating-point multiplication of two numbers.
S0 Add the two exponents e 1 and e 2 . As inherent bias in the two exponents is added twice, subtract
the bias once from the sum to get the resultant exponent e in correct format.
S1 Place the implied 1 if the operands are saved as normalized numbers. Multiply the mantissas as
unsigned numbers to get the product, and XOR the two sign bits to get the sign of the product.
S2 Normalize the product if required. This puts the result back to IEEE format. Check whether the
result underflows or overflows.
S3 Round or truncate the mantissa to the width prescribed by the standard.
Example: Multiply the two numbers below stored as 10-bit floating-point numbers, where 4 bits
and 5 bits, respectively, are allocated for the exponent and mantissa, 1 bit is kept for the sign and 7 is
used as bias:
3 : 5 ! 0 1000 11000
5
:
0
!
0 1001 01000
S0 Add the two exponents and subtract the bias 7 ( ¼ 0111) from the sum:
1000 þ 1001 0111 ¼ 1010
S1 Append the implied 1 and multiply the mantissa using unsigned
unsigned multiplication:
1 : 11
1 : 01
111
00x
111xx
10 : 0011
S2 Normalize the result:
ð 10 : 0011 Þ b 2 3
1 : 00011 Þ b 2 4
2 4
ð
1
:
00011
Þ b
17
:
5
Þ 10
S3 Put the result back into the format of the operands. This may require dropping of bits but in this
case no truncation is required and the result is (1.00011) b
2 4 stored as 0_1011_00011.
3.5 Qn.m Format for Fixed-point Arithmetic
3.5.1 Introducing Qn.m
Most signal processing and communication systems are first implemented in double-precision
floating-point arithmetic using tools like MATLAB . While implementing these algorithms the
main focus of the developer is to correctly assimilate the functionality of the algorithm. This
MATLAB code is then converted into floating-point C/C þþ code. C þþ code usually runs much
faster than MATLAB routines. This code conversion also gives more understanding of the
algorithm as the designer might have used several functions from MATLAB toolboxes. Their
Search WWH ::




Custom Search