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.
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.