7-12
FLOATING-POINT UNIT
7.3.2.FPU Status Register
The 16-bit FPU status register (refer to Figure 7-8) indicates the current state of the FPU. The
flags in the FPU status register include the FPU busy flag, top-of-stack (TOP) pointer, condition
code flags, error summary status flag, stack fault flag, and exception flags. The FPU sets the
flags in this register to show the results of operations.
The contents of the FPU status register (referred to as the FPU status word) can be stored in
memory using the FSTSW/FNSTSW, FSTENV/FNSTENV, and FSAVE/FNSAVE instructions.
It can also be stored in the AX register of the integer unit, using the FSTSW/FNSTSW
instructions.
7.3.2.1.TOP OF STACK (TOP) POINTER
A pointer to the FPU data register that is currently at the top of the FPU register stack is
contained in bits 11 through 13 of the FPU status word. This pointer, which is commonly
referred to as TOP (for top-of-stack), is a binary value from 0 to 7. Refer to Section 7.3.1.,
FPU Data Registers, for more information about the TOP pointer.
7.3.2.2.CONDITION CODE FLAGS
The four FPU condition code flags (C0 through C3) indicate the results of floating-point
comparison and arithmetic operations. Table 7-3 summarizes the manner in which the floating-
Figure 7-7. Example FPU Dot Product Computation
(a)
R7
R6
R5
R4
R3
R2
R1
R0
Computation
ST(0)
5.6
(b)
R7
R6
R5
R4
R3
R2
R1
R0
ST(0)
13.44
(c)
R7
R6
R5
R4
R3
R2
R1
R0
ST(1)
ST(0)
13.44
(d)
R7
R6
R5
R4
R3
R2
R1
R0
ST(1)
ST(0)
39.14
13.44
52.58
Dot Product = (5.6 x 2.4) + (3.8 x 10.3)
Code:
FLD value1 ;(a) value1=5.6
FMUL value2 ;(b) value2=2.4
FLD value3 ; value3=3.8
FMUL value4 ;(c)value4=10.3
FADD ST(1) ;(d)