Main Content

Register a Custom Reference Design

To register a custom reference design:

  1. Define a reference design.

  2. Create a reference design plugin.

  3. Define a reference design registration function, or add the new reference design plugin to an existing reference design registration function.

Define a Reference Design

A reference design definition must be a MATLAB® function that returns an hdlcoder.ReferenceDesign object. Create the reference design definition function in the reference design plugin folder. You can use any name for the reference design definition function.

To create a reference design definition:

  1. Create a new file that defines a MATLAB function with any name.

  2. In the MATLAB function, create an hdlcoder.ReferenceDesign object and specify its properties and interfaces according to the characteristics of your embedded system design.

  3. If you want to check that the definition is complete, run the validateReferenceDesign method.

This MATLAB function defines a custom reference design:

function hRD = plugin_rd()
% Reference design definition

% Construct reference design object
hRD = hdlcoder.ReferenceDesign('SynthesisTool', 'Xilinx Vivado');

hRD.ReferenceDesignName = 'Demo system (Vivado 2014.2)';
hRD.BoardName = 'Digilent Zynq ZyBo';

% Tool information
% It is recommended to use a tool version that is compatible with the supported tool
% version. If you choose a different tool version, it is possible that HDL Coder is
% unable to create the reference design project for IP core integration.
hRD.SupportedToolVersion = {'2015.4'};

%% Add custom design files
% add custom Vivado design
hRD.addCustomVivadoDesign( ...
    'CustomBlockDesignTcl', 'design_led.tcl');

hRD.CustomFiles = {'ZYBO_zynq_def.xml'};
%% Add interfaces
% add clock interface
hRD.addClockInterface( ...
    'ClockConnection',   'clk_wiz_0/clk_out1', ...
    'ResetConnection',   'proc_sys_reset_0/peripheral_aresetn');

% add AXI4 and AXI4-Lite slave interfaces
hRD.addAXI4SlaveInterface( ...
    'InterfaceConnection', 'axi_interconnect_0/M00_AXI', ...
    'BaseAddress',         '0x40010000', ...
    'MasterAddressSpace',  'processing_system7_0/Data');

By default, HDL Coder™ generates an IP core with the default settings and integrates it into the reference design project. To customize these default settings, use the properties in the hdlcoder.ReferenceDesign object to define custom parameters and to register the function handle of the custom callback functions. For more information, see Define Custom Parameters and Callback Functions for Custom Reference Design.

Create a Reference Design Plugin

A reference design plugin is a package folder that you define on the MATLAB path. The folder contains the board definition file and any custom callback functions.

To create a reference design plugin:

  1. In the board plugin folder for the associated board, create a new folder that has a name with a + prefix.

    For example, the reference design plugin can be a folder named +vivado_base_ref_design.

  2. In the new folder, save your reference design definition file and any custom callback functions that you create.

  3. In the new folder, save any files that are required by the embedded system design project, and are specific to your third-party synthesis tool, including Tcl, project, and design files.

  4. Add the folder to your MATLAB path.

Define a Reference Design Registration Function

A reference design registration function contains a list of reference design functions and the associated board name. You must name the function hdlcoder_ref_design_customization.m. When the HDL Workflow Advisor opens, it searches the MATLAB path for files named hdlcoder_ref_design_customization.m, and uses the information to populate the reference design options for each board.

To define a reference design registration function:

  1. Create a file named hdlcoder_ref_design_customization.m and save it anywhere on the MATLAB path.

  2. In hdlcoder_board_customization.m, define a function that returns the associated board name, specified as a character vector, and a list of reference design plugins, specified as a cell array of character vectors.

    For example, the following code defines a reference design registration function.

    function [rd, boardName] = hdlcoder_ref_design_customization
    % Reference design plugin registration file
    
    rd = {'ZyBoRegistration.Vivado2015_4.plugin_rd', ...
         };
    
    boardName = 'Digilent Zynq ZyBo';
    
    end

The reference design registration function returns the associated board name, specified as a character vector, and a list of reference design plugins, specified as a cell array of character vectors.

See Also

|

Related Examples

More About