主要内容

Deploy Model with AXI4-Stream Video Interface in Zynq Workflow

This example shows how to use the AXI4-Stream Video interface to enable high speed video streaming on the generated HDL IP core.

在你开始之前

要运行此示例,您必须安装以下软件和硬件:

  • HDL编码器™ Support Package for Xilinx® Zynq® Platform

  • 嵌入式编码器® Support Package for Xilinx Zynq Platform

  • 计算机视觉系统工具箱支持包,用于Xilinx Zynq的硬件金宝app

  • Vision HDL Toolbox

  • Xilinx Vivado® Design Suite, with supported version listed inHDL语言支持和支持的第三金宝app方工具和硬件

  • Zedboard

  • FMC HDMI I/O卡(FMC-HDMI-CAM或FMC-IMAGEON)

要设置Zedboard,请参阅Set up Zynq hardware and tools示例中的部分开始定位Xilinx Zynq平台

介绍

This example shows how to:

  1. 模式l a video streaming algorithm using the streaming pixel protocol.

  2. 使用AXI4-Stream视频接口生成HDL IP核心。

  3. Integrate the generated IP core into a ZedBoard video reference design with access to HDMI interfaces.

  4. Use the ARM® processor to tune the parameters on the FPGA fabric to change the live video output.

  5. 创建自己的自定义视频参考设计。

上图是一个高级体系结构图,该图显示了生成的HDL DUT IP核心如何在预定义的视频参考设计中起作用。在此图中,HDL DUT IP块是从IP核心生成工作流中生成的IP核心。该图的其余图表示预定义的视频参考设计,该视频参考设计包含其他IPS来处理HDMI输入和输出接口。

HDL DUT IP处理来自HDMI输入IP的视频流,生成输出视频流,并将其发送到HDMI输出IP。所有这些视频流都以AXI4-Stream视频接口传输。

HDL DUT IPcan also include an AXI4-Lite interface for parameter tuning. Compared to the AXI4-Lite interface, the AXI4-Stream Video interface transfers data much faster, making it more suitable for the data path of the video algorithm.

Set up Zynq hardware and tools

1.Set up the ZedBoard and the FMC HDMI I/O card as shown in the figure below. To learn more about the ZedBoard hardware setup, please refer to the board documentation.

1.1。如上图所示,连接USB UART电缆,以太网电缆和电源电缆(标记1至3)。

1.2。确保JP7toJP11jumpers are set as shown in the figure above (marker 4), so you can boot Linux from the SD card.JP7:下来;JP8:下来;JP9: 向上;JP10: 向上;JP11: down.

1.3。确保J18jumper are set on 2V5 as shown in the figure above (marker 5).

1.4。如上图所示,将HDMI视频源连接到FMC HDMI I/O卡(标记6)。视频源必须能够提供1080p视频输出,例如,它可以是摄像机,智能手机,平板电脑或计算机的HDMI输出。

1.5。如上图所示,将监视器连接到FMC HDMI I/O卡(标记7)。监视器必须能够支持1080p显示。金宝app

2.如果还没有,请为Xilinx Zynq平台安装HDL编码器和嵌入式编码器支持软件包,以及用于基于Xilinx Zynq的硬件的计算金宝app机视觉系统工具箱支持软件包。要安装支持包,请转到MATLA金宝appB®工具条,然后单击附加组件>获取硬件支持软件包金宝app

3.确保您使用的是Xilinx Zynq平台的嵌入式编码器支持软件包提供的SD卡图像。金宝app如果您需要更新SD卡映像,请在MATLAB提示下运行以下命令:

targetupdater

4.通过在MATLAB命令窗口中输入以下命令来设置ZYNQ硬件连接:

h = zynq

Zynq功能通过COM端口登录到硬件并运行ifconfig命令获得董事会的IP地址。此功能还测试以太网连接。

5.Set up the Xilinx Vivado synthesis tool path using the following command in the MATLAB command window. Use your own Vivado installation path when you run the command.

hdlsetuptoolpath('ToolName', 'Xilinx Vivado', 'ToolPath', 'C:\Xilinx\Vivado\2017.4\bin\vivado.bat')

使用流像素协议模型视频流算法

要在Zynq上部署简单的Sobel边缘检测算法,第一步是确定设计的哪个部分在FPGA上运行,以及在ARM处理器上运行的设计部分。在此示例中,我们希望在FPGA上实现边缘检测器,以在AXI4-Stream视频协议中处理传入的视频流。我们想使用ARM处理器调整FPGA上的参数以更改实时视频输出。

在示例模型中,DUT子系统,Sobel_HW, uses a edge detector block to implement the Sobel edge detection algorithm. The video data and control signals are modeled in the video streaming pixel protocol, which is used by all the blocks in Vision HDL Toolbox.像素像素are data ports for video streams.Ctrlinctrloutare control ports for video streams. They are modeled using a bus data type (像素控制总线)包含以下信号:Hstart,亨德,vstart,vEnd,有效的

四个输入端口,临界点,sobel_enable,Background_ColorShow_Gradient,是调整参数SOBEL边缘检测算法的控制端口。您可以使用滑块增益或者手动开关块以调整这些端口的输入值。将这些端口映射到AXI4-LITE接口后,ARM处理器可以通过写入生成的AXI接口可访问寄存器来控制生成的IP核心。

modelname ='hdlcoder_sobel_video_stream';Open_System(modelName);SIM(modelName);

使用AXI4-Stream视频接口生成HDL IP核心

接下来,我们启动HDL Workflow顾问,并使用Zynq硬件软件共同设计工作流程将此设计部署在Zynq硬件上。有关更详细的分步指南,您可以参考开始定位Xilinx Zynq平台例子。

1.Start the HDL Workflow Advisor from the DUT subsystem,hdlcoder_sobel_video_stream/sobel_hw。目标接口设置已经保存在此示例模型中,因此任务1.1至1.3中的设置会自动加载。要了解有关在模型中保存目标接口设置的更多信息,您可以参考Save Target Hardware Settings in Model例子。

In Task 1.1,IP Core Generation选择目标工作流程, 和Zedboard选择目标平台

In Task 1.2,默认视频系统(需要HDMI FMC模块)选择Reference Design

在任务1.3中,目标平台接口表is loaded as shown in the following picture. The video data stream ports,像素,Ctrlin,像素, 和ctrlout是地图ped to the AXI4-Stream Video interfaces, and the control parameter ports, such as临界点,映射到Axi4-Lite界面。

Axi4-stream视频接口以主/从模式进行通信,主设备将数据发送到从设备。因此,如果数据端口是输入端口,请将其分配给Axi4-stream视频奴隶接口,如果数据端口是输出端口,请将其分配给Axi4-stream视频大师interface.

2.Right-click Task 3.2,Generate RTL Code and IP Core, 和select运行到选定的任务to generate the IP core. You can find the register address mapping and other documentation for the IP core in the generated IP Core Report.

将IP集成到AXI4-Stream视频兼容参考设计中

接下来,在HDL工作流顾问中,我们运行Embedded System Integrationtasks to deploy the generated HDL IP core on Zynq hardware.

1.Run Task 4.1,创建项目。此任务将生成的IP核心插入默认视频系统参考设计。如第一图所示,此参考设计包含IPS来处理HDMI输入和输出接口。它还包含IPS从YCBCR到RGB进行颜色空间转换。生成的项目是一个完整的Zynq设计,包括算法部分(生成的DUT算法IP)和平台部分(参考设计)。

2.单击结果窗格中的链接以打开生成的Vivado项目。在Vivado工具中,单击开放式设计要查看ZYNQ设计图,其中包括生成的HDL IP核心,其他视频管道IPS和ZYNQ处理器。

3.In the HDL Workflow Advisor, run the rest of the tasks to generate the software interface model, and build and download the FPGA bitstream. ChooseDownloadprogramming method in the task程序目标设备要将FPGA Bitstream下载到Zedboard上的SD卡上,因此当您为Zedboard供电时,您的设计将自动重新加载。

生成可在FPGA织物上调谐参数的手臂

A software interface model is generated in Task 4.2,Generate Software Interface Model

1.Before you generate code from the software interface model, comment out the视频来源视频查看器在生成的模型中,如下图所示。这些块无需在手臂处理器上运行。ARM处理器正在使用Axi4-Lite界面来控制FPGA织物。实际的视频源和显示界面都在FPGA面料上运行。视频源来自HDMI输入,视频输出将发送到连接到HDMI输出的监视器。

2.为外部模式配置并构建软件接口模型:

  1. In the generated model, open theConfiguration Parametersdialog box.

  2. Select求解器和set "Stop Time" to "inf".

  3. 从模型菜单中选择模拟>模式>External

  4. 点击Run模型工具条上的按钮。嵌入式编码器构建模型,将ARM下载到Zedboard硬件上,执行并将模型连接到Zedboard硬件上的可执行操作。

3.Now, both the hardware and software parts of the design are running on Zynq hardware. Use thesobel_enableswitch to observe that the live video output switches between the edge detector output and the original video. Use the临界点或者Background_Colorswitch to see the different edge detection effects on the live video output. These parameter values are sent to the Zynq hardware via external mode and the AXI4-Lite interface.

Customize your video reference design

您可能需要扩展现有的默认视频系统参考设计以添加其他预处理或后处理相机管道IPS,或者您可能想使用其他SOC硬件或摄像机界面。这默认视频系统reference design is an example or a starting point to create your own custom reference design.

例如,默认视频系统参考设计包含两个IP核心,可以进行从YCBCR到RGB的颜色空间转换,如下图所示。这两个IP内核也由HDL编码器以及IP Core Generation Workflow生成。您可以选择生成其他预处理或后处理的摄像头管道IP内核,并将它们添加到自定义参考设计中以扩展您的视频平台。

For more details on creating your own custom reference design, you can refer to theDefine Custom Board and Reference Design for Zynq Workflow例子。