HLS 三角函数报错:undefined reference to ‘cordic_apfixed::circ_table_arctan_128‘

本文主要是介绍HLS 三角函数报错:undefined reference to ‘cordic_apfixed::circ_table_arctan_128‘,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

最近在通过HLS实现一些算法,其中用到了hls::cos函数,写完代码编译报错:

../Vitis_HLS/hls_cordic_apfixed.h:229: undefined reference to `cordic_apfixed::circ_table_arctan_128'
build/xf_computePhaseMap_accel.o: In function `void cordic_apfixed::cordic_circ_apfixed<39, 3, 1>(ap_fixed<39, 3, (ap_q_mode)5, (ap_o_mode)3, 0>&, ap_fixed<39, 3, (ap_q_mode)5, (ap_o_mode)3, 0>&, ap_fixed<39, 3, (ap_q_mode)5, (ap_o_mode)3, 0>&)':
../Vitis_HLS/hls_cordic_apfixed.h:229: undefined reference to `cordic_apfixed::circ_table_arctan_128'
collect2: error: ld returned 1 exit status

这个变量在Vitis_HLS/hls_cordic_apfixed.h中,对应的代码是:extern const ap_ufixed<128,2> circ_table_arctan_128[128];,可见该变量是个外部变量。
网上搜了很久,没有相应的解决方案。于是自己研究为什么会这样,个人感觉这个circ_table_arctan_128变量的定义应该是在某个动态链接库中,但是找了一下没找到相应的库,因此只能用最笨的方法了。
circ_table_arctan_128是hls中用在CORDIC算法里面的一些提前计算好的数据,CORDIC算法我就不介绍了,自己百度一下网上很多,一般用在FPGA中简化三角函数的计算。那我们其实可以自己算出来这个数组然后直接修改这个头文件代码。通过GPT大法,我最终算出了可靠的值,大家直接将extern const ap_ufixed<128,2> circ_table_arctan_128[128];这行代码替换为:

const ap_ufixed<128,2> circ_table_arctan_128[128] = {0.7853981633974483,  // atan(2^-0)0.4636476090008061,  // atan(2^-1)0.24497866312686414, // atan(2^-2)0.12435499454676144, // atan(2^-3)0.06241880999595735, // atan(2^-4)0.031239833430268277, // atan(2^-5)0.015623728620476831, // atan(2^-6)0.007812341060101111, // atan(2^-7)0.0039062301319669718, // atan(2^-8)0.0019531225164788188, // atan(2^-9)0.0009765621895593195, // atan(2^-10)0.0004882812111948983, // atan(2^-11)0.00024414062014936177, // atan(2^-12)0.00012207031189367021, // atan(2^-13)0.00006103515617420877, // atan(2^-14)0.000030517578115526396, // atan(2^-15)0.000015258789061315762, // atan(2^-16)0.00000762939453110197, // atan(2^-17)0.000003814697265606496, // atan(2^-18)0.000001907348632810187, // atan(2^-19)0.0000009536743164059602, // atan(2^-20)0.0000004768371582030884, // atan(2^-21)0.0000002384185791015576, // atan(2^-22)0.00000011920928955078125, // atan(2^-23)0.00000005960464477539063, // atan(2^-24)0.00000002980232238769531, // atan(2^-25)0.000000014901161193847656, // atan(2^-26)0.000000007450580596923828, // atan(2^-27)0.000000003725290298461914, // atan(2^-28)0.000000001862645149230957, // atan(2^-29)0.0000000009313225746154785, // atan(2^-30)0.0000000004656612873077393, // atan(2^-31)0.0000000002328306436538696, // atan(2^-32)0.0000000001164153218269348, // atan(2^-33)0.00000000005820766091346741, // atan(2^-34)0.0000000000291038304567337, // atan(2^-35)0.00000000001455191522836685, // atan(2^-36)0.000000000007275957614183426, // atan(2^-37)0.000000000003637978807091713, // atan(2^-38)0.000000000001818989403545856, // atan(2^-39)0.0000000000009094947017729282, // atan(2^-40)0.0000000000004547473508864641, // atan(2^-41)0.0000000000002273736754432321, // atan(2^-42)0.000000000000113686837721616, // atan(2^-43)0.00000000000005684341886080801, // atan(2^-44)0.00000000000002842170943040401, // atan(2^-45)0.000000000000014210854715202, // atan(2^-46)0.000000000000007105427357601002, // atan(2^-47)0.000000000000003552713678800501, // atan(2^-48)0.00000000000000177635683940025, // atan(2^-49)0.0000000000000008881784197001251, // atan(2^-50)0.0000000000000004440892098500626, // atan(2^-51)0.0000000000000002220446049250313, // atan(2^-52)0.0000000000000001110223024625156, // atan(2^-53)0.00000000000000005551115123125783, // atan(2^-54)0.00000000000000002775557561562892, // atan(2^-55)0.00000000000000001387778780781446, // atan(2^-56)0.000000000000000006938893903907228, // atan(2^-57)0.000000000000000003469446951953614, // atan(2^-58)0.000000000000000001734723475976807, // atan(2^-59)0.0000000000000000008673617379884035, // atan(2^-60)0.0000000000000000004336808689942018, // atan(2^-61)0.0000000000000000002168404344971009, // atan(2^-62)0.0000000000000000001084202172485504, // atan(2^-63)0.00000000000000000005421010862427521, // atan(2^-64)0.00000000000000000002710505431213761, // atan(2^-65)0.0000000000000000000135525271560688, // atan(2^-66)0.000000000000000000006776263578034402, // atan(2^-67)0.000000000000000000003388131789017201, // atan(2^-68)0.000000000000000000001694065894508601, // atan(2^-69)0.0000000000000000000008470329472543004, // atan(2^-70)0.0000000000000000000004235164736271502, // atan(2^-71)0.0000000000000000000002117582368135751, // atan(2^-72)0.0000000000000000000001058791184067876, // atan(2^-73)0.00000000000000000000005293955920339378, // atan(2^-74)0.00000000000000000000002646977960169689, // atan(2^-75)0.00000000000000000000001323488980084845, // atan(2^-76)0.000000000000000000000006617444900424225, // atan(2^-77)0.000000000000000000000003308722450212113, // atan(2^-78)0.000000000000000000000001654361225106056, // atan(2^-79)0.000000000000000000000000827180612553028, // atan(2^-80)0.000000000000000000000000413590306276514, // atan(2^-81)0.000000000000000000000000206795153138257, // atan(2^-82)0.0000000000000000000000001033975765691285, // atan(2^-83)0.00000000000000000000000005169878828456426, // atan(2^-84)0.00000000000000000000000002584939414228213, // atan(2^-85)0.00000000000000000000000001292469707114106, // atan(2^-86)0.000000000000000000000000006462348535570531, // atan(2^-87)0.000000000000000000000000003231174267785265, // atan(2^-88)0.000000000000000000000000001615587133892633, // atan(2^-89)0.0000000000000000000000000008075935474463164, // atan(2^-90)0.0000000000000000000000000004037967737231582, // atan(2^-91)0.0000000000000000000000000002018983868615791, // atan(2^-92)0.0000000000000000000000000001009491934307896, // atan(2^-93)0.00000000000000000000000000005047459671539478, // atan(2^-94)0.00000000000000000000000000002523729835769739, // atan(2^-95)0.0000000000000000000000000000126186491788487, // atan(2^-96)0.000000000000000000000000000006309324589424349, // atan(2^-97)0.000000000000000000000000000003154662294712175, // atan(2^-98)0.000000000000000000000000000001577331147356087, // atan(2^-99)0.0000000000000000000000000000007886655736780435, // atan(2^-100)0.0000000000000000000000000000003943327868390218, // atan(2^-101)0.0000000000000000000000000000001971663934195109, // atan(2^-102)0.00000000000000000000000000000009858319670975544, // atan(2^-103)0.00000000000000000000000000000004929159835487772, // atan(2^-104)0.00000000000000000000000000000002464579917743886, // atan(2^-105)0.00000000000000000000000000000001232289958871943, // atan(2^-106)0.000000000000000000000000000000006161449794359716, // atan(2^-107)0.000000000000000000000000000000003080724897179858, // atan(2^-108)0.000000000000000000000000000000001540362448589929, // atan(2^-109)0.0000000000000000000000000000000007701812242949645, // atan(2^-110)0.0000000000000000000000000000000003850906121474823, // atan(2^-111)0.0000000000000000000000000000000001925453060737411, // atan(2^-112)0.00000000000000000000000000000000009627265303687056, // atan(2^-113)0.00000000000000000000000000000000004813632651843528, // atan(2^-114)0.00000000000000000000000000000000002406816325921764, // atan(2^-115)0.00000000000000000000000000000000001203408162960882, // atan(2^-116)0.00000000000000000000000000000000000601704081480441, // atan(2^-117)0.000000000000000000000000000000000003008520407402205, // atan(2^-118)0.000000000000000000000000000000000001504260203701103, // atan(2^-119)0.0000000000000000000000000000000000007521301018505515, // atan(2^-120)0.0000000000000000000000000000000000003760650509252758, // atan(2^-121)0.0000000000000000000000000000000000001880325254626379, // atan(2^-122)0.00000000000000000000000000000000000009401626273131894, // atan(2^-123)0.00000000000000000000000000000000000004700813136565947, // atan(2^-124)0.00000000000000000000000000000000000002350406568282974, // atan(2^-125)0.00000000000000000000000000000000000001175203284141487, // atan(2^-126)0.000000000000000000000000000000000000005876016420707434 // atan(2^-127)};

这样重新编译,hls就不会报错了。

这篇关于HLS 三角函数报错:undefined reference to ‘cordic_apfixed::circ_table_arctan_128‘的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/694854

相关文章

IDEA编译报错“java: 常量字符串过长”的原因及解决方法

《IDEA编译报错“java:常量字符串过长”的原因及解决方法》今天在开发过程中,由于尝试将一个文件的Base64字符串设置为常量,结果导致IDEA编译的时候出现了如下报错java:常量字符串过长,... 目录一、问题描述二、问题原因2.1 理论角度2.2 源码角度三、解决方案解决方案①:StringBui

Python Jupyter Notebook导包报错问题及解决

《PythonJupyterNotebook导包报错问题及解决》在conda环境中安装包后,JupyterNotebook导入时出现ImportError,可能是由于包版本不对应或版本太高,解决方... 目录问题解决方法重新安装Jupyter NoteBook 更改Kernel总结问题在conda上安装了

Python安装时常见报错以及解决方案

《Python安装时常见报错以及解决方案》:本文主要介绍在安装Python、配置环境变量、使用pip以及运行Python脚本时常见的错误及其解决方案,文中介绍的非常详细,需要的朋友可以参考下... 目录一、安装 python 时常见报错及解决方案(一)安装包下载失败(二)权限不足二、配置环境变量时常见报错及

MySQL报错sql_mode=only_full_group_by的问题解决

《MySQL报错sql_mode=only_full_group_by的问题解决》本文主要介绍了MySQL报错sql_mode=only_full_group_by的问题解决,文中通过示例代码介绍的非... 目录报错信息DataGrip 报错还原Navicat 报错还原报错原因解决方案查看当前 sql mo

解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题

《解决IDEA使用springBoot创建项目,lombok标注实体类后编译无报错,但是运行时报错问题》文章详细描述了在使用lombok的@Data注解标注实体类时遇到编译无误但运行时报错的问题,分析... 目录问题分析问题解决方案步骤一步骤二步骤三总结问题使用lombok注解@Data标注实体类,编译时

linux报错INFO:task xxxxxx:634 blocked for more than 120 seconds.三种解决方式

《linux报错INFO:taskxxxxxx:634blockedformorethan120seconds.三种解决方式》文章描述了一个Linux最小系统运行时出现的“hung_ta... 目录1.问题描述2.解决办法2.1 缩小文件系统缓存大小2.2 修改系统IO调度策略2.3 取消120秒时间限制3

解决systemctl reload nginx重启Nginx服务报错:Job for nginx.service invalid问题

《解决systemctlreloadnginx重启Nginx服务报错:Jobfornginx.serviceinvalid问题》文章描述了通过`systemctlstatusnginx.se... 目录systemctl reload nginx重启Nginx服务报错:Job for nginx.javas

VMWare报错“指定的文件不是虚拟磁盘“或“The file specified is not a virtual disk”问题

《VMWare报错“指定的文件不是虚拟磁盘“或“Thefilespecifiedisnotavirtualdisk”问题》文章描述了如何修复VMware虚拟机中出现的“指定的文件不是虚拟... 目录VMWare报错“指定的文件不是虚拟磁盘“或“The file specified is not a virt

使用Vue.js报错:ReferenceError: “Vue is not defined“ 的原因与解决方案

《使用Vue.js报错:ReferenceError:“Vueisnotdefined“的原因与解决方案》在前端开发中,ReferenceError:Vueisnotdefined是一个常见... 目录一、错误描述二、错误成因分析三、解决方案1. 检查 vue.js 的引入方式2. 验证 npm 安装3.

PHP执行php.exe -v命令报错的解决方案

《PHP执行php.exe-v命令报错的解决方案》:本文主要介绍PHP执行php.exe-v命令报错的解决方案,文中通过图文讲解的非常详细,对大家的学习或工作有一定的帮助,需要的朋友可以参考下... 目录执行phpandroid.exe -v命令报错解决方案执行php.exe -v命令报错-PHP War