主要内容

Save Target Hardware Settings in Model

此示例显示了如何将目标硬件设置保存在Simulink®模型中。金宝app

This example also shows different ways that you can export, modify, and import target hardware settings. This example uses the Xilinx Zynq platform, but in the same way, you can save target hardware settings in models that target the Intel SoC devices, FPGA Turnkey, and Simulink Real-Time FPGA I/O boards.

打开模型

open_system('hdlcoder_led_blinking');

配置目标硬件设置

配置目标硬件设置时,您会修改模型。如果保存模型,则将目标硬件设置作为模型的一部分保存。

您可以通过三种方式配置目标硬件设置:

  • HDL工作流顾问

  • HDL Block Properties dialog box for Inport or Outport

  • hdlset_param

Since the HDL Workflow Advisor provides a dropdown menu for each target hardware option, it is best to use the HDL Workflow Advisor when you configure the target hardware settings for the first time. After you save the model with a valid configuration, you can view, modify, and apply settings from the command line.

Use HDL Workflow Advisor to configure model or port hardware settings

Open the HDL Workflow Advisor from the subsystemhdlcoder_led_blinking/led_counter并在任务1.1和1.2中指定目标硬件设置。

在里面设定目标>设置目标设备和合成工具任务:

  • 为了Target workflow中,选择IP Core Generation

  • 为了目标平台中,选择Xilinx Zynq ZC702 evaluation kit

在里面设定目标>设定目标Interface任务,将端口映射到接口如下:

  • 为了Blink_frequencyblink_directioninput ports, select the AXI4-Lite interface.

  • 为了the引领output port, selectExternal Port

  • 为了theRead_back输出端口,选择Axi4-Lite接口。

Specify HDL IP core name and version in task 3.2Generate RTL Code and IP Core

为了details, see开始定位Xilinx Zynq平台

Use HDL Block Properties dialog box to map DUT ports to target interface

You can specify target interface settings for the DUT interface by using the HDL Block Properties dialog box for any Inport or Outport. You can also specify the HDL IP core settings by using the HDL Block Properties dialog box for the DUT subsystem. However, you can use the HDL Block Properties dialog box to configure only the DUT target interface and HDL IP core settings. Set other target hardware settings from the HDL Workflow Advisor, or by usinghdlset_paramat the command line.

例如,您可以更改Blink_frequencyInport to x"120" and remap the引领Outport to LEDs General Purpose [0:7]:

  1. From the subsystemhdlcoder_led_blinking/led_counter, right-click theBlink_frequency企业,然后选择HDL Code>HDL Block Properties。Click the目标规范标签。为了IOInterfaceMapping, enterx“ 120”

  2. Similarly, for the引领Outport, foriointerface, enter引领s General Purpose [0:7]

Right-click the subsystemhdlcoder_led_blinking/led_counter, and selectHDL Code>HDL Block Properties。Note you can changeIPCoreNameipcoreversionunder目标规范标签。

打开HDL Workflow Advisor时,使用“ HDL块”属性对话框指定的目标接口和HDL IP核心设置将进行验证。

Use hdlset_param to configure model or DUT port hardware settings

To configure target hardware settings for your model or DUT ports, you can usehdlset_param

例如,更改TargetPlatform到Xilinx Zynq ZC706评估套件,输入:

hdlset_param('hdlcoder_led_blinking',“目标平台”,'Xilinx Zynq ZC706 evaluation kit');

To set the Bit Range ofBlink_frequencyInport tox“ 120”;并设置引领Outport to引领s General Purpose [0:7], enter:

hdlset_param('hdlcoder_led_blinking/led_counter/Blink_frequency','IOInterfaceMapping','x"120"'); hdlset_param('hdlcoder_led_blinking/led_counter/LED','IOInterface','LEDs General Purpose [0:7]');

To set the IP core name and version, enter:

hdlset_param('hdlcoder_led_blinking/led_counter','IPCoreName','my_ipcore'); hdlset_param('hdlcoder_led_blinking/led_counter','IPCoreVersion','2.0');

导出和导入目标硬件设置

To export all non-default HDL code generation options in your model, including the target hardware settings, you can usehdlsaveparamshdlrestoreparams。您可以在保存的MATLAB文件中修改模型设置,并将设置应用于同一模型或其他模型。

例如,要将设置从HDLCODER_LED_BLINKING模型导出到MATLAB文件,targetSetting.m, enter:

hdlsaveparams('hdlcoder_led_blinking/led_counter','targetSetting.m')

You can modify the settings intargetSetting.mas desired, then enter the following command to apply the settings to the model:

hdlrestoreparams('hdlcoder_led_blinking/led_counter','targetSetting.m')

Save and Reopen the Model

  1. Save the modelhdlcoder_led_blinkingashdlcoder_led_blinking_saved

  2. 打开保存的模型,hdlcoder_led_blinking_saved

  3. Open the HDL Workflow Advisor from the subsystemhdlcoder_led_blinking_saved/led_counter

Notice that the modified settings are automatically loaded to tasks 1.1 and 1.2 in the HDL Workflow Advisor.