Status Register
- The status register tells the overflow status of the 8087 coprocessor.
- It is a 16-bit register.
- It is accessed by executing the FSTSW instruction.
- This instruction stores the content of the status register in memory.
- Once the status is stored in memory the bit positions of the status register can be examined.
- Busy: It indicates that the coprocessor is busy executing the task.
- Condition codes ( C0-C3 ): They indicate various conditions about the coprocessor.
- Top of Stack: It indicates a register as the top of the stack out of the eight stack registers.
- Exception Flat: It is set if any of the exception flag bits ( SF, PR, UF, OF, ZD, ZD, IO) are set.
- Stack Fault: It is not available in 8087. It is active only in 80387 and above.
- Precision: It indicates that the result has exceeded the selected precision.
- Underflow: It tells if the result is too small to fit in a register.
- Overflow: It tells if the result is too large to fit in a register.
- Zero Division: It indicates that you try to divide a non-zero by zero.
- Denormalized: It indicates that at least one of the operands is denormalized.
- Invalid Operation: It indicates an invalid operation. for e.g pushing more than eight items onto the stack, or attempting to pop an item off an empty stack. or taking the square root of a negative number.
Control Register
- The control register controls the operating modes of 8087.
- It is also a 16-bit register.
- It performs rounding control and precision control.
- It is also used to do masking and unmasking of the exception bits that correspond to the rightmost six bits of the status register.
- FLDCW instruction is used to load the value into the control register.
Rounding Control: It determines the type of rounding or truncating to be done.
- 00 = Round to nearest or even.
- 01 = Round down towards minus infinity.
- 10 = Round up towards plus infinity.
- 11 = Chop or truncate towards zero.
Precision Control: It sets the precision of the result.
- 00 = Single precision ( Short ).
- 01 = Reserved.
- 10 = Double precision ( long ).
- 11 = Extended precision ( temporary ).
Exception Masks: These determine whether an error affects the exception bit in the status register.
- If it is one, then the corresponding error is ignored.
- If it is zero and the corresponding error occurs, then generates an interrupt, and the corresponding bit in the status register is set.
Tag Register
- The tag register is used to indicate the contents of each register in the stack.
- There are total of 8 tags (Tag 0 to Tag 7 ) in this register and each tag uses 2 bits to represent a value.
- Therefore, it is a 16-bit register.
- Tag values
- 00 = Valid
- 01 = Zero
- 10 = Invalid
- 11 = Empty
Comments
Post a Comment