Libraries and Binary Compatibility
The SDK compiler system only includes software floating-point C runtime libraries. To take
advantage of the hardware FPU, the libraries must be recompiled with the appropriate
compiler switches.
For all cases where separate compilation is used, it is very important that you ensure the
consistency of FPU compiler flags throughout the build.
Operator Latencies
The latencies of the various operations supported by the FPU are listed in
"MicroBlaze Instruction Set Architecture."
one operation can be ongoing at any time.
C Language Programming
To gain maximum benefit from the FPU without low-level assembly-language
programming, it is important to consider how the C compiler will interpret your source
code. Very often the same algorithm can be expressed in many different ways, and some are
more efficient than others.
Immediate Constants
Floating-point constants in C are double-precision by default. When using a single-
precision FPU, careless coding could result in double-precision software emulation routines
being used instead of the native single-precision instructions. To avoid this, explicitly
specify (by cast or suffix) that immediate constants in your arithmetic expressions are
single-precision values.
For example:
float x = 0.0;
...
x += (float)1.0; /* float addition */
x += 1.0F;
x += 1.0;
Note that the GNU C compiler can be instructed to treat all floating-point constants as
single-precision (contrary to the ANSI C standard) by supplying the compiler flag -fsingle-
precision-constants.
Avoiding Unnecessary Casting
While conversions between floating-point and integer formats are supported in hardware
by the FPU, when
possible.
MicroBlaze Processor Reference Guide
UG984 (v2018.2) June 21, 2018
/* alternative to above */
/* warning - uses double addition! */
is set to 2 (Extended), it is still best to avoid them when
C_USE_FPU
www.xilinx.com
Chapter 2: MicroBlaze Architecture
The FPU instructions are not pipelined, so only
Chapter 5,
93
Send Feedback
Need help?
Do you have a question about the MicroBlaze and is the answer not in the manual?
Questions and answers