PostSWInterfaceFcn
Class: hdlcoder.ReferenceDesign
Namespace: hdlcoder
Function handle for custom callback function that gets executed after the generate software interface task runs
Syntax
PostSWInterfaceFcn
Description
PostSWInterfaceFcn
registers a function handle for the callback function
that gets executed at the end of the Generate Software Interface
task in the HDL Workflow Advisor. If hRD
is the reference design
object that you construct with the hdlcoder.ReferenceDesign
class, use
this syntax to register the function
handle.
hRD.PostSWInterfaceFcn = @my_reference_design.callback_PostSWInterface;
To define your callback function, create a file that defines
a MATLAB® function and add it to your MATLAB path. You can
use any name for the callback function. In this example, the function
name is callback_PostSWInterface
, and is located
in the reference design package folder +my_reference_design
.
With this callback function, you can change the generated software interface model for the custom reference design.
This example code shows how to create the callback function. The function adds a DocBlock in the software interface model.
function [status, log] = callback_PostSWInterface(infoStruct) % Reference design callback run at the end of the task % Generate Software Interface Model % % infoStruct: information in structure format % infoStruct.ReferenceDesignObject: current reference design registration object % infoStruct.BoardObject: current board registration object % infoStruct.ParameterStruct: custom parameters of the current reference design, in struct format % infoStruct.HDLModelDutPath: the block path to the HDL DUT subsystem % infoStruct.SWModelDutPath: the block path to the SW interface subsystem % % feature controlled by IPCoreSoftwareInterfaceLibrary % infoStruct.SWLibBlockPath: the block path to the SW interface library block % infoStruct.SWLibFolderPath: the folder path to the SW interface library % % status: process run status % status == true means process run successfully % status == false means process run failed % log: output log string status = true; log = ''; swDutPath = infoStruct.SWModelDutPath; add_block(['simulink/Model-Wide', char(10), 'Utilities/DocBlock'], sprintf('%s/DocBlock', swDutPath), 'Position', [50, 50, 80, 80]); end
In the HDL Workflow Advisor, when HDL Coder™ runs the Generate Software Interface task, it executes the callback function at the end of the task.
When you create the callback function, pass the infoStruct
argument
to the function. The argument contains the reference design and board
information in a structure
format. Use this information
to specify custom settings for software interface model generation.
Version History
Introduced in R2016b