Main Content


Class: hdlcoder.ReferenceDesign
Namespace: hdlcoder

Function handle for callback function that gets executed after the create project task runs




PostCreateProjectFcn registers a function handle for the callback function that gets called at the end of the Create Project task in the HDL Workflow Advisor. If hRD is the reference design object that you construct with the hdlcoder.ReferenceDesign class, then use this syntax to register the function handle.

hRD.PostCreateProjectFcn = @my_reference_design.callback_PostCreateProject;

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_PostCreateProject, and is located in the reference design package folder +my_reference_design.

With this callback function, you can specify custom settings for reference design project creation. This example code shows how to create the callback function. The function exports the contents of the board and reference design object to a PostCreateProjectInfo.txt file, and validates that the project creation task ran successfully.

function [status, log] = callback_PostCreateProject(infoStruct)
% Reference design callback run at the end of the task Create Project
% 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.ToolProjectFolder: the path to synthesis tool project folder
% infoStruct.ToolProjectName: the synthesis tool project name
% status: process run status
%         status == true means process run successfully
%         status == false means process run failed
% log:    output log string

status = false;
log = sprintf('Run post create project callback\n%s', evalc('infoStruct'));

% Exporting the InfoStruct Contents
% ...
% ...


In the HDL Workflow Advisor, when HDL Coder™ runs the Create Project 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 the reference design project creation.

Version History

Introduced in R2016b