Main Content

目标Zynq UltraScale + MPSOC平台入门

此示例显示如何使用硬件软件共同设计工作流程以Xilinx®Zynq®UltraScale+ MPSOC的各种频率闪烁LED。

Introduction

此示例是一个逐步指南,可帮助您使用HDL Coder™软件生成自定义HDL IP核心,闪烁Xilinx Zynq UltraScale + MPSoC ZCU102评估套件上的LED,并展示了如何使用嵌入式码头生成C在ARM®处理器上运行的代码以控制LED闪烁频率。

You can use MATLAB® and Simulink® to design, simulate, and verify your application, perform what-if scenarios with algorithms, and optimize parameters. You can then prepare your design for hardware and software implementation on the Xilinx Zynq UltraScale+ MPSoC by deciding which system elements will be performed by the programmable logic, and which system elements will run on the ARM Cortex-A53.

Using the guided workflow shown in this example, you automatically generate HDL code for the programmable logic using HDL Coder, generate C code for the ARM processor using Embedded Coder, and implement the design on the Xilinx Zynq UltraScale+ MPSoC Platform.

在此工作流程中,您执行以下步骤:

  1. 设置您的Xilinx Zynq UltraScale + MPSoC ZCU102硬件和工具。

  2. 为硬件和软件实现进行配置。

  3. 使用HDL Workflow Advisor生成HDL IP核心。

  4. Integrate the IP core into a Xilinx Vivado project and program the Xilinx Zynq UltraScale+ MPSoC hardware.

  5. 生成软件界面模型。

  6. Generate C code from the software interface model and run it on the ARM Cortex-A53 processor.

  7. 使用外部模式调谐参数和Zynq硬件的捕获结果。

Requirements

  1. Xilinx Vivado Design Suite, with supported version listed in theHDL语言Support and Supported Third-Party Tools and Hardware

  2. Xilinx Zynq UltraScale + MPSOC ZCU102评估套件

  3. HDL编码器Support Package for Xilinx Zynq Platform

  4. Xilinx Zynq平台的嵌金宝app入式编码器支持包

设置您的Xilinx Zynq UltraScale + MPSoC硬件和工具

1。设置Xilinx Zynq UltraScale + MPSOC ZCU102评估套件,如下图所示。要了解有关ZCU102硬件设置的更多信息,请参阅Xilinx文档

1.1。确保这一点SW6.switch is set as shown in the figure below, so you can boot up Linux from the SD card.

1。2使用Micro-USB电缆将计算机连接到ZCU102的USB UART连接器。确保您的USB设备驱动程序(例如Silicon Labs CP210x USB到UART Bridge)安装正确。如果没有,请在线搜索驱动程序并安装它们。

1。3使用以太网电缆将Xilinx Zynq UltraScale + MPSOC板连接到计算机。

2。Install the HDL Coder and Embedded Coder Support Packages for Xilinx Zynq Platform if you haven't already.

2。1在matlab上选项卡在Environmentsection, Click Add-Ons > Manage Add-Ons.

2。2在附加器管理器中,单击Xilinx Zynq平台的嵌入式编码器支持包的设置按钮,启动硬件安装程序。金宝app

3。确保您使用的是嵌入式编码器支持包提供的SD卡图像,用于Xilinx Zynq平台。金宝app

4。Set up the Zynq hardware connection by entering the following command in the MATLAB command window:

h = zynq

zynqfunction logs in to the hardware via COM port and runs theifconfig.command to obtain the IP address of the board. This function also tests the Ethernet connection.

5。您可以选择使用以下配置使用PuTty™等程序测试串行连接。波特率:115200;数据位:8.;停止bits:1;Parity:None;Flow control:None。当您在MPSOC板电源时,您应该能够观察串行控制台上的Linux启动日志。您必须在使用之前关闭此串行连接zynq再次函数。

6。使用Matlab命令窗口中的以下命令设置Xilinx Vivado Synthesis Path。运行命令时使用自己的Vivado安装路径。

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

为硬件和软件实现进行分区

这first step of the Zynq hardware-software co-design workflow is to decide which parts of your design to implement on the programmable logic, and which parts to run on the ARM processor.

将您想要在可编程逻辑上实现的所有块集团到原子子系统中。此原子子系统是硬件软件分区的边界。此子系统内的所有块将在可编程逻辑上实现,并且在此子系统之外的所有块将在ARM处理器上运行。

在这个例子中,子系统LED_COUNTER.是硬件子系统。它模拟了一个计数器,闪烁在FPGA板上的LED。两个输入端口,blink_fruency.andBlink_direction,是控制端口,用于确定LED闪烁频率和方向。子系统之外的所有块LED_COUNTER.用于软件实现。

In Simulink, you can use the滑块获得或者Manual Switchblock to adjust the input values of the hardware subsystem. In the embedded software, this means the ARM processor controls the generated IP core by writing to the AXI interface accessible registers. The output port of the hardware subsystem,引领那connects to the LED hardware. The output port,回过头再读那can be used to read data back to the processor.

open_system('hdlcoder_led_blinking');

使用HDL Workflow Advisor生成HDL IP核心

使用HDL Workflow Advisor中的IP核心生成工作流程使您可以从Simulink模型自动生成可共享和可重用的IP核心模块。金宝app生成的IP内核设计为连接到FPGA设备上的嵌入式处理器。HDL编码器从Simulink块生成HDL代码,并且还生成将IP核心连接到嵌金宝app入式处理器的AXI接口逻辑的HDL代码。HDL编码器将所有生成的文件打包到IP核心文件夹中。然后,您可以将生成的IP核心集成在Xilinx Vivado环境中具有更大的FPGA嵌入式设计。

1。启动IP核心生成工作流程。

1.1。打开HDL工作流程顾问hdlcoder_led_blinking/led_counter右键单击子系统LED_COUNTER.子系统,选择HDL代码>HDL Workflow Advisor

1.2。In theSet Target>设置目标设备和合成工具task, for目标工作流程, 选择IP核心生成

1.3。为了Target platform, 选择Xilinx Zynq UltraScale + MPSOC ZCU102评估套件。如果您没有此选项,请选择Get more打开支持包安装程序。金宝app在支持包安装程金宝app序中,选择Xilinx Zynq平台,然后按照支持包安装程序提供的说明完成安装。

1.4。点击运行此任务到run the设置目标设备和合成工具任务。

1。5In theSet Target>设置目标参考设计任务,选择Default system

1。6。点击运行此任务到run the设置目标参考设计任务。

2。Configure the target interface.

Map each port in your DUT to one of the IP core target interfaces. In this example, input portsblink_fruency.andBlink_direction映射到AXI4-Lite接口,因此HDL编码器为它们生成AXI接口可访问寄存器。这引领输出端口映射到外部接口,LED通用[0:7]那which connects to the LED hardware on the Zynq board.

2。1In theSet Target>设置目标界面任务,选择axi4-lite.为了blink_fruency.Blink_direction那and回过头再读

2。2选择LED通用[0:7]为了引领

2。3In theSet Target>设置目标频率任务,选择Target Frequency as 50 MHz

3。生成IP核心。

要生成IP核心,请右键单击生成RTL代码和IP核心任务和选择Run to Selected Task

4。生成并查看IP核心报告。

After you generate the custom IP core, the IP core files are in theIpcore.folder within your project folder. An HTML custom IP core report is generated together with the custom IP core. The report describes the behavior and contents of the generated custom IP core.

将IP核心与Xilinx Vivado环境集成

在工作流程的这一部分中,您将生成的IP核心插入嵌入式系统参考设计,生成FPGA比特流,并将比特流下载到Zynq硬件。

参考设计是预定义的Xilinx Vivado项目。它包含Xilinx软件需要将您设计部署到Zynq平台的所有元素,除了您生成的自定义IP核心和嵌入式软件。

1。To integrate with the Xilinx Vivado environment, select theCreate Project任务嵌入式系统集成,然后点击运行此任务。生成具有IP Integrator嵌入式设计的Xilinx Vivado项目,对话框窗口中提供了与项目的链接。您可以选择打开项目以查看。

2。如果您有嵌入式编码器许可证,则可以在下一任务中生成软件界面模型,生成软件界面模型。软件界面模型的详细信息在此示例的下一部分中解释,“生成软件界面模型”。

3。构建FPGA比特流构建FPGA比特流任务。确保这一点Run build process externallyoption is checked, so the Xilinx synthesis tool will run in a separate process from MATLAB. Wait for the synthesis tool process to finish running in the external command window.

4。生成比特流后,选择程序目标设备任务。选择下载为了编程方法要将FPGA比特流下载到Xilinx Zynq UltraScale + MPSOC板上的SD卡上,因此在电源循环Zynq板时,您的设计将自动重新加载。点击运行此任务编程Zynq硬件。

编程FPGA硬件后,LED在Xilinx Zynq UltraScale + MPSoC ZCU102板上开始闪烁。

Next, you will generate C code to run on the ARM processor to control the LED blink frequency and direction.

Generate a software interface model

在HDL Workflow顾问中,生成IP核心后,您可以在步骤4.1中创建Vivado项目,您可以选择在其中生成软件界面模型嵌入式系统集成>生成软件界面模型任务。

软件界面模型包含在软件中运行的设计的一部分。它包括HDL子系统之外的所有块,并使用AXI驱动程序块替换HDL子系统。如果您有嵌入式编码器许可证,则可以从软件界面模型中自动生成嵌入式C代码,构建它,并在ARM处理器上运行Linux上的可执行文件。生成的嵌入式软件包括从AXI驱动程序块生成的AXI驱动程序代码,该驱动程序代码控制HDL IP核心。

跑过生成软件界面模型任务并看到生成新模型。任务对话框显示了模型的链接。

在生成的软件界面模型中,LED_COUNTER.子系统被替换为AXI驱动程序块,该块在ARM处理器和FPGA之间产生接口逻辑。

在zynq zcu102硬件上运行软件界面模型

在工作流程的这一部分中,您可以配置生成的软件界面模型,自动生成嵌入式C代码,并在外部模式下在Zynq硬件中的ARM处理器上运行模型。

When you are prototyping and developing an algorithm, it is useful to monitor and tune the algorithm while it runs on hardware. The External mode feature in Simulink enables this capability. In this mode, your algorithm is first deployed to the ARM processor in the Zynq hardware, and then linked with the Simulink model on the host computer through an Ethernet connection.

Simulink模型的主要作用是调整和监视金宝app硬件上运行的算法。由于ARM处理器通过AXI接口连接到HDL IP内核,因此可以使用外部模式调谐参数,并从FPGA捕获数据。

  1. In the generated model,click on Hardware pane and go to硬件设置到openConfiguration Parameter对话框。

  2. 选择Solver和集合停止时间inf

  3. 选择硬件实现和集合Feature set for selected hardware board嵌入式编码器硬件支持包金宝app

  4. 来自硬件菜单,单击监控和曲调button on the model toolstrip to run your model on the ARM processor in the Zynq UltraScale+ MPSoC ZCU102 hardware in External mode. Embedded Coder builds the model, downloads the ARM executable to the Xilinx Zynq UltraScale+ MPSoC ZCU102 hardware, executes it, and connects the model to the executable running on the Zynq hardware.

  5. 双击滑块获得堵塞。更改滑块增益值并观察Zynq硬件上闪烁闪烁的LED数组频率的变化。双击Manual Switch块切换闪烁的LED的方向。

  6. 双击scope connected to the回过头再读输出端口并注意FPGA IP内核的输出数据被捕获并返回到Simulink范围。金宝app

  7. When you are done changing model parameters, click the停止在模型上的按钮。

概括

此示例显示了硬件 - 软件共同设计工作流程如何帮助Matlab和Simulink设计的部署到Xilinx Zynq UltraScale + MPSoC。金宝app您可以通过工作流程迭代来探索分区和部署设计的最佳方法。

下图显示了您在此示例中通过的工作流的高级图片。要了解有关硬件和软件共同设计工作流程的更多信息,请参阅SoC平台的硬件软件共同设计工作流程