先看官网手册
也就是说DMA在连接任何streaming IP时,必须要接受tlast作为结束某段信息的标志,否则就会有卡死的现象,需要在vitis HLS(2020版,更早的版本可能是vivado HLS)中通过c写一个加tlast的IP加到框图中。
在网上各种找没找到教怎么写的,作为一个小白硬着头皮查半天终于写了出来。
代码如下:
#include "ap_axi_sdata.h"
#include <hls_stream.h>
void add_tlast(hls::stream<ap_axis<32,2,5,6>> &in_stream, hls::stream<ap_axis<32,2,5,6>> &out_stream)
{
#pragma HLS INTERFACE axis port = in_stream
#pragma HLS INTERFACE axis port = out_stream
#pragma hls interface s_axilite port=return
#pragma HLS INTERFACE ap_ctrl_none port=return
ap_axis <32,2,5,6> tmp;
while(1)
{
in_stream.read(tmp);
out_stream.write(tmp);
if (tmp.last)
break;
}
}
至于 vitis HLS的教程,网上已有很多,在这里就不献丑了。