Configure the Simulink Environment for Hardware Design
About金宝appModel Templates
金宝app®模型模板为新型号提供常见的配置设置和最佳实践。而不是使用新模型的默认画布,选择模板模型以帮助您入门。
For more information on Simulink model templates, seeBuild and Edit a Model Interactively。
Create Model UsingWireless HDL ToolboxModel Template
Click the Simulink button,, or type
金宝app
at the MATLAB®command prompt.On the Simulink start page, find the Wireless HDL Toolbox™ section, and click theStreaming Data from MATLABorFramed Data from MATLABtemplate.
A new model, with the template contents and settings, opens in the Simulink Editor. SelectSaveto save the model.
Alternatively, you can create a new model from the template on the command line. For example:
new_systemmy_whdl_FmodelFromTemplatewhdl_framed_data.sltxopen_systemmy_whdl_Fmodel
new_systemmy_whdl_SmodelFromTemplatewhdl_streaming_data.sltxopen_systemmy_whdl_Smodel
Wireless HDL ToolboxModel Templates
Both Wireless HDL Toolbox model templates include an empty subsystem,HDL Algorithm。This subsystem accepts and returns streaming data and accompanying control signals using thesamplecontrolbus
。You can design an HDL-targeted algorithm within this subsystem.
这templates also configure the model for HDL code generation. Both templates:
Configure solver settings equivalent to calling
hdlsetup
(HDL Coder)Display data rates and data types in the Model Editor
Create an instance of
samplecontrolbus
in the workspace (inInitFcn
)
这simulation time, input data, and block parameters are defined in the callback function,InitFcn
。在查看或编辑这个函数Modelingtab, expandModel Settingsand clickModel Properties, and then on theCallbackstab, clickInitFcn*
。
Framed Data Template
这Framed Data from MATLABtemplate imports framed data from the MATLAB workspace, assuming all frames are the same size. Then, it converts the data to a sample stream by using theFrame To Samplesblock.
这output of theHDL Algorithmsubsystem is connected to aSamples To Frameblock. This block converts the output back to framed data for export to the MATLAB workspace.
这InitFcn
定义占位符输入框架和设置Frame Input From Workspace,Frame To Samples, andSamples To Frameblocks.
这StopFcn
applies the valid signal to the output data and creates a single variable in the workspace.
这model has one data rate for the framed data and a faster data rate for the sample stream. You can display these rates as different colors in the Simulink model.
Streaming Data Template
Use theStreaming Data from MATLABtemplate when your data stream has different-sized frames. TheInitFcn
defines placeholder input frames and uses thewhdlFramesToSamples
将帧数据转换为数据和控制信号的vecors。这From Workspaceblock imports these variables to the model.
To connect to theHDL Algorithmsubsystem and any Wireless HDL Toolbox blocks that you add inside it, the model converts the control signals to thesamplecontrolbus
type, using theSample Control Bus Creatorblock.
这model exports the streaming data and control signals back to the MATLAB workspace. TheStopFcn
使用whdlSamplesToFrames
function to convert them back to framed data.
该模型具有单个数据速率,因为模型中的所有信号都表示流样本。