0% found this document useful (0 votes)
152 views6 pages

Numaric Data Processor 8087

The Intel 8087 is a math coprocessor that works alongside the 8086/8088 main processor to handle specialized floating-point math computations. It has 8 internal 80-bit registers that are used as a stack, and can perform operations on integer, decimal, and real numeric data types ranging from 2 to 10 bytes in length. The 8087 includes control and status registers that are used to configure it and check for errors.

Uploaded by

Sowmya P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
152 views6 pages

Numaric Data Processor 8087

The Intel 8087 is a math coprocessor that works alongside the 8086/8088 main processor to handle specialized floating-point math computations. It has 8 internal 80-bit registers that are used as a stack, and can perform operations on integer, decimal, and real numeric data types ranging from 2 to 10 bytes in length. The 8087 includes control and status registers that are used to configure it and check for errors.

Uploaded by

Sowmya P
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

NUMARIC DATA PROCESSOR 8087

The Intel 8087 math processor can be operated in parallel with main
processor in a system as a coprocessor. The main processor (8086/ 8088)
handles the general program execution, and 8087 coprocessor handles
specialized math computations. The following are the math coprocessors
operated with different Intel processors.

It can operate on data of the integer, decimal and real types with
lengths varying from 2 to 10 bytes. The different data types supported by
the 8087 NDP are as follows.

INTEGER DATA TYPES

-32,768 to 32,767 -9X1918 to 9X1018

-2X109 to 2X109 -1018 +1 to +1018 -1


REAL TYPE

±1X10-38 to ±3X1038 ±10-308 to ±10308

±10-4932 to ±104932
Figure shows the functional diagram of the 8087. It connects
directly on the address, data and status lines of the 8086 or 8088 so that
it can track and decode instructions fetched by the 8086. 8087 is having a
control register and status register. Control words are sent to the 8087
by writing them to a memory location, and 8087 has to execute an
instruction which reads in the control word from memory. Similarly to
read the status word from 8087, it execute an instruction which writes
the status word to memory and 8086 executes an instruction which reads
status word from the memory and check it.
FSTSW STATUS MOV CONT_WORD, AX
FWAIT FSTCW CONT_WORD
MOV AX,STATUS
Internally 8087 works with all numbers in the 80-bit temporary real
format. To hold the operands for operation, the 8087 has a register
stack of eight 80-bit registgers labeled 0-7. These registers are used as
LIFO group of registers. The 3-bits of status register holds the nuber of
the register which is currently top-of-stack. When 8087 is initialized,
these bits are set to 000, so Reg0 is TOS. These registers are associated
with two bit Tag field which indicates whether the number stored is a
Valid(00), Zero(01), NAN/∞(10) and Empty(11).
When 8087 reads in the first number for the execution, it converts
the number to 80-bit temporary-real format. It then decrements the
stack pointer to111 and writes the number in register 111 (7). In the
8087 instructions the register that is currently the TOS is reffered to as
ST(0) or simply ST. The register below is ST(1). In programs the current
TOS register can be known by reading status word.
Instruction Formats: 8087 has a set of 68 floating point arthmitic
instructions, consisting of Arithmitic, Trignametric, Exponential and
Logarithmic instructions. 8087 instruction mnemonics all beginwith letter
F which stands for floating point and also distinguishes the 8087
instructions from 8086 instructions. Every 8087 instruction is an ESC
instruction with the most significant 5-bits as 11011.
DATA TRANSFER INSTRUCTIONS:
REAL TRANSFER FDIVP Division real and pop
FLD Load real FIDIV Division integer
FST Store real FDIVR Division real reversed
FSTP Store real and pop FDIVRP Division real reversed and pop
FXCH Exchange registers FIDIVR Division integer reversed
INTEGER TRANSFER Advanced
FILD Load integer FABS Absolute value
FIST Store integer FCHS Change sign
FISTP Store integer and pop FPREM Partial remainder
PACKED DECIMAL TRANSFER(BCD) FPRNDINT Round to integer
FBLD Load BCD FSCALE Scale
FBSTP Store BCD and pop FSQRT Square root
ARITHMETIC INSTRUCTIONS: FXTRACT Extract exponent and
Addition mantissa
FADD Add real COMPARE INSTRUCTIONS:
FADDP Add real and pop FCOM Compare real
FIADD Add integer FCOMP Compare real and pop
Subtraction FCOMPP Compare real and pop twice
FSUB Subtract real FICOM Compare integer
FSUBP Subtract real and pop FICOMP Compare integer and pop
FISUB Subtract integer FTST Test ST against +0.0
FSUBR Subtract real reversed FXAM Examine ST
FSUBRP Subtract real and pop TRANSCENDENTAL INSTRUCTIONS:
FISUBR Subtract integer reversed (Trigonometric and Exponential)
Multiplication FPTAN Partial tangent
FMUL Multiply real FPATAN Partial arctangent
FMULP Multiply real and pop F2XM1 2x - 1
FIMUL Multiply integer FYL2X Y log2X
Division FYL2XP1 Y log2(X+1)
FDIV Division real
Status Register: It is a 16-bit Reg. It contains various error flags, condition
code bits for certain instructions, 3-bit ST field indicating the top of the
Reg. stack (80-bit), Busy status as shown in the figure.

• C3-C0 Condition code bits: Set by the compare and examine


instructions to indicate different conditions.
• TOP Top of the stack (ST): Bits indicates the current register address the
top of the stack.
• ES Error summary: Is set if any unmasked error bit (PE,UE, OE, ZE, DE, or
IE) is set. Then 8087 causes a coprocessor interrupt.
• PE Precision error: Precision error indicates that the result or operand
exceeds selected precision.
• UE Under flow error: Indicates that result is too large to be represent
with the current precision selected by the control word.
• OE Overflow error: Indicates a result is too large to be represented. If
this error is masked, the coprocessor generates ∞ for an overflow error.
• ZE Zero error: Indicates the divisor was zero while the dividend is a non
-infinity or non-zero number.
• DE Denormalized error: Indicates at least one of the operand is
denormalized.
• IE Invalid error: Indicates a stack overflow or underflow, indeterminate
from (0/0,0,-0, etc) or the use of a NAN as an operand. Square root of a
negative number.
• B Busy bit: The current operation is not complete.
Control Register: The Least significant 6 –bits of the control register are
used to mask the different types. If masked, error will not cause an
interrupt and error handling will be done by the 8087 processor. The
remaining bits in the control register provide flexibility in controlling
precision, rounding and infinity representation.

 PM Precision control • ZM Division by zero mask


• UM Underflow mask • DM Denormalized operand mask
• OM Overflow mask • IM Invalid operand mask
ROUNDING CONTROL PRECISION CONTROL
00=Round to nearest or even 00= 24-bit Single precision (short)
01=Round down towards -∞ 01=Reserved
10=Round up towards +∞ 10=53-bit Double precision(long)
11=Chop or truncate towards zero 11=Extended precision(temporary)
IC = 0 - ±∞ is treated as single unsigned ∞
1 - ±∞ is treated as two signed ∞
EXCEPTION HANDLING
The 8087 detects six different types of exception conditions that occur
during instruction execution. These will cause an interrupt if unmasked and
interrupts are enabled.
1) INVALID OPERATION 4) UNDERFLOW
2) OVERFLOW 5) DENORMALIZED OPERAND
3) ZERO DIVISOR 6) INEXACT RESULT

Instruction Pointer and Operand Pointer are 32-bit registers


pointing to the current instruction address, opcode and operand address.
In case of Error-handling routine these two pointers can be checked by
8086/8088 to identify instruction and operand addresses.

You might also like