Device Family: Intel® Arria® 10, Arria® V, Intel® Cyclone® 10 GX, Cyclone® V, Intel® MAX® 10, Intel® Stratix® 10

Type: Answers

Area: Embedded


Last Modified: October 17, 2018
Version Found: v18.0
Bug ID: FB: 2205697241;

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

Description

Due to a problem in the Intel HLS Compiler Pro version 18.1 or earlier, you may see unexpected value by __builtin_popcountll(unsigned long long) and __builtin_popcountl(unsigned long). You also see ‘Error: Cosim testbench elaboration failed.’ with these builtin functions during compling in the Intel HLS Compiler Stanard version 18.1 or earlier.

Workaround/Fix

To avoid this error, you need to use ‘__builtin_popcount(unsigned int) instead of these functions below.

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 Quartus® Prime Pro/Standard software including the Intel HLS Comipler.