QUESTIONS AND PROBLEMS
1. List the three types of data that are loaded or stored in memory by the coprocessor.
2. List the three integer data types, the range of the integers stored in them, and the number of bits allotted to each.
3. Explain how a BCD number is stored in memory by the coprocessor.
4. List the three types of floating-point numbers used with the coprocessor and the number of binary bits assigned to each.
5. Convert the following decimal numbers into single-precision floating-point numbers:
(a) 28.75
(b) 624
(c) – 0.615
(d) + 0.0
(e) – 1000.5
6. Convert the following single-precision floating-point numbers into decimal:
(a) 11000000 11110000 00000000 00000000
(b) 00111111 00010000 00000000 00000000
(c) 01000011 10011001 00000000 00000000
(d) 01000000 00000000 00000000 00000000
(e) 01000001 00100000. 00000000 00000000
(f) 00000000 00000000 00000000 00000000
7. Explain what the coprocessor does when a normal microprocessor instruction executes.
8. Explain what the microprocessor does when a coprocessor instruction executes.
9. What is the purpose of the C3–C0 bits in the status register?
10. What operation is accomplished with the FSTSW AX instruction?
11. What is the purpose of the IE bit in the status register?
12. How can SAHF and a conditional jump instruction be used to determine whether the top of the stack (ST) is equal to register ST(2)?
13. How is the rounding mode selected in the 80X87?
14. What coprocessor instruction uses the microprocessor’s AX register?
15. What I/O ports are reserved for coprocessor use with the 80287?
16. How are data stored inside the coprocessor?
17. What is a NAN?
18. Whenever the coprocessor is reset, the top of the stack register is register number
19. What does the term chop mean in the rounding control bits of the control register?
20. What is the difference between affine and projective infinity control?
21. What microprocessor instruction forms the opcodes for the coprocessor?
22. The FINIT instruction selects -precision for all coprocessor operations.
23. Using assembler pseudo-opcodes, form statements that accomplish the following:
(a) Store a 23.44 into a double-precision floating-point memory location FROG.
(b) Store a –123 into a 32-bit signed integer location DATA3.
(c) Store a –23.8 into a single-precision floating-point memory location DATAL.
(d) Reserve double-precision memory location DATA2.
24. Describe how the FST DATA instruction functions. Assume that DATA is defined as a 64-bit memory location.
25. What does the FILD DATA instruction accomplish?
26. Form an instruction that adds the contents of register 3 to the top of the stack.
27. Describe the operation of the FADD instruction.
28. Choose an instruction that subtracts the contents of register 2 from the top of the stack and stores the result in register 2.
29. What is the function of the FBSTP DATA instruction?
30. What is the difference between a forward and a reverse division?
31. What is the purpose of the Pentium Pro FCOMI instruction?
32. What does a Pentium Pro FCMOVB instruction accomplish?
33. What must occur before executing any FCMOV instruction?
34. Develop a procedure that finds the reciprocal of the single-precision floating-point number.
The number is passed to the procedure in EAX and must be returned as a reciprocal in EAX.
35. What is the difference between the FTST instruction and FXAM?
36. Explain what the F2XM1 instruction calculates.
37. Which coprocessor status register bit should be tested after the FSQRT instruction exe- cutes?
38. Which coprocessor instruction pushes π onto the top of the stack?
39. Which coprocessor instruction places 1.0 at the top of the stack?
40. What will FFREE ST(2) accomplish when executed?
41. Which instruction stores the environment?
42. What does the FSAVE instruction save?
43. Develop a procedure that finds the area of a rectangle (A = L × W). Memory locations for this procedure are single-precision floating-point locations A, L, and W.
44. Write a procedure that finds the capacitive reactance Memory locations for this procedure are single-precision floating-point locations XC, F, and C1 for C.
45. Develop a procedure that generates a table of square roots for the integers 2 through 10. The results must be stored as single-precision floating-point numbers in an array called ROOTS.
46. When is the FWAIT instruction used in a program?
47. What is the difference between the FSTSW and FNSTSW instructions?
48. Given the series/parallel circuit and equation illustrated in Figure 14–17, develop a program using single-precision values for R1, R2, R3, and R4 that finds the total resistance and stores the result at single-precision location RT.
49. Develop a procedure that finds the cosine of a single-precision floating-point number. The angle, in degrees, is passed to the procedure in EAX and the cosine is returned in EAX. Recall that FCOS finds the cosine of an angle expressed in radians.
50. Given two arrays of double-precision floating-point data (ARRAY1 and ARRAY2) that each contain 100 elements, develop a procedure that finds the product of ARRAY1 times ARRAY2, and then stores the double-precision floating-point result in a third array (ARRAY3).
51. Develop a procedure that takes the single-precision contents of register EBX times π and stores the result in register EBX as a single-precision floating-point number. You must use memory to accomplish this task.
52. Write a procedure that raises a single-precision floating-point number X to the power Y. Parameters are passed to the procedure with EAX = X and EBX = Y. The result is passed back to the calling sequence in ECX.
53. Given that the LOG10 X = (LOG2 10)-1 × LOG2 X, write a procedure called LOG10 that finds the LOG10 of the value (X) at the stack top. Return the LOG10 at the stack top at the end of the procedure.
54. Use the procedure developed in question 53 to solve the equation Gain in decibels = 20log Vout 10 Vin
54. The program should take arrays of single-precision values for Vout and Vin and store the decibel gains in a third array called DBG. These are 100 values Vout and Vin.
55. What is the MMX extension to the Pentium–Core2 microprocessors?
56. What is the purpose of the EMMS instruction?
57. Where are the MM0–MM7 registers found in the microprocessor?
58. What is signed saturation?
59. What is unsigned saturation?
60. How could all of the MMX registers be stored in the memory with one instruction?
61. Write a short program that uses MMX instruction to multiply the word-size numbers in arrays and store the 32-bit results in a third array. The source arrays are 256 words long.
62. What are SIMD instructions?
63. What are SSE instructions?
64. The XMM registers are bits wide.
65. A single XMM register can hold single-precision floating-point numbers.
66. A single XMM register can hold byte-sized integers.
67. What is an OWORD?
68. Can floating-point instructions for the arithmetic coprocessor execute at the same time as SSE instructions?
69. Develop a C++ function (using inline assembly code) that computes (using scalar SSE instructions and floating-point instructions) and returns a single-precision number that rep- resents the resonant frequency from parameters (L and C) passed to it to solve the following equation: