Download presentation
Presentation is loading. Please wait.
Published byEdward McCarthy Modified over 8 years ago
1
Real Numbers 313023220 11111111111111111111111111111111 SignExponentMantissa
2
Real Number Storage 313023220 11111111111111111111111111111111 SignExponentMantissa 4-byte IEEE Real Number format 234.56E+02 234.56 mantissa +02 exponent
3
Assigning Storage for Large Numbers Dd (define doubleword) – 4-byte storage; Real number stored as a doubleword is called a short real. –Dd 12345.678 –Dd +1.5E+02 –Dd 2.56E+38;largest positive exponent –Dd 3.3455E-39;largest negative exponent Dq (Define quadword) -8-byte storage; long real number (double in C,C++ and Visual) –Dq 2.56E+307;largest exponent
4
Floating Point Unit (Coprocessor) 8 individually addressable 80-bit registers –(ST(0), ST(1), ST(2)…ST(7)) –Arranged in stack format ST(0) = ST -> top of stack Control Registers –3 16-bit registers (control, status, tag) –2 32-bit registers (instruction pointer, operand pointer)
5
Instruction Formats Always begin with the letter F 2 nd letter - B,I – binary coded decimal operand or binary integer operand If 2 nd letter is neither, assume real number format. –FBLD, FILD, FMUL Can not use CPU registers as operands
6
Floating Point Operations AddAdd source to destination SubSubtract source from destination SubrSubtract destination from source MulMultiply source by destination DivDivide destination by source DivrDivide source by destination
8
Basic Arithmetic Instructions Instruction FormMnemonic Form Operands (Dest,Source) Example Classical StackFop{ST(1), ST}FADD Classical Stack, Extra PopFopP{ST(1), ST}FSUBP RegisterFop ST(n), ST ST, ST(n) FMUL ST(1),ST FDIV ST,ST(3) Register, popFopPST(n), ST FADDP ST(2),ST Real MemoryFop{ST}, memRealFDIVR Integer MemoryFIop{ST}, memIntFSUBR hours
9
Instructions Classical stack –No explicit operands needed (ST, source; ST(1) destination) –FADD ;ST(1)=ST(1)+ST; pop ST(1) into ST Register –Uses coprocessor registers as ordinary operands (one must ST)
10
Evaluating a postfix expression Well suited for evaluating postfix expressions. –When reading an operand from input, push it on stack –When reading an operator from input, pop the two operands located on the top of the stack, perform the selected operation on the operands, and push the result back on the stack.
12
Register Stack Example InstructionRegister Stack fld op1ST = 6.0 fld op2 ST = 2.0 ST(1) = 6.0 fmulST = 12.0 fld op3 ST = 5.0 ST(1) = 12.0 fsubST = 7.0
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.