Main Content

CallbackCustomProgrammingMethod

Class: hdlcoder.ReferenceDesign
Namespace: hdlcoder

Function handle for custom callback function that gets executed during Program Target Device task in the Workflow Advisor

Syntax

CallbackCustomProgrammingMethod

Description

CallbackCustomProgrammingMethod registers a function handle for the callback function that gets executed when running the Program Target Device 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.CallbackCustomProgrammingMethod = @my_reference_design.callback_CustomProgrammingMethod;

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

With this callback function, you can specify a custom programming method to program the target device. This example code shows how to create the callback function.

function [status, log] = callback_CustomProgrammingMethod(infoStruct)
% Reference design callback function for custom programming method
% 
% 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.BitstreamPath: the path to the generated FPGA bitstream file
% infoStruct.ToolProjectFolder: the path to synthesis tool project folder
% infoStruct.ToolProjectName: the synthesis tool project name
% infoStruct.ToolCommandString: the command for running a tcl file
% 
% status: process run status
%         status == true means process run successfully
%         status == false means process run failed
% log:    output log string
status = true;
log = sprintf('Run custom programming method callback...\n');


% Enter your commands for custom programming here
% ... 
% ... 

end

In the HDL Workflow Advisor, HDL Coder™ selects the custom programming method to program the target SoC device. If you do not specify the custom programming method, HDL Coder provides JTAG and Download as the options to program the target device.

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 build process and bitstream generation.

Version History

Introduced in R2016a