3
\$\begingroup\$

I wonder if I could perform floating point operations in a Picoblaze controller? Thank you to all posible answers with direct references to documentation or articles.

\$\endgroup\$
1
  • \$\begingroup\$ The MicroBlaze has hardware floating-point support. \$\endgroup\$ Jan 29, 2011 at 12:37

3 Answers 3

10
\$\begingroup\$

Unfortunately, I do not think that the Picoblaze has hardware support for floating-point. If it does, you can do it in hardware. Otherwise, you will need to do it in software emulation mode.

Since I noticed that you asked the same question for both the Picoblaze and the Microblaze, maybe you need to ask yourself why you need to do floating-point operations.

In many cases, there are alternatives to floating-point operations. Fixed-point operations are a common alternative to floating point. You will need to study your algorithms to determine if it is possible to represent the values in a fixed-point math alternative to floating-point math.

For example, if you use an 4-bit fixed-point width, you can represent values in quantums of 0.125 between -1.0 to 0.875 with fixed-point representation. Larger values can be scalar multiples of these values.

Edit: Article explaining float-to-fixed-point conversion.

\$\endgroup\$
4
  • \$\begingroup\$ Can you justify your opinion by mention any article or documentation reference? \$\endgroup\$
    – Peterstone
    Jan 31, 2011 at 8:50
  • \$\begingroup\$ Which part, float-to-fixed point conversion? \$\endgroup\$
    – sybreon
    Feb 1, 2011 at 10:22
  • \$\begingroup\$ sybreon is correct to mention fixed-point when floating-point isn't available. I know for a fact that in smaller, older or less powerful gaming consoles, where there is no FPU (Floating-Point Unit), fixed-point math is commonly used. \$\endgroup\$ Feb 1, 2011 at 10:30
  • \$\begingroup\$ I've done a lot of fixed point work over the years. Between that and simple scaling (taking all your numbers and *16 so you have 4 bits of fractional data at the expense of 1/16th the range) I have never had to use floating point numbers in embedded systems in over 13 years of work in the field. \$\endgroup\$
    – akohlsmith
    Feb 1, 2011 at 14:10
5
\$\begingroup\$

Picoblaze does not have floating point support. The supported instruction set is very limited, but useful for simple applications.

However, if you require floating point support, it is possible to develop your own interface between picoblaze and a Xilinx Floating Point Core (or other logic). In this situation, you could write data out to the core, and read the result back. I have no idea what your performance requirements are... you would have to consider the communication overhead.

As previously mentioned, MicroBlaze has hardware single precision FPU, and can handle double precision operations with software emulation.

The Picoblaze documentation is very good and can be found here. Additionally, check out the Xilinx User Forums which has support related to Picoblaze and Microblaze.

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

You can do floating point in Picoblaze, but if you try IEEE754 it'll be

  1. very slow: it's an 8-bit processor trying to do operations on 32-bit or 64-bit data types.
  2. hard work: nothing's written ready for you to use, so you'll have to do it all yourself
  3. potentially impossible as the amount of code required is probably more than Picoblaze can address

Depending on your requirements, you could possibly come up with a custom "small floating point", maybe 2 bytes wide with a 4 bit exponent and 12 bit significand? You'd still have to write your own arithmetic code for it though.

If you must use Picoblaze, fixed-point is going to "fit" it much better.

To be honest though Picoblaze is a weird choice for anything math-related as it doesn't even have a hardware multiplier!

Maybe fall back a step and describe the problem you think you can solve with Picoblaze (as you mention System Generator in another comment, there may be a better way using the tools available)

\$\endgroup\$
2
  • \$\begingroup\$ What about Microblaze being used for floating point calculation \$\endgroup\$
    – quantum231
    Jan 14 at 22:46
  • \$\begingroup\$ @quantum231 - Yes, Microblaze has floating-point hardware. If you need more than that, please ask create a new question :) \$\endgroup\$ Jan 16 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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