Nios II Custom Instruction User Guide

ID 683242
Date 4/27/2020
Public
Document Table of Contents

7.5. Assessing Your Floating Point Optimization Needs

The best choice for your hardware design depends on a balance among floating point usage, hardware resource usage, and performance. While the FPH1 custom instructions speed up floating point arithmetic, they add substantially to the size of your hardware project.

Intel recommends using FPH2, which provides better performance and a lower footprint than FPH1.

Before using the FPH1 custom instructions, consider the following questions:

  • Have you identified your performance bottlenecks? Make sure your performance issues are caused by floating point arithmetic before you try to fix them with floating point acceleration.
  • Can you use integer arithmetic? While the FPH1 custom instructions are faster than software-implemented floating point, they are slower than integer arithmetic. A common integer technique is to represent numerical values with an implicit scaling factor. As a simple example, if you are calculating milliamperes, you might represent your values internally as microamperes.
  • Are you taking full advantage of compiler optimization? You can increase the Nios II compiler optimization level through the Properties dialog box of your Nios II application and BSP projects.
  • Have you hand-optimized your mathematical operations? Numerical analysis textbooks offer simple, effective techniques for performing accurate calculations with the minimum number of floating point operations.

If you have followed these suggestions, and you need further acceleration, the floating point custom instructions are an appropriate solution.