2
\$\begingroup\$

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.

\$\endgroup\$

3 Answers 3

4
\$\begingroup\$

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

\$\endgroup\$
0
2
\$\begingroup\$

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.

\$\endgroup\$
3
  • \$\begingroup\$ Yes, but any microcontroller has direct instrucctions that manage directly the floating point arithmetic? For Instance: plus,3.678,2.45 \$\endgroup\$
    – Peterstone
    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\$
    – Peterstone
    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\$
    – Kortuk
    Commented Jan 27, 2011 at 18:44
2
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.