MOTOROLA
M68040 USER’S MANUAL
9- 33
of the offending instruction, and the F-line word contains the integer data register number.
If the M68040FPSP unimplemented instruction exception handler is used, there can be
some other cases in which an overflow is reported.
In addition to normal overflow, the exponential instructions can generate results that
catastrophically overflow the 16-bit exponent used for intermediate results. For these
instructions (FETOX, FTENTOX, FTWOTOX, FSINH, and FCOSH), the intermediate
result found in either FPTEMP or WBTEMP fields of the floating-point state frame are
invalid. If an INEX2 or INEX1 exceptional condition exists and the user INEX exception
handler is enabled, it is the responsibility of the user OVFL exception handler to look for
this situation.
The user OVFL exception handler examines the E3 bit of the floating-point state frame to
exit from this exception handler. If the E3 bit is set, it must be cleared prior to restoring the
floating-point frame through the FRESTORE instruction. If the E3 bit is clear and the E1 bit
is set, the floating-point state frame is discarded. The RTE instruction must be executed to
return to normal instruction flow.
9.7.5 Underflow
An underflow exception occurs when the intermediate result of an arithmetic operation is
too small to be represented as a normalized number in a floating-point data register or
memory using the selected rounding precision. An arithmetic operation is too small when
the intermediate result exponent is less than or equal to the minimum exponent value of
the selected rounding precision. Underflow is not detected for intermediate result
exponents that are equal to the extended-precision minimum exponent since the explicit
integer part bit permits representation of normalized numbers with a minimum extended-
precision exponent. Underflow can only occur when the destination format is single,
double, or extended precision. When the destination format is byte, word, or long word,
the conversion underflows to zero without causing either an underflow or an operand
error. At the end of any operation that could potentially underflow, the intermediate result
is checked for underflow, rounded, and checked for overflow before it is stored at the
destination. If an underflow occurs, the UNFL bit is set in the FPSR EXC byte.
Even if the intermediate result is large enough to be represented as an extended-precision
number, an underflow can occur. The intermediate result is rounded to the selected
precision, and the rounded result is stored in extended-precision format. If the magnitude
of the intermediate result is too small to be represented in the selected rounding precision,
an underflow occurs.
The IEEE 754 standard defines two causes of an underflow: 1) when the absolute value of
the number is less than the minimum number that can be represented by a normalized
number in a specific data format; 2) when loss of accuracy occurs while attempting to
calculate such a number (a loss of accuracy also causes an inexact exception). The IEEE
754 standard specifies that if the underflow exception is disabled, an underflow should
only be signaled when both of these cases are satisfied (i.e., the result is too small to be
represented with a given format and there is a loss of accuracy during calculation of the
F
re
e
sc
a
le
S
e
m
ic
o
n
d
u
c
to
r,
I
Freescale Semiconductor, Inc.
For More Information On This Product,
Go to: www.freescale.com
n
c
..
.