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

相关文章

电脑找不到mfc90u.dll文件怎么办? 系统报错mfc90u.dll丢失修复的5种方案

《电脑找不到mfc90u.dll文件怎么办?系统报错mfc90u.dll丢失修复的5种方案》在我们日常使用电脑的过程中,可能会遇到一些软件或系统错误,其中之一就是mfc90u.dll丢失,那么,mf... 在大部分情况下出现我们运行或安装软件,游戏出现提示丢失某些DLL文件或OCX文件的原因可能是原始安装包

电脑显示mfc100u.dll丢失怎么办?系统报错mfc90u.dll丢失5种修复方案

《电脑显示mfc100u.dll丢失怎么办?系统报错mfc90u.dll丢失5种修复方案》最近有不少兄弟反映,电脑突然弹出“mfc100u.dll已加载,但找不到入口点”的错误提示,导致一些程序无法正... 在计算机使用过程中,我们经常会遇到一些错误提示,其中最常见的就是“找不到指定的模块”或“缺少某个DL

解决IDEA报错:编码GBK的不可映射字符问题

《解决IDEA报错:编码GBK的不可映射字符问题》:本文主要介绍解决IDEA报错:编码GBK的不可映射字符问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录IDEA报错:编码GBK的不可映射字符终端软件问题描述原因分析解决方案方法1:将命令改为方法2:右下jav

MyBatis模糊查询报错:ParserException: not supported.pos 问题解决

《MyBatis模糊查询报错:ParserException:notsupported.pos问题解决》本文主要介绍了MyBatis模糊查询报错:ParserException:notsuppo... 目录问题描述问题根源错误SQL解析逻辑深层原因分析三种解决方案方案一:使用CONCAT函数(推荐)方案二:

Pandas透视表(Pivot Table)的具体使用

《Pandas透视表(PivotTable)的具体使用》透视表用于在数据分析和处理过程中进行数据重塑和汇总,本文就来介绍一下Pandas透视表(PivotTable)的具体使用,感兴趣的可以了解一下... 目录前言什么是透视表?使用步骤1. 引入必要的库2. 读取数据3. 创建透视表4. 查看透视表总结前言

Spring Boot中JSON数值溢出问题从报错到优雅解决办法

《SpringBoot中JSON数值溢出问题从报错到优雅解决办法》:本文主要介绍SpringBoot中JSON数值溢出问题从报错到优雅的解决办法,通过修改字段类型为Long、添加全局异常处理和... 目录一、问题背景:为什么我的接口突然报错了?二、为什么会发生这个错误?1. Java 数据类型的“容量”限制

SpringBoot项目中报错The field screenShot exceeds its maximum permitted size of 1048576 bytes.的问题及解决

《SpringBoot项目中报错ThefieldscreenShotexceedsitsmaximumpermittedsizeof1048576bytes.的问题及解决》这篇文章... 目录项目场景问题描述原因分析解决方案总结项目场景javascript提示:项目相关背景:项目场景:基于Spring

解决SpringBoot启动报错:Failed to load property source from location 'classpath:/application.yml'

《解决SpringBoot启动报错:Failedtoloadpropertysourcefromlocationclasspath:/application.yml问题》这篇文章主要介绍... 目录在启动SpringBoot项目时报如下错误原因可能是1.yml中语法错误2.yml文件格式是GBK总结在启动S

idea maven编译报错Java heap space的解决方法

《ideamaven编译报错Javaheapspace的解决方法》这篇文章主要为大家详细介绍了ideamaven编译报错Javaheapspace的相关解决方法,文中的示例代码讲解详细,感兴趣的... 目录1.增加 Maven 编译的堆内存2. 增加 IntelliJ IDEA 的堆内存3. 优化 Mave

如何解决mmcv无法安装或安装之后报错问题

《如何解决mmcv无法安装或安装之后报错问题》:本文主要介绍如何解决mmcv无法安装或安装之后报错问题,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mmcv无法安装或安装之后报错问题1.当我们运行YOwww.chinasem.cnLO时遇到2.找到下图所示这里3.