error: implicit instantiation of undefined template ‘ssdm_int<3072, false>’
问题描述
在编写HLS代码过程中,使用任意精度数据ap_int<>
时报错,而且是头文件出了问题。
D:/xilinx/Vivado/2018.3/common/technology/autopilot\ap_int_base.h:150:29: error: implicit instantiation of undefined template 'ssdm_int<3072, false>'
struct ap_int_base : public ssdm_int<_AP_W, _AP_S> {
^
D:/xilinx/Vivado/2018.3/common/technology/autopilot\ap_int.h:194:18: note: in instantiation of template class 'ap_int_base<3072, false>' requested here
struct ap_uint : ap_int_base<_AP_W, false> {
^
D:/xilinx/Vivado/2018.3/common/technology/autopilot\hls_stream.h:183:18: note: in instantiation of template class 'ap_uint<3072>' requested here
__STREAM_T__ V;
^
网上查阅问题无解,故翻阅UG902查找问题,发现一段描述:
默认的任意精度类型ap_[u]int<N>
中的N的范围为1-1024,而我的整数流数据的位宽达到了3072,因而报错。
解决方案
在包含ap_int.h
头文件之前定义含正整数(小于或等于32768)的AP_INT_MAX_W 宏来覆盖,其中AP_INT_MAX_W 的值需大于代码中设置的任意精度整数的最大位宽,但也不要过大,否则会导致软件编译缓慢、运行时间延长。解决方案如下图所示: