beautypg.com

Motorola DSP96002 User Manual

Page 758

background image

D-6

DSP96002 USER’S MANUAL

MOTOROLA

D.1.3 IEEE Floating Point Exceptions

The IEEE standard defines five types of exceptions which must be signaled when detected. The DSP96002

implements the default "trap disabled" way of signaling exceptions: when an exception occurs, a flag is set

and program execution continues. The flag remains set until cleared by the user. The different exceptions

are:

1.

Invalid operation: The invalid operation exception is signaled when an operand is invalid for the

specific operation to occur. The result of an invalid operation is a QNaN, as described above.

Examples of invalid operations are 0/0,

∞/∞,

∞−∞

, 0

×∞

, etc.

2.

Division by zero: The result of a division by zero is an infinity (with the correct sign), and the

operation is signaled as an exception.

3.

Overflow: The overflow exception is signaled when the result of an operation exceeds the larg-

est magnitude that the result precision can accommodate. The result is dependent upon the

rounding mode. For round to nearest, an infinity with correct sign is generated. Round to zero

results in the largest possible numerical value the result precision can accommodate, with cor-

rect sign (i. e., the result saturates). Round to -

results in the largest possible numerical value

the result precision can accommodate (i. e., the result saturates) when the overflow is positive.

It results in -

when the overflow is negative. Round to +

results in +

when the overflow is

positive, and in the smallest negative numerical value the result precision can accommodate (i.

e., the result saturates) when the overflow is negative.

4.

Underflow: Underflow is signaled when both (1) a very small (tiny) number is detected as the

result of a floating point operation (nonzero result with true exponent smaller than the minimum

exponent, see Figure D-6) and (2) loss of accuracy is detected (delivered result differs from

what would have been computed if the exponent range was unbounded – i. e., cannot be ac-

curately represented as a denormalized number). Consider the case of floating point multipli-

cation as an example. Let the first SP source operand have a mantissa of 1.01, with biased ex-

ponent e

min

=1 (unbiased exponent of -126) and the second SP source operand have a mantis-

sa of 1.0 with a biased exponent of 60 (unbiased exponent of -67). The result of a multiplication

with infinite precision arithmetic would be a mantissa of 1.01 with actual (unbiased) exponent

of -193 (=-126-67). Since this exponent is smaller than the smallest exponent possible in SP,

the number is tiny, and since the number is so tiny that it cannot be accurately represented as

a denormalized number, loss of accuracy also ocurs, underflows will be signaled. The delivered

SP result would be a SP zero, and the underflow flag would be set. Note that the SEP format

can accommodate this exponent, and thus the result of an SEP operation would not signal the

underflow exception. In that case, the correct result is delivered. If the first operand of the SP

multiplication has the same value as before, but the second operand has a biased exponent of

96 (actual exponent of -31), the result of an infinite-precision multiplication has a mantissa of

1.01 and an actual exponent of -157. The SP result consists of a denormalized number (i.e.,

tiny) with a mantissa of 0.0000000000000000000000000000001 and biased exponent of 0.

Note that the denormalization process results in loss of accuracy, and therefore the the under-

flow flag will be set. Finally, if the second source operand has a biased exponent of 120 (actual

exponent of -7), then the resulting mantissa with infinite precision would be 1.01 as before, with

an actual exponent of -133. The SP result is again denormalized (tiny) with a mantissa of

0.000000101 and a biased exponent equal to 0. Note that there is no loss in accuracy due to

the normalization (no lost significant bits), and thus the underflow flag will not be set. The de-