162306a36Sopenharmony_ci=============
262306a36Sopenharmony_ciCurrent State
362306a36Sopenharmony_ci=============
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciThe following describes the current state of the NetWinder's floating point
662306a36Sopenharmony_ciemulator.
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciIn the following nomenclature is used to describe the floating point
962306a36Sopenharmony_ciinstructions.  It follows the conventions in the ARM manual.
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci::
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci  <S|D|E> = <single|double|extended>, no default
1462306a36Sopenharmony_ci  {P|M|Z} = {round to +infinity,round to -infinity,round to zero},
1562306a36Sopenharmony_ci            default = round to nearest
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ciNote: items enclosed in {} are optional.
1862306a36Sopenharmony_ci
1962306a36Sopenharmony_ciFloating Point Coprocessor Data Transfer Instructions (CPDT)
2062306a36Sopenharmony_ci------------------------------------------------------------
2162306a36Sopenharmony_ci
2262306a36Sopenharmony_ciLDF/STF - load and store floating
2362306a36Sopenharmony_ci
2462306a36Sopenharmony_ci<LDF|STF>{cond}<S|D|E> Fd, Rn
2562306a36Sopenharmony_ci<LDF|STF>{cond}<S|D|E> Fd, [Rn, #<expression>]{!}
2662306a36Sopenharmony_ci<LDF|STF>{cond}<S|D|E> Fd, [Rn], #<expression>
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_ciThese instructions are fully implemented.
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ciLFM/SFM - load and store multiple floating
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciForm 1 syntax:
3362306a36Sopenharmony_ci<LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn]
3462306a36Sopenharmony_ci<LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn, #<expression>]{!}
3562306a36Sopenharmony_ci<LFM|SFM>{cond}<S|D|E> Fd, <count>, [Rn], #<expression>
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ciForm 2 syntax:
3862306a36Sopenharmony_ci<LFM|SFM>{cond}<FD,EA> Fd, <count>, [Rn]{!}
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ciThese instructions are fully implemented.  They store/load three words
4162306a36Sopenharmony_cifor each floating point register into the memory location given in the
4262306a36Sopenharmony_ciinstruction.  The format in memory is unlikely to be compatible with
4362306a36Sopenharmony_ciother implementations, in particular the actual hardware.  Specific
4462306a36Sopenharmony_cimention of this is made in the ARM manuals.
4562306a36Sopenharmony_ci
4662306a36Sopenharmony_ciFloating Point Coprocessor Register Transfer Instructions (CPRT)
4762306a36Sopenharmony_ci----------------------------------------------------------------
4862306a36Sopenharmony_ci
4962306a36Sopenharmony_ciConversions, read/write status/control register instructions
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_ciFLT{cond}<S,D,E>{P,M,Z} Fn, Rd          Convert integer to floating point
5262306a36Sopenharmony_ciFIX{cond}{P,M,Z} Rd, Fn                 Convert floating point to integer
5362306a36Sopenharmony_ciWFS{cond} Rd                            Write floating point status register
5462306a36Sopenharmony_ciRFS{cond} Rd                            Read floating point status register
5562306a36Sopenharmony_ciWFC{cond} Rd                            Write floating point control register
5662306a36Sopenharmony_ciRFC{cond} Rd                            Read floating point control register
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ciFLT/FIX are fully implemented.
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ciRFS/WFS are fully implemented.
6162306a36Sopenharmony_ci
6262306a36Sopenharmony_ciRFC/WFC are fully implemented.  RFC/WFC are supervisor only instructions, and
6362306a36Sopenharmony_cipresently check the CPU mode, and do an invalid instruction trap if not called
6462306a36Sopenharmony_cifrom supervisor mode.
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ciCompare instructions
6762306a36Sopenharmony_ci
6862306a36Sopenharmony_ciCMF{cond} Fn, Fm        Compare floating
6962306a36Sopenharmony_ciCMFE{cond} Fn, Fm       Compare floating with exception
7062306a36Sopenharmony_ciCNF{cond} Fn, Fm        Compare negated floating
7162306a36Sopenharmony_ciCNFE{cond} Fn, Fm       Compare negated floating with exception
7262306a36Sopenharmony_ci
7362306a36Sopenharmony_ciThese are fully implemented.
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ciFloating Point Coprocessor Data Instructions (CPDT)
7662306a36Sopenharmony_ci---------------------------------------------------
7762306a36Sopenharmony_ci
7862306a36Sopenharmony_ciDyadic operations:
7962306a36Sopenharmony_ci
8062306a36Sopenharmony_ciADF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - add
8162306a36Sopenharmony_ciSUF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - subtract
8262306a36Sopenharmony_ciRSF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse subtract
8362306a36Sopenharmony_ciMUF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - multiply
8462306a36Sopenharmony_ciDVF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - divide
8562306a36Sopenharmony_ciRDV{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse divide
8662306a36Sopenharmony_ci
8762306a36Sopenharmony_ciThese are fully implemented.
8862306a36Sopenharmony_ci
8962306a36Sopenharmony_ciFML{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast multiply
9062306a36Sopenharmony_ciFDV{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast divide
9162306a36Sopenharmony_ciFRD{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - fast reverse divide
9262306a36Sopenharmony_ci
9362306a36Sopenharmony_ciThese are fully implemented as well.  They use the same algorithm as the
9462306a36Sopenharmony_cinon-fast versions.  Hence, in this implementation their performance is
9562306a36Sopenharmony_ciequivalent to the MUF/DVF/RDV instructions.  This is acceptable according
9662306a36Sopenharmony_cito the ARM manual.  The manual notes these are defined only for single
9762306a36Sopenharmony_cioperands, on the actual FPA11 hardware they do not work for double or
9862306a36Sopenharmony_ciextended precision operands.  The emulator currently does not check
9962306a36Sopenharmony_cithe requested permissions conditions, and performs the requested operation.
10062306a36Sopenharmony_ci
10162306a36Sopenharmony_ciRMF{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - IEEE remainder
10262306a36Sopenharmony_ci
10362306a36Sopenharmony_ciThis is fully implemented.
10462306a36Sopenharmony_ci
10562306a36Sopenharmony_ciMonadic operations:
10662306a36Sopenharmony_ci
10762306a36Sopenharmony_ciMVF{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - move
10862306a36Sopenharmony_ciMNF{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - move negated
10962306a36Sopenharmony_ci
11062306a36Sopenharmony_ciThese are fully implemented.
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ciABS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - absolute value
11362306a36Sopenharmony_ciSQT{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - square root
11462306a36Sopenharmony_ciRND{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - round
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ciThese are fully implemented.
11762306a36Sopenharmony_ci
11862306a36Sopenharmony_ciURD{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - unnormalized round
11962306a36Sopenharmony_ciNRM{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - normalize
12062306a36Sopenharmony_ci
12162306a36Sopenharmony_ciThese are implemented.  URD is implemented using the same code as the RND
12262306a36Sopenharmony_ciinstruction.  Since URD cannot return a unnormalized number, NRM becomes
12362306a36Sopenharmony_cia NOP.
12462306a36Sopenharmony_ci
12562306a36Sopenharmony_ciLibrary calls:
12662306a36Sopenharmony_ci
12762306a36Sopenharmony_ciPOW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - power
12862306a36Sopenharmony_ciRPW{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - reverse power
12962306a36Sopenharmony_ciPOL{cond}<S|D|E>{P,M,Z} Fd, Fn, <Fm,#value> - polar angle (arctan2)
13062306a36Sopenharmony_ci
13162306a36Sopenharmony_ciLOG{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base 10
13262306a36Sopenharmony_ciLGN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - logarithm to base e
13362306a36Sopenharmony_ciEXP{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - exponent
13462306a36Sopenharmony_ciSIN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - sine
13562306a36Sopenharmony_ciCOS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - cosine
13662306a36Sopenharmony_ciTAN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - tangent
13762306a36Sopenharmony_ciASN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arcsine
13862306a36Sopenharmony_ciACS{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arccosine
13962306a36Sopenharmony_ciATN{cond}<S|D|E>{P,M,Z} Fd, <Fm,#value> - arctangent
14062306a36Sopenharmony_ci
14162306a36Sopenharmony_ciThese are not implemented.  They are not currently issued by the compiler,
14262306a36Sopenharmony_ciand are handled by routines in libc.  These are not implemented by the FPA11
14362306a36Sopenharmony_cihardware, but are handled by the floating point support code.  They should
14462306a36Sopenharmony_cibe implemented in future versions.
14562306a36Sopenharmony_ci
14662306a36Sopenharmony_ciSignalling:
14762306a36Sopenharmony_ci
14862306a36Sopenharmony_ciSignals are implemented.  However current ELF kernels produced by Rebel.com
14962306a36Sopenharmony_cihave a bug in them that prevents the module from generating a SIGFPE.  This
15062306a36Sopenharmony_ciis caused by a failure to alias fp_current to the kernel variable
15162306a36Sopenharmony_cicurrent_set[0] correctly.
15262306a36Sopenharmony_ci
15362306a36Sopenharmony_ciThe kernel provided with this distribution (vmlinux-nwfpe-0.93) contains
15462306a36Sopenharmony_cia fix for this problem and also incorporates the current version of the
15562306a36Sopenharmony_ciemulator directly.  It is possible to run with no floating point module
15662306a36Sopenharmony_ciloaded with this kernel.  It is provided as a demonstration of the
15762306a36Sopenharmony_citechnology and for those who want to do floating point work that depends
15862306a36Sopenharmony_cion signals.  It is not strictly necessary to use the module.
15962306a36Sopenharmony_ci
16062306a36Sopenharmony_ciA module (either the one provided by Russell King, or the one in this
16162306a36Sopenharmony_cidistribution) can be loaded to replace the functionality of the emulator
16262306a36Sopenharmony_cibuilt into the kernel.
163