Dealing with Unsupported Functions - 2024.2 English - UG1399

Vitis High-Level Synthesis User Guide (UG1399)

Document ID
UG1399
Release Date
2024-11-13
Version
2024.2 English

There is no automatic conversion from ap_float<> to any float datatypes: this is a library's design decision to force designers to think about the desired precision and associated costs when making a type conversion.

As such, the use of ap_float<> with any unsupported functions in the library will trigger a compilation error like in the example below.

ap_float<16,8> k;
... = hls::log(k); // log is not expecting ap_float<>
// will give
ERROR: [HLS 207-3339] no matching function for 'log’ 
INFO: [HLS 207-4378] candidate function not viable: no known conversion from 'ap_float<16, 8>' for 1st argument

When faced with this example the design can explicitly convert ap_float<> to any of float, ap_fixed<> or ap_int<>/int datatypes:

... = hls::log((float)k);          // using float
... = hls::log((ap_fixed<20,5>)k); // using ap_fixed
... = hls::log((int)k);            // using int or ap_int