X hits on this document





8 / 17

APU Floating-Point Unit v3.1

Software Support

The only target platform supported is the standalone board support package. The EDK compiler sys- tem, based on GCC, provides support for the APU Floating-Point Unit compliant with the PowerPC EABI. Compiler flags are automatically added to the GCC command line based on the type of FPU present in the system. The ANSI C data types float and double are recognized and interpreted as in Table 2.

Compiler flag





64-bit (SW)



64-bit (SW)

Table 2: Compiler Flags for Floating-Point Unit Support

FPU Variant

Single precision without sqrt, div Single precision with sqrt, div

Floating-point representation

All double-precision operations are emulated in software. Be aware that the xil_printf() function does not support floating-point output. The standard C library printf() and related functions do support floating-point output, but are very large (often too large for a small-footprint embedded system).

Libraries and Binary Compatibility

There are some subtleties surrounding the linking of object code compiled with the various flags described above. These can be summed up by the following observations:

Figure Top x-ref 4If two object files were compiled with different FPU compiler flags, the object code resulting from linking the two together may contain any floating-point instruction permitted by either flag.

precision is not available, the compiler will ensure that values of that type are passed to emulation routines on the stack. Otherwise, if support is present, these values will be passed in floating-point registers.

When compiling a monolithic application, there are no issues since the same compiler flags are used for every file. However, when performing separate compilation, or linking against pre-compiled libraries, these object-code differences can cause problems. A mismatch in parameter-passing semantics can cause functions to receive incorrect values. Issuing unsupported instructions, or issuing any float- ing-point instructions when the APU interface is not enabled, causes undefined behavior. In general, it is not possible to detect these problems until run-time.

The modified GNU C compiler framework supplied with the FPU includes multiple pre-compiled ver- sions of the C runtime libraries (libxil and others). The linker will choose the appropriate library to link against according to the FPU compiler flag used to build the top-level application. No user intervention is required.

For all other cases where separate compilation is used, it is very important that you ensure the consis- tency of FPU compiler flags throughout the build.

Programming Considerations

The performance of floating-point code running on the PowerPC with an APU FPU depends on the dataflow properties of the algorithm in question, and on the latency and throughput properties of the FPU itself. Both of these factors are examined briefly in this section.

Operator Latencies and Initiation Intervals

Table 3 shows the latencies of the various operations supported by the FPU. The add and multiply operators are fully pipelined, so a new operation can be initiated on each FPU clock cycle. The divide



March 11, 2008 Product Specification

Document info
Document views26
Page views26
Page last viewedWed Oct 26 09:37:40 UTC 2016