我正在使用Vivado HLS 2015.4上的图像。
我获得了大约311774个时钟周期的非常高的延迟。即使程序只需要两个输入图像并将其从RGB转换为灰色。总延迟为311774,因为我为所有三个Axi2Mat
,RGB2GRAY
和Mat2AXI
提供了77-78k的延迟。
有没有办法减少它,以便我可以管道它以使最终延迟大约78k?
我附上了我的代码和综合报告:
#include <hls_video.h>
#include <hls/hls_video_types.h>
#include "top.h"
void toGray(AXI_IN_STREAM &IN_STREAM_1, AXI_IN_STREAM &IN_STREAM_2, AXI_OUT_STREAM &OUT_STREAM_1, AXI_OUT_STREAM &OUT_STREAM_2, unsigned int cols, unsigned int rows){
#pragma HLS INTERFACE axis port=IN_STREAM_1
#pragma HLS INTERFACE axis port=OUT_STREAM_1
#pragma HLS INTERFACE axis port=IN_STREAM_2
#pragma HLS INTERFACE axis port=OUT_STREAM_2
#pragma HLS RESOURCE core=AXI_SLAVE variable=rows metadata="-bus_bundle CONTROL"
#pragma HLS RESOURCE core=AXI_SLAVE variable=cols metadata="-bus_bundle CONTROL"
#pragma HLS RESOURCE core=AXI_SLAVE variable=return metadata="-bus_bundle CONTROL"
#pragma HLS INTERFACE ap_stable port=rows
#pragma HLS INTERFACE ap_stable port=cols
hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3> inMat_1(rows, cols);
hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3> inMat_2(rows, cols);
hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC1> grayMat_1(rows, cols);
hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC1> grayMat_2(rows, cols);
// hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC1> outMat(rows, cols);
hls::AXIvideo2Mat(IN_STREAM_1, inMat_1);
hls::AXIvideo2Mat(IN_STREAM_2, inMat_2);
hls::CvtColor<HLS_BGR2GRAY, HLS_8UC3, HLS_8UC1>(inMat_1, grayMat_1);
hls::CvtColor<HLS_BGR2GRAY, HLS_8UC3, HLS_8UC1>(inMat_2, grayMat_2);
// hls::EqualizeHist(grayMat, outMat );
hls::Mat2AXIvideo(grayMat_1, OUT_STREAM_1);
hls::Mat2AXIvideo(grayMat_2, OUT_STREAM_2);
}
答案 0 :(得分:1)
UG902:Vivado Design Suite用户指南第293页:由于功能已经流水线化,因此添加DATAFLOW优化可确保 流水线函数将并行执行。
因此,只需在代码中添加#pragma HLS dataflow
指令即可确保每个时钟处理一个样本,并在函数之间使用数据流。因此,延迟应该减少到77-78k(我假设是cols*rows
)。