Define and Add IP Repository to Custom Reference Design - MATLAB & Simulink (original) (raw)

Main Content

When you create your custom reference design, you might require custom IP modules that do not come with Altera® Qsys or Xilinx® Vivado®. To use custom IP modules, create your own IP repository folder that contains IP module subfolders. The IP Core Generation workflow then uses these custom IP modules when creating the reference design project. You can create multiple IP repositories and add all or some of the IP modules in each repository to your custom reference design project. You can also reuse and share IP repositories across multiple reference designs.

Create an IP Repository Folder Structure

Create an IP repository folder anywhere on the MATLAB® path. This figure shows a typical IP repository folder structure.

IP repository on the MATLAB path

When you create the folder structure, use the naming convention+(company)/+(product)/+(tool). In this example, the folder structure is +(mathworks)/+(hdlcoder)/+(vivado). The folder+vivado acts as the IP repository. This folder contains subfolders corresponding to IP modules such as AXI4StoHDMI andHDMItoAXIS. The folder also contains ahdlcoder_video_iplist MATLAB function. Using this function, specify the IP modules to add to the reference design.

The same repository folder can have multiple MATLAB functions. This figure shows two MATLAB functions, hdlcoder_video1_iplist andhdlcoder_video2_list, in the +vivado folder. The functions can share the same IP modules or point to different IP modules in the repository.

IP repository with multiple IP functions

Note

If your synthesis tool is Xilinx Vivado, the IP modules in the repository folder can be in zip file format.

Define IP List Function

Create a MATLAB function that specifies the IP modules to add to the reference design. Save this function in the IP repository folder. For the function name, use the naming convention hdlcoder_<specific_use>_iplist. This example uses hdlcoder_video_iplist as the function name because it targets video applications. Using this function, specify whether you want to add all or some of the IP modules in the repository to the reference design project. To add all IP modules, use an empty cell array foripList. This MATLAB code shows how to add all IP modules in the repository to the reference design.

function [ipList] = hdlcoder_video_iplist( ) % All IP modules in the repository folder.

ipList = {};

You can specify the root directory as an optional second output argument to the IP list function. In this case, the IP modules do not have to be located in a path relative to the IP list function. The IP repository can also be located outside the MATLAB path.

If you do not specify the root directory, the function searches for IP modules relative to its location.

function [ipList, rootDir] = hdlcoder_video_iplist( ) % All IP modules with a root directory.

ipList = {};

To add some of the IP modules that are in the folder, specify the IP modules as a cell array of character vectors. This MATLAB code specifies the AXI4StoHDMI IP and theHDMItoAXIS IP as the IP modules to add to your custom reference design.

function [ipList] = hdlcoder_video_iplist( ) % AXI4StoHDMI and HDMItoAXIS IP in the repository folder.

ipList = {'AXI4StoHDMI','HDMItoAXIS'};

Add IP List Function to Reference Design Project

Using the addIPRepository method of thehdlcoder.ReferenceDesign class, add the IP list function to your custom reference design. This example reference design addshdlcoder_video_iplist to the custom reference designMy Reference Design.

function hRD = plugin_rd() % Reference design definition

% Construct reference design object hRD = hdlcoder.ReferenceDesign('SynthesisTool', 'Xilinx Vivado'); hRD.ReferenceDesignName = 'My Reference Design'; hRD.BoardName = 'ZedBoard'

% Tool information hRD.SupportedToolVersion = {'2020.2'};

%% Add custom design files hRD.addCustomVivadoDesign( ... 'CustomBlockDesignTcl', 'system_top.tcl', ... 'VivadoBoardPart', 'em.avnet.com:zed:part0:1.0');

% Add IP Repository hRD.addIPRepository(... 'IPListFunction', 'mathworks.hdlcoder.vivado.hdlcoder_video_iplist', 'NotExistMessage', 'IP repository not found');

% ... % ...

To use the IP modules when the code generator creates the project, open the HDL Workflow Advisor, and run the IP Core Generation workflow to theCreate Project task. After running this task, you can see the IP module subfolders in the repository copied over to theipcore folder of the project. TheCustomBlockDesignTcl can then use these IP modules.

See Also

hdlcoder.Board | hdlcoder.ReferenceDesign

Topics