跳转到主要内容

FPGA Xilinx HLS hls_math.h库

judy 提交于

本文转载自:<span id="profileBt"><a href="https://blog.csdn.net/wuyanbei24/article/details/113977737">搞FPGA开发的Ton…;

<strong>hls_math 使用事项</strong>
<center><img src="http://xilinx.eetrend.com/files/2022-08/%E5%8D%9A%E5%AE%A2/100563447-26…; alt=""></center>
<center><img src="http://xilinx.eetrend.com/files/2022-08/%E5%8D%9A%E5%AE%A2/100563447-26…; alt=""></center>

In file included from ../../../../apint_arith.c:94:0:
D:/EDA/Xilinx/Vivado/2019.2/include/hls_math.h:36:17: fatal error: cmath: No such file or directory
#include <cmath>
^
compilation terminated.
make: *** [obj/apint_arith.o] Error 1

<center><img src="http://xilinx.eetrend.com/files/2022-08/%E5%8D%9A%E5%AE%A2/100563447-26…; alt=""></center>

在C++中调用hls_math.h库,C syntehsis 没有报错
所以,hls_math.h只能在C++中使用,在C中使用则会报错…

在HLS中使用ap_fixed数据类型,可以结合硬件特性,很好的控制位宽
<center><img src="http://xilinx.eetrend.com/files/2022-08/%E5%8D%9A%E5%AE%A2/100563447-26…; alt=""></center>

在结合hls_math库和AP数据类型一起使用时,需要注意:
<center><img src="http://xilinx.eetrend.com/files/2022-08/%E5%8D%9A%E5%AE%A2/100563447-26…; alt=""></center>