The C++ and HLS backends agree well (checking the outputs from decision_function for the same input), relying on ap_fixed types to do the heavy lifting. The VHDL backend uses integer throughout and currently does not agree so well with the others. This PR goes part way to making the VHDL backend agree with the others by using the ap_fixed C++ to round/truncate/saturate as appropriate those values that are constant (thresholds, scores). A pybind11 adapter is written on the fly depending on the precision specified in configuration, called from the writer and decision function.
There are still cases where mismatches between C++ and VHDL can arise - e.g. when the output score saturates - that will be addressed in a later PR.
The C++ and HLS backends agree well (checking the outputs from
decision_function
for the same input), relying onap_fixed
types to do the heavy lifting. The VHDL backend usesinteger
throughout and currently does not agree so well with the others. This PR goes part way to making the VHDL backend agree with the others by using theap_fixed
C++ to round/truncate/saturate as appropriate those values that are constant (thresholds, scores). Apybind11
adapter is written on the fly depending on the precision specified in configuration, called from the writer and decision function.There are still cases where mismatches between C++ and VHDL can arise - e.g. when the output score saturates - that will be addressed in a later PR.