【问题标题】:Vivado HLS GPIO switch data for Zybo BoardZybo 板的 Vivado HLS GPIO 开关数据
【发布时间】:2016-11-02 02:32:03
【问题描述】:

我正在 Vivado HLS 中构建一个自定义 IP 内核,以运行在 Zybo 板上的嵌入式 linux 中运行的图像/视频处理系统。内核在 via 和 AXI 流中获取图像/视频数据,执行处理任务(例如 Sobel),然后将其输出到另一个 AXI 流。这可行,但是,我希望使用 Zybo 的板载开关来确定应该运行哪个处理任务(默认是直通)。

我找不到显示(在 HLS.. 不是 IP Integrator 或 Vivado SDK 中)如何创建 HLS 资源/接口以从 GPIO 开关读取数据的资源或简单示例。我所拥有的是我的顶级模块中的以下代码:

    #include <hls_video.h>
    #include "ip_types.h"

    void MultiImaging(AXI_STREAM& inputStream, AXI_STREAM& outputStream, int rows, int cols, bool sw0, bool sw1)
    {
    #pragma HLS INTERFACE axis port=inputStream
    #pragma HLS INTERFACE axis port=outputStream

    #pragma HLS RESOURCE variable=rows core=AXI_SLAVE metadata="-bus_bundle CONTROL_BUS"
    #pragma HLS RESOURCE variable=cols core=AXI_SLAVE metadata="-bus_bundle CONTROL_BUS"

    #pragma HLS INTERFACE ap_stable port=rows
    #pragma HLS INTERFACE ap_stable port=cols

    //are these two correct for the switches?
    #pragma HLS INTERFACE axis port=sw0
    #pragma HLS INTERFACE axis port=sw1

    //are these two correct for the switches?
    #pragma HLS RESOURCE variable=sw0 core=AXI_SLAVE //GPIO?
    #pragma HLS RESOURCE variable=sw1 core=AXI_SLAVE //GPIO?

    RGB_IMAGE img(rows, cols);
    RGB_IMAGE oimg(rows, cols);
    RGB_IMAGE sobel_output(rows,cols);

    RGB_IMAGE imgh(rows, cols);
    RGB_IMAGE imgv(rows, cols);

    RGB_IMAGE hsobel(rows, cols);
    RGB_IMAGE vsobel(rows, cols);

    GRAY_IMAGE imgGray(rows, cols);
    GRAY_IMAGE oimgGray(rows, cols);

    #pragma HLS dataflow
    hls::AXIvideo2Mat(inputStream, img);


    //Passthrough
    if(sw1 == 0 && sw0 == 0){
        //..code here
    }
    //Sobel
    else if(sw1 == 0 && sw0 == 1){    
    //..code here
    }
    //Threshold
    else if(sw1 == 1 && sw0 == 0){
    //..code here
    }
    //..etc            
}

上述方法有效,并为“C Simulation”和“C Synthesis”提供了正确的输出。它在“RTL/C Cosimulation”中出错:“OpenCV 错误:输入参数的大小不匹配。”这对我来说毫无意义,因为所有 RGB_IMAGES 最初都是使用相同的行/列设置的。

【问题讨论】:

    标签: gpio vivado zynq vivado-hls


    【解决方案1】:

    好吧,数据的大小没有完成,在这个特定的情况下,只有 ROWs 和 COLs。 试着看看你的头文件,应该有这样的:

    // typedef video library core structures
    typedef hls::stream<ap_axiu<24,1,1,1> >               AXI_STREAM;
    typedef hls::Scalar<3, unsigned char>                 RGB_PIXEL;
    typedef hls::Mat<MAX_HEIGHT, MAX_WIDTH, HLS_8UC3>     RGB_IMAGE;
    

    这很清楚,因为您使用的是 AXI_STREAM。在这里,您要定义像素中有多少位,像素中有多少通道颜色等等。如果图片大小相同,那么“Sizes of input arguments do not match”就是指这个与top main函数不匹配的问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-03-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-02-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多