Math Co Processor 8087
Math Co Processor 8087
20-Nov-10 www.eazynotes.com
INTRODUCTION
20-Nov-10
8087 was the first math coprocessor for 16-bit processors designed by Intel.
www.eazynotes.com
Addition, subtraction, multiplication and division of simple numbers is not the coprocessors job.
It does all the calculations involving floating point numbers like scientific calculations and algebraic functions.
INTRODUCTION
20-Nov-10
By having a coprocessor, which performs all the calculations, it can free up a lot of CPUs time.
www.eazynotes.com
This would allow the CPU to focus all of its resources on the other functions it has to perform.
This increases the overall speed and performance of the entire system.
INTRODUCTION
20-Nov-10
www.eazynotes.com
Numeric Processor Extension (NPX) Numeric Data Processor (NDP) Floating Point Unit (FPU)
ARCHITECTURE OF 8087
20-Nov-10
www.eazynotes.com
The microprocessor and coprocessor can execute their respective instructions simultaneously.
Microprocessor interprets and executes the normal instruction set and the coprocessor interprets and executes only the coprocessor instructions. All the coprocessor instructions are ESC instructions, i.e. they start with F.
5
20-Nov-10 www.eazynotes.com
ARCHITECTURE OF 8087
ARCHITECTURE OF 8087
20-Nov-10
The internal structure of 8087 coprocessor is divided into two major sections:
www.eazynotes.com
www.eazynotes.com
www.eazynotes.com
STATUS REGISTER
10
20-Nov-10 www.eazynotes.com
STATUS REGISTER
20-Nov-10 www.eazynotes.com
Status Register tells the overall status of 8087 coprocessor. It is a 16-bit register. It is accessed by executing the FSTSW instruction.
STATUS REGISTER
20-Nov-10 www.eazynotes.com
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 top of stack register, out of the eight stack registers. Exception Flag: It is set if any of the exception flag bits (SF, PR, UF, OF, ZD, DN, IO) are set.
12
STATUS REGISTER
20-Nov-10 www.eazynotes.com
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.
13
STATUS REGISTER
20-Nov-10 www.eazynotes.com
Zero Divide: It indicates that you try to divide a non-zero value by zero. Denormalized: It indicates that at least one of the operand is de-normalized. Invalid Operation: It indicates an invalid operation. For e.g.: pushing more than eight items onto the stack, attempting to pop an item off an empty stack or taking the square root of a negative number.
14
CONTROL REGISTER
15
20-Nov-10 www.eazynotes.com
CONTROL REGISTER
20-Nov-10 www.eazynotes.com
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 control register.
16
CONTROL REGISTER
20-Nov-10 www.eazynotes.com
Rounding Control: It determines the type of rounding or truncating to be done. Precision Control: It sets the precision of the result. Exception Masks: It determines that whether an error effects the exception bits in the status register.
If it is one, then the corresponding error is ignored. If it is zero and the corresponding error occurs, then it generates an interrupt, and the corresponding bit in status register is set.
17
TAG REGISTER
20-Nov-10 www.eazynotes.com
TAG 7
TAG 6
TAG 5
TAG 4
TAG 3
TAG 2
TAG 1
TAG 0
18
TAG 7
TAG 6
TAG 5
TAG 4
TAG 3
TAG 2
TAG 1
TAG 0
TAG REGISTER
20-Nov-10 www.eazynotes.com
Tag Register is used to indicate the contents of each register in the stack. There are total 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.
19
GND AD14 AD13 AD12 AD11 AD10 AD9 AD8 AD7 AD6 AD5 AD4 AD3 AD2 AD1 AD0 NC NC CLK GND
www.eazynotes.com
8 0 8 7
A19/S6 BHE/S7 RQ/GT1 INT RQ/GT0 NC NC S2 S1 S0 QS0 QS1 BUSY READY RESET
20
Multiplexed address-data bus lines are connected directly from 8086 to 8087.
The status lines and the queue status lines are connected directly from 8086 to 8087. The Request/Grant (RQ/GT0 and RQ/GT1) signals of 8087 are connected to RQ/GT0 and RQ/GT1 of 8086.
www.eazynotes.com
22