netwinder-fpe.rst 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. =============
  2. Current State
  3. =============
  4. The following describes the current state of the NetWinder's floating point
  5. emulator.
  6. In the following nomenclature is used to describe the floating point
  7. instructions. It follows the conventions in the ARM manual.
  8. ::
  9. <S|D|E> = <single|double|extended>, no default
  10. {P|M|Z} = {round to +infinity,round to -infinity,round to zero},
  11. default = round to nearest
  12. Note: items enclosed in {} are optional.
  13. Floating Point Coprocessor Data Transfer Instructions (CPDT)
  14. ------------------------------------------------------------
  15. LDF/STF - load and store floating
  16. <LDF|STF>{cond}<S|D|E> Fd, Rn
  17. <LDF|STF>{cond}<S|D|E> Fd, [Rn, #<expression>]{!}
  18. <LDF|STF>{cond}<S|D|E> Fd, [Rn], #<expression>
  19. These instructions are fully implemented.
  20. LFM/SFM - load and store multiple floating
  21. Form 1 syntax:
  22. <LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn]
  23. <LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn, #<expression>]{!}
  24. <LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn], #<expression>
  25. Form 2 syntax:
  26. <LFM|SFM>{cond}<FD,EA> Fd, <count>, [Rn]{!}
  27. These instructions are fully implemented. They store/load three words
  28. for each floating point register into the memory location given in the
  29. instruction. The format in memory is unlikely to be compatible with
  30. other implementations, in particular the actual hardware. Specific
  31. mention of this is made in the ARM manuals.
  32. Floating Point Coprocessor Register Transfer Instructions (CPRT)
  33. ----------------------------------------------------------------
  34. Conversions, read/write status/control register instructions
  35. FLT{cond}<S,D,E>{P,M,Z} Fn, Rd Convert integer to floating point
  36. FIX{cond}{P,M,Z} Rd, Fn Convert floating point to integer
  37. WFS{cond} Rd Write floating point status register
  38. RFS{cond} Rd Read floating point status register
  39. WFC{cond} Rd Write floating point control register
  40. RFC{cond} Rd Read floating point control register
  41. FLT/FIX are fully implemented.
  42. RFS/WFS are fully implemented.
  43. RFC/WFC are fully implemented. RFC/WFC are supervisor only instructions, and
  44. presently check the CPU mode, and do an invalid instruction trap if not called
  45. from supervisor mode.
  46. Compare instructions
  47. CMF{cond} Fn, Fm Compare floating
  48. CMFE{cond} Fn, Fm Compare floating with exception
  49. CNF{cond} Fn, Fm Compare negated floating
  50. CNFE{cond} Fn, Fm Compare negated floating with exception
  51. These are fully implemented.
  52. Floating Point Coprocessor Data Instructions (CPDT)
  53. ---------------------------------------------------
  54. Dyadic operations:
  55. ADF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - add
  56. SUF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - subtract
  57. RSF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse subtract
  58. MUF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - multiply
  59. DVF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - divide
  60. RDV{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse divide
  61. These are fully implemented.
  62. FML{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast multiply
  63. FDV{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast divide
  64. FRD{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast reverse divide
  65. These are fully implemented as well. They use the same algorithm as the
  66. non-fast versions. Hence, in this implementation their performance is
  67. equivalent to the MUF/DVF/RDV instructions. This is acceptable according
  68. to the ARM manual. The manual notes these are defined only for single
  69. operands, on the actual FPA11 hardware they do not work for double or
  70. extended precision operands. The emulator currently does not check
  71. the requested permissions conditions, and performs the requested operation.
  72. RMF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - IEEE remainder
  73. This is fully implemented.
  74. Monadic operations:
  75. MVF{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - move
  76. MNF{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - move negated
  77. These are fully implemented.
  78. ABS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - absolute value
  79. SQT{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - square root
  80. RND{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - round
  81. These are fully implemented.
  82. URD{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - unnormalized round
  83. NRM{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - normalize
  84. These are implemented. URD is implemented using the same code as the RND
  85. instruction. Since URD cannot return a unnormalized number, NRM becomes
  86. a NOP.
  87. Library calls:
  88. POW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - power
  89. RPW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse power
  90. POL{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - polar angle (arctan2)
  91. LOG{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base 10
  92. LGN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base e
  93. EXP{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - exponent
  94. SIN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - sine
  95. COS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - cosine
  96. TAN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - tangent
  97. ASN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arcsine
  98. ACS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arccosine
  99. ATN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arctangent
  100. These are not implemented. They are not currently issued by the compiler,
  101. and are handled by routines in libc. These are not implemented by the FPA11
  102. hardware, but are handled by the floating point support code. They should
  103. be implemented in future versions.
  104. Signalling:
  105. Signals are implemented. However current ELF kernels produced by Rebel.com
  106. have a bug in them that prevents the module from generating a SIGFPE. This
  107. is caused by a failure to alias fp_current to the kernel variable
  108. current_set[0] correctly.
  109. The kernel provided with this distribution (vmlinux-nwfpe-0.93) contains
  110. a fix for this problem and also incorporates the current version of the
  111. emulator directly. It is possible to run with no floating point module
  112. loaded with this kernel. It is provided as a demonstration of the
  113. technology and for those who want to do floating point work that depends
  114. on signals. It is not strictly necessary to use the module.
  115. A module (either the one provided by Russell King, or the one in this
  116. distribution) can be loaded to replace the functionality of the emulator
  117. built into the kernel.