3

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.

Trygve Laugstøl
  • 1,410
  • 2
  • 19
  • 28
Peterstone
  • 945
  • 2
  • 14
  • 30

3 Answers3

10

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.

sybreon
  • 1,591
  • 1
  • 12
  • 13
  • Can you justify your opinion by mention any article or documentation reference? – Peterstone Jan 31 '11 at 08:50
  • Which part, float-to-fixed point conversion? – sybreon Feb 01 '11 at 10:22
  • 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. – Mr. Hedgehog Feb 01 '11 at 10:30
  • 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. – akohlsmith Feb 01 '11 at 14:10
5

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.

Josh
  • 368
  • 2
  • 13
2

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)

Martin Thompson
  • 8,439
  • 1
  • 23
  • 44