Intel® High Level Synthesis Compiler Standard Edition: Best Practices Guide

ID 683259
Date 12/18/2019
Public
Document Table of Contents

6. Datatype Best Practices

The datatypes in your component and possible conversions or casting that they might undergo can significantly affect the performance and FPGA area usage of your component. Review the datatype best practices for tips and guidance how best to control datatype sizes and conversions in your component.

After you optimize the algorithm bottlenecks of your design, you can fine-tune some datatypes in your component by using arbitrary precision datatypes to shrink data widths, which reduces FPGA area utilization. The Intel® HLS Compiler Standard Edition provides debug functionality so that you can easily detect overflows in arbitrary precision datatypes.

Tutorials Demonstrating Datatype Best Practices

The Intel® HLS Compiler Standard Edition comes with a number of tutorials that give you working examples to review and run so that you can see good coding practices as well as demonstrating important concepts.

Review the following tutorials to learn about datatype best practices that might apply to your design:
Tutorial Description
You can find these tutorials in the following location on your Intel® Quartus® Prime system:
<quartus_installdir>/hls/examples/tutorials
best_practices/ac_datatypes Demonstrates the effect of using ac_int datatype instead of int datatype.
ac_datatypes/ac_fixed_constructor Demonstrates the use of the ac_fixed constructor where you can get a better QoR by using minor variations in coding style.
ac_datatypes/ac_int_basic_ops Demonstrates the operators available for the ac_int class.
ac_datatypes/ac_int_overflow Demonstrates the usage of the DEBUG_AC_INT_WARNING and DEBUG_AC_INT_ERROR keywords to help detect overflow during emulation runtime.
best_practices/single_vs_double_precision_math Demonstrates the effect of using single precision literals and functions instead of double precision literals and functions.
best_practices/integer_promotion Demonstrates how integer promotion rules can influence the behavior of a C or C++ program.