Article ID: 000075873 Content Type: Troubleshooting Last Reviewed: 08/13/2015

Why do I get incorrect results when using the ALTFP_CONVERT megacore to perform floating-point to fixed-point conversions?

Environment

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Description

Due to a problem with the Quartus® II software, if the input of the ALTFP_CONVER is smaller than the smallest representable number for the chosen output format, the output will give erroneous results.

For example, when doing a floating to fixed point conversion using 32.16 (that is 32 bit width of which 16 bits are the fraction), the smallest representable number is -1.5258789E-5 (0xb7800000).  If one inputs

-0.00000762939453125 (0xb7000000), the result will show -2147483648 (0xcf000000) which is incorrect.

Resolution

Altera recommends to use the new ALTERA_FP_FUNCTIONS megacore for future designs, where the functionality is correct.

Otherwise you will need to range check your inputs an subsitute a full scale output whenever the input falls below the smallest representable value.

This will not be fixed in a future version of Quartus.

Related Products

This article applies to 14 products

Cyclone® V GT FPGA
Stratix® V GS FPGA
Stratix® V GT FPGA
Cyclone® V E FPGA
Cyclone® V GX FPGA
Cyclone® V SE SoC FPGA
Cyclone® V ST SoC FPGA
Cyclone® V SX SoC FPGA
Arria® V GT FPGA
Arria® V GX FPGA
Arria® V GZ FPGA
Arria® V ST SoC FPGA
Stratix® V GX FPGA
Stratix® V E FPGA

1