您当前的位置: 首页 > 

FPGA硅农

暂无认证

  • 0浏览

    0关注

    282博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

ZYNQ及HLS开发中遇到的问题记录

FPGA硅农 发布时间:2021-08-25 23:32:57 ,浏览量:0

一.数组字节对齐问题

可通过__attribute__((aligned(#)))进行数组首地址的#字节对齐,这在某些情况下是非常有用且必要的。比如,当PL端位宽为128bit时,那么PS端被读取的数组的首地址必须是16字节对齐的,否则会发生读取的错位,从而造成错误。

 二.malloc指针的字节对齐问题

同一,只是对齐使用的方法不同,这里使用的是memalign函数

三.HLS m_axi接口的burst length问题

在对接口进行pragma设置时,需要加上max_read(write)_burst_length,否则,即使HLS综合工具推断出正确的burst length,在实际生成RTL代码时,还会受max_read_burst_length的限制,导致无法达到自己想要的突发传输效果。

 INFO: [HLS 200-444] Inferring multiple bus burst write of a total cumulative length 9 on port 'out' (test1/test.cpp:21:2). These data requests might be further partitioned to multiple requests during RTL generation, based on max_read_burst_length or max_write_burst_length settings. INFO: [HLS 200-444] Inferring multiple bus burst read of a total cumulative length 9 on port 'in' (test1/test.cpp:7:43). These data requests might be further partitioned to multiple requests during RTL generation, based on max_read_burst_length or max_write_burst_length settings.

四.解决分块加载特征图时难以突发传输的问题

我们知道,在分块加载输入特征in[n:n+Tn][r:r+Tr][c:c+Tc]进行卷积运算时,由于padding的存在,往往需要判断当前值是从特征图数组读入还是直接读入为0,而这往往会造成突发传输的中断,因此,我们换一个思路,首先不管三七二十一,读入地址连续的Tc+K-1个数据,然后再判断哪些是有效的,哪些其实位于padding的位置,下面的代码就是一个简单的例子(load函数):

#include"test.h"

void load(int* in,int buff[Tr+K-1][Tc+K-1],int row,int col,int size){
	for(int i=0;i            
关注
打赏
1658642721
查看更多评论
0.0388s