I wonder if I could perform floating point operations in a Microblaze controller? Thank you to all posible answers with direct references to documentation or articles.
3 Answers
Floating-point operations are available, see this document. Try the Xilinx forums for support.
That document, in the FPU section on page 78, says that the processor supports:
The FPU implements the following floating point operations:
• addition, fadd
• subtraction, fsub
• multiplication, fmul
• division, fdiv
• square root, fsqrt (available if C_USE_FPU = 2)
Comparison
• compare less-than, fcmp.lt
• compare equal, fcmp.eq
• compare less-or-equal, fcmp.le
• compare greater-than, fcmp.gt
• compare not-equal, fcmp.ne
• compare greater-or-equal, fcmp.ge
• compare unordered, fcmp.un (used for NaN)
Conversion
The FPU implements the following conversions (available if C_USE_FPU = 2):
• convert from signed integer to floating point, flt
• convert from floating point to signed integer, fint
Any microcontroller can implement floating point, it is just that those with hardware can do it much much faster. The compiler can do the required work to get options like floating point division, it can just take 1000s of clock cycles.
-
\$\begingroup\$ Yes, but any microcontroller has direct instrucctions that manage directly the floating point arithmetic? For Instance: plus,3.678,2.45 \$\endgroup\$ Commented Jan 27, 2011 at 8:36
-
\$\begingroup\$ A xilinx microblaze controller has a latency of 30. (See the page 136 of this document xilinx.com/support/documentation/sw_manuals/mb_ref_guide.pdf ) \$\endgroup\$ Commented Jan 27, 2011 at 8:55
-
\$\begingroup\$ @Peterstone, you can code in assembly, but if you are using C the compiler will handle it for you. I was making this point so that people do not make microcontroller decisions based on a floating point operation they must compute every 3 days. \$\endgroup\$– KortukCommented Jan 27, 2011 at 18:44
It's been a couple of years, but I believe that one can build a MicroBlaze with or without hardware floating point. If I remember correctly, without took 3 DSP48x blocks and with took 6 DSP48x blocks. I think when you build it, it sets the switches so that the compiler knows what it has.
Part of the decision process in design was how many BRAM blocks to use as well and whether to put these on local bus to the MicroBlaze or on AXI. I think that it is possible to use dual port BRAM and use one port as local bus (1 cycle faster) and the other side as AXI. Something like that.