18c2ecf20Sopenharmony_ci=============
28c2ecf20Sopenharmony_ciCurrent State
38c2ecf20Sopenharmony_ci=============
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ciThe following describes the current state of the NetWinder's floating point
68c2ecf20Sopenharmony_ciemulator.
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ciIn the following nomenclature is used to describe the floating point
98c2ecf20Sopenharmony_ciinstructions.  It follows the conventions in the ARM manual.
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci::
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci  <S|D|E> = <single|double|extended>, no default
148c2ecf20Sopenharmony_ci  {P|M|Z} = {round to +infinity,round to -infinity,round to zero},
158c2ecf20Sopenharmony_ci            default = round to nearest
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciNote: items enclosed in {} are optional.
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ciFloating Point Coprocessor Data Transfer Instructions (CPDT)
208c2ecf20Sopenharmony_ci------------------------------------------------------------
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ciLDF/STF - load and store floating
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci<LDF|STF>{cond}<S|D|E> Fd, Rn
258c2ecf20Sopenharmony_ci<LDF|STF>{cond}<S|D|E> Fd, [Rn, #<expression>]{!}
268c2ecf20Sopenharmony_ci<LDF|STF>{cond}<S|D|E> Fd, [Rn], #<expression>
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ciThese instructions are fully implemented.
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ciLFM/SFM - load and store multiple floating
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciForm 1 syntax:
338c2ecf20Sopenharmony_ci<LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn]
348c2ecf20Sopenharmony_ci<LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn, #<expression>]{!}
358c2ecf20Sopenharmony_ci<LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn], #<expression>
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ciForm 2 syntax:
388c2ecf20Sopenharmony_ci<LFM|SFM>{cond}<FD,EA> Fd, <count>, [Rn]{!}
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciThese instructions are fully implemented.  They store/load three words
418c2ecf20Sopenharmony_cifor each floating point register into the memory location given in the
428c2ecf20Sopenharmony_ciinstruction.  The format in memory is unlikely to be compatible with
438c2ecf20Sopenharmony_ciother implementations, in particular the actual hardware.  Specific
448c2ecf20Sopenharmony_cimention of this is made in the ARM manuals.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ciFloating Point Coprocessor Register Transfer Instructions (CPRT)
478c2ecf20Sopenharmony_ci----------------------------------------------------------------
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ciConversions, read/write status/control register instructions
508c2ecf20Sopenharmony_ci
518c2ecf20Sopenharmony_ciFLT{cond}<S,D,E>{P,M,Z} Fn, Rd          Convert integer to floating point
528c2ecf20Sopenharmony_ciFIX{cond}{P,M,Z} Rd, Fn                 Convert floating point to integer
538c2ecf20Sopenharmony_ciWFS{cond} Rd                            Write floating point status register
548c2ecf20Sopenharmony_ciRFS{cond} Rd                            Read floating point status register
558c2ecf20Sopenharmony_ciWFC{cond} Rd                            Write floating point control register
568c2ecf20Sopenharmony_ciRFC{cond} Rd                            Read floating point control register
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ciFLT/FIX are fully implemented.
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciRFS/WFS are fully implemented.
618c2ecf20Sopenharmony_ci
628c2ecf20Sopenharmony_ciRFC/WFC are fully implemented.  RFC/WFC are supervisor only instructions, and
638c2ecf20Sopenharmony_cipresently check the CPU mode, and do an invalid instruction trap if not called
648c2ecf20Sopenharmony_cifrom supervisor mode.
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ciCompare instructions
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ciCMF{cond} Fn, Fm        Compare floating
698c2ecf20Sopenharmony_ciCMFE{cond} Fn, Fm       Compare floating with exception
708c2ecf20Sopenharmony_ciCNF{cond} Fn, Fm        Compare negated floating
718c2ecf20Sopenharmony_ciCNFE{cond} Fn, Fm       Compare negated floating with exception
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ciThese are fully implemented.
748c2ecf20Sopenharmony_ci
758c2ecf20Sopenharmony_ciFloating Point Coprocessor Data Instructions (CPDT)
768c2ecf20Sopenharmony_ci---------------------------------------------------
778c2ecf20Sopenharmony_ci
788c2ecf20Sopenharmony_ciDyadic operations:
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ciADF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - add
818c2ecf20Sopenharmony_ciSUF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - subtract
828c2ecf20Sopenharmony_ciRSF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse subtract
838c2ecf20Sopenharmony_ciMUF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - multiply
848c2ecf20Sopenharmony_ciDVF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - divide
858c2ecf20Sopenharmony_ciRDV{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse divide
868c2ecf20Sopenharmony_ci
878c2ecf20Sopenharmony_ciThese are fully implemented.
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ciFML{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast multiply
908c2ecf20Sopenharmony_ciFDV{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast divide
918c2ecf20Sopenharmony_ciFRD{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast reverse divide
928c2ecf20Sopenharmony_ci
938c2ecf20Sopenharmony_ciThese are fully implemented as well.  They use the same algorithm as the
948c2ecf20Sopenharmony_cinon-fast versions.  Hence, in this implementation their performance is
958c2ecf20Sopenharmony_ciequivalent to the MUF/DVF/RDV instructions.  This is acceptable according
968c2ecf20Sopenharmony_cito the ARM manual.  The manual notes these are defined only for single
978c2ecf20Sopenharmony_cioperands, on the actual FPA11 hardware they do not work for double or
988c2ecf20Sopenharmony_ciextended precision operands.  The emulator currently does not check
998c2ecf20Sopenharmony_cithe requested permissions conditions, and performs the requested operation.
1008c2ecf20Sopenharmony_ci
1018c2ecf20Sopenharmony_ciRMF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - IEEE remainder
1028c2ecf20Sopenharmony_ci
1038c2ecf20Sopenharmony_ciThis is fully implemented.
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ciMonadic operations:
1068c2ecf20Sopenharmony_ci
1078c2ecf20Sopenharmony_ciMVF{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - move
1088c2ecf20Sopenharmony_ciMNF{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - move negated
1098c2ecf20Sopenharmony_ci
1108c2ecf20Sopenharmony_ciThese are fully implemented.
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ciABS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - absolute value
1138c2ecf20Sopenharmony_ciSQT{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - square root
1148c2ecf20Sopenharmony_ciRND{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - round
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ciThese are fully implemented.
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ciURD{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - unnormalized round
1198c2ecf20Sopenharmony_ciNRM{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - normalize
1208c2ecf20Sopenharmony_ci
1218c2ecf20Sopenharmony_ciThese are implemented.  URD is implemented using the same code as the RND
1228c2ecf20Sopenharmony_ciinstruction.  Since URD cannot return a unnormalized number, NRM becomes
1238c2ecf20Sopenharmony_cia NOP.
1248c2ecf20Sopenharmony_ci
1258c2ecf20Sopenharmony_ciLibrary calls:
1268c2ecf20Sopenharmony_ci
1278c2ecf20Sopenharmony_ciPOW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - power
1288c2ecf20Sopenharmony_ciRPW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse power
1298c2ecf20Sopenharmony_ciPOL{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - polar angle (arctan2)
1308c2ecf20Sopenharmony_ci
1318c2ecf20Sopenharmony_ciLOG{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base 10
1328c2ecf20Sopenharmony_ciLGN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base e
1338c2ecf20Sopenharmony_ciEXP{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - exponent
1348c2ecf20Sopenharmony_ciSIN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - sine
1358c2ecf20Sopenharmony_ciCOS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - cosine
1368c2ecf20Sopenharmony_ciTAN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - tangent
1378c2ecf20Sopenharmony_ciASN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arcsine
1388c2ecf20Sopenharmony_ciACS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arccosine
1398c2ecf20Sopenharmony_ciATN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arctangent
1408c2ecf20Sopenharmony_ci
1418c2ecf20Sopenharmony_ciThese are not implemented.  They are not currently issued by the compiler,
1428c2ecf20Sopenharmony_ciand are handled by routines in libc.  These are not implemented by the FPA11
1438c2ecf20Sopenharmony_cihardware, but are handled by the floating point support code.  They should
1448c2ecf20Sopenharmony_cibe implemented in future versions.
1458c2ecf20Sopenharmony_ci
1468c2ecf20Sopenharmony_ciSignalling:
1478c2ecf20Sopenharmony_ci
1488c2ecf20Sopenharmony_ciSignals are implemented.  However current ELF kernels produced by Rebel.com
1498c2ecf20Sopenharmony_cihave a bug in them that prevents the module from generating a SIGFPE.  This
1508c2ecf20Sopenharmony_ciis caused by a failure to alias fp_current to the kernel variable
1518c2ecf20Sopenharmony_cicurrent_set[0] correctly.
1528c2ecf20Sopenharmony_ci
1538c2ecf20Sopenharmony_ciThe kernel provided with this distribution (vmlinux-nwfpe-0.93) contains
1548c2ecf20Sopenharmony_cia fix for this problem and also incorporates the current version of the
1558c2ecf20Sopenharmony_ciemulator directly.  It is possible to run with no floating point module
1568c2ecf20Sopenharmony_ciloaded with this kernel.  It is provided as a demonstration of the
1578c2ecf20Sopenharmony_citechnology and for those who want to do floating point work that depends
1588c2ecf20Sopenharmony_cion signals.  It is not strictly necessary to use the module.
1598c2ecf20Sopenharmony_ci
1608c2ecf20Sopenharmony_ciA module (either the one provided by Russell King, or the one in this
1618c2ecf20Sopenharmony_cidistribution) can be loaded to replace the functionality of the emulator
1628c2ecf20Sopenharmony_cibuilt into the kernel.
163