Open your model and select Simulation > Model Configuration Parameters.
Select Code Generation from the left pane.
For System target file, click
Browse and select
If you have a license for Embedded
Coder®, you can select target
systemverilog_dpi_ert.tlc. This target
enables you to access its additional code generation options (on the Code
Generation pane in Model Configuration Parameters).
For Toolchain, in the Build process section, select the toolchain you want to use from the list. See Generate Cross-Platform DPI Components for guidance on selecting a toolchain.
You can optionally select flags for compilation. For Build
Click Show Settings to display the current
In the left pane, expand Code Generation and select SystemVerilog DPI.
Select Customize generated SystemVerilog code.
Specify the SystemVerilog template you want to use by setting Source file template.
Select Edit to see the contents of the specified
Source file template. This example shows the
content of the template file provided with HDL
For more about the customized template, see Customization.
Click OK to accept these options and close the Configuration Parameters dialog box. Next, go to Generate Customized SystemVerilog DPI Component.
In your model, generate C code for subsystem.
You can generate C code from the MATLAB® command line by using the command
If you built the component for the host machine, you can now use the component. If you intend to port the component to another machine with a different operating system, see Generate Cross-Platform DPI Components.