cangcanglang 发表于 2022-3-2 14:15:32

Vitis HLS跑通视觉加速例程

1. 新建工程

http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244518-1.pngProject命名
http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244519-2.png时钟平台选择2. 添加文件
从Vitis_Libraries-master\vision\L1\examples\demosaicing中复制所有的源文件到新建工程的目录E:\HLS_File\Ex02_demosaicing

http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244520-3.png添加文件后引用单个HLS内核文件,引用 Vision 库(-cflags/-csimflags)
-IE:/HLS_File/Vitis_Libraries-master/vision/L1/include -I./. -D__SDSVHLS__ -std=c++14

http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244521-4.png内核文件CFLAS/CSIMLAGS设置引用 Test bench文件,引用用于C仿真的Vision库,引用OpenCV 包含文件(-cflags/-csimflags)
-IE:/HLS_File/Vitis_Libraries-master/vision/L1/include -ID:/opencv/build_win10/install/include -I./. -D__SDSVHLS__-std=c++14

http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244522-5.pngTest Bench文件CFLAS/CSIMLAGS设置3. C-Sim
本部分通过将 HLS IP 和 Testbench 设计发送给编译器进行编译和执行,来执行 HLS 流的 C仿真阶段。此命令用于设置编译器链接器标志和 testbench文件,以及:(官方例程需要修改TB文件:xf:: cv::read为cv::read;xf:: cv::write为cv::write)
引用 OpenCV包含和预编译的库目录
-ldflags “-L D:/opencv/build_win10/install/x64/mingw/lib -lopencv_imgcodecs3411 -lopencv_imgproc3411 -lopencv_core3411 -lopencv_highgui3411 -lopencv_flann3411 -lopencv_features2d3411”
包括用于验证测试台的图像作为主要功能的参数
-argv “E:/HLS_File/Vitis_Libraries-master/vision/data/128x128.png”

http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244523-6.pngC仿真参数设置
http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244524-7.pngC仿真结果4. C到RTL综合
本部分执行Vitis HLS C到 RTL合成阶段。此阶段不需要标志或选项。

http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244525-8.pngRTL综合结果5. C/RTL协同仿真
本部分在合成后执行 Vitis HLS IP的 RTL 协同仿真。HLS会自动根据 C testbench 生成RTL testbench进行协同仿真,以下指令用于设置编译器链接器标志和testbench文件,以及:

http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244526-9.pngCo-sim仿真参数设置
http://xilinx.eetrend.com/files/2022-03/%E5%8D%9A%E5%AE%A2/100558159-244527-10.pngCo-sim仿真结果6. 过程遇到问题及解决方案
error: no matching function for call to 'imread(char*&, int)'
解决方法:xf:: cv::read为cv::read;xf:: cv::write为cv::write
参考:no matching function for call to ‘transform - 程序园 (voidcn.com)
在G ++编译命令中包含-std = c ++ 0x的意义是什么?
解决方法:默认情况下,GCC编译C++代码为 gnu++ 98 ,这是一种奇怪的方式说C++ 98标准加上大量的gnu extenstions。你可以使用-std=?向编译器说明应遵循的标准。不要忽略 -pedantic ,否则会违反标准。你可以选择的选项:
standard with gnu extensions
c++ 98 gnu++ 98
c++ 03 gnu++ 03
c++ 11(c++ 0x)gnu++ 11(gnu++ 0x)
c++ 14(c++ 1y)gnu++ 14(gnu++ 1y)
warning: variable templates only available with -std=c++14 or -std=gnu++14
解决方法:修改C++编译设置-std = c ++ 0x为-std = c++14

h09721 发表于 2022-4-21 07:17:12

kingweison 发表于 2023-10-3 08:55:52

页: [1]
查看完整版本: Vitis HLS跑通视觉加速例程