Article ID: 000086543 Content Type: Troubleshooting Last Reviewed: 06/20/2023

Why does __builtin_popcountll in the Intel® HLS Compiler return unexpected value?

Environment

  • Intel® Quartus® Prime Pro Edition
  • BUILT IN - ARTICLE INTRO SECOND COMPONENT
    Description

    Due to a problem in the Intel® HLS Compiler Pro version 18.1 or earlier, you might see unexpected value by __builtin_popcountll(unsigned long long) and __builtin_popcountl(unsigned long). You might also see ‘Error: Cosim testbench elaboration failed.’ with these built-in functions when compiling the Intel HLS Compiler Standard version 18.1 or earlier.

    Resolution

    To avoid this error, use __builtin_popcount(unsigned int) instead of the following functions:

    int __builtin_popcountll_workaround(unsigned long long v)
    {

       return __builtin_popcount((unsigned int)v) __builtin_popcount((unsigned int)(v>>32)) ;

    }

    This problem is scheduled to be fixed in a future release of the Intel® Quartus® Prime Pro/Standard Edition Software including the Intel HLS Compiler.

    Related Products

    This article applies to 6 products

    Intel® Cyclone® 10 GX FPGA
    Cyclone® V FPGAs and SoC FPGAs
    Intel® Arria® 10 FPGAs and SoC FPGAs
    Arria® V FPGAs and SoC FPGAs
    Intel® Stratix® 10 FPGAs and SoC FPGAs
    Intel® MAX® 10 FPGAs