Main Content

User-Defined MATLAB Functions

Create HDL-ready algorithms using blocks in User-Defined Functions library

The HDL Coder block library contains many blocks that you can add to your develop your Simulink® modeling environment and develop your HDL algorithm. You can also integrate your HDL algorithm that contains MATLAB® code in the Simulink environment by using the MATLAB Function and MATLAB System blocks in the User-Defined Functions library.

To filter the Simulink Library Browser to show only HDL-supported blocks, enter hdllib.

Functions

expand all

hdl.RAMSingle, simple dual, dual, true dual, or simple tri-port RAM for memory read/write access
hdl.BlackBoxBlack box for including custom HDL code
hdllibDisplay blocks that are compatible with HDL code generation
hdl.treesumSum of array elements using tree architecture (Since R2022a)
hdl.treeprodProduct of array elements using tree architecture (Since R2022a)

Topics

Modeling MATLAB Functions

Generate HDL Code from MATLAB Functions

Troubleshooting

Initialize Persistent Variables in MATLAB Functions

Specialized semantics impact the way that a function initializes persistent data.

Featured Examples