Generate Cross-Platform DPI Components
Use DPI component generation to export a Simulink® subsystem to a C language component with a digital programming interface (DPI) for use in a Verilog® or SystemVerilog simulation. You can customize DPI generation for ModelSim®, Xcelium™ (Linux® only), VCS® (Linux only), Vivado®, or you can generate a generic DLL.
When you generate the component from a Windows® 64 host machine, you can also build the component libraries and run the simulation on a different operating system. If your target and host are not the same, you must port and build the shared libraries or HDL simulator projects manually. You cannot port a DPI component generated on a Linux machine to any other operating system.
This workflow requires the ASIC Testbench for HDL Verifier add-on.
Select Target Toolchain
When your target machine uses the same operating system as your host, you can select an installed compiler or request that the tools find a compiler automatically. If you want to generate a simulator project, or if you have no other compilers installed, select an HDL simulator for the same operating system as the host. However, if your target operating system is different from the host, you must select a target simulator and operating system.
Open your model, and on the Apps tab, click HDL Verifier. Select DPI Component Generation on the left pane, and on the HDL Verifier tab, click C Code Settings. The Configuration Parameters dialog opens on the Code Generation pane. Then, under Build process, select a target Toolchain. This option specifies the target simulator and operating system where you run simulations. The supported cross-product toolchains are:
Mentor Graphics ModelSim/QuestaSim (64-bit Windows)(available from Windows host only)
Mentor Graphics ModelSim/QuestaSim (32-bit Windows)(available from Windows host only)
Xilinx Vivado Simulator (64-bit Windows)(available from Windows host only)
Cadence Xcelium (64-bit Linux)
Mentor Graphics ModelSim/QuestaSim (64-bit Linux)
Synopsys VCS (64-bit Linux)
Xilinx Vivado Simulator (64-bit Linux)
To build a shared library for a different operating system, you must select one of the simulator options. You can then build the library on your target machine.
On the configuration parameters, under Target Selection, for
System target file click Browse.
systemverilog_dpi_ert.tlc from the list.
To generate your component and an optional test bench, follow Generate SystemVerilog DPI Component from step 3 and on.
Package Files for Transfer
After generating the component, use the
packNGo (MATLAB Coder) function to package the
generated files and any required dependencies before copying them to the target
load('subsystem_build/buildInfo.mat') packNGo(buildInfo, 'minimalHeaders', false)
is the name of the Simulink subsystem used for DPI generation. The result is a zip file named
Copy to Target Machine
To use your generated component on a different operating system, you must copy the generated package file to the target machine, unzip it, and build the libraries there.
Copy the generated
.zipfile from the host machine to the target machine. The
.zipfile is located in the same folder as your model. The ModelSim
.dofile or the Xcelium, VCS, or Vivado
.shfile is included in the
Unzip the file into a folder of your choice.
When you generate the component on the host machine, the libraries are built for that operating system. To port the component to a different operating system, you must build the components manually on the target machine. To build your simulator project or generic shared library, find your target operating system and HDL simulator in the table and follow the instructions.
|Target Operating System||HDL Simulator||Build Instructions|
Cross-platform DPI generation does not support model referencing when the reference subsystem has a Test Assessment (Simulink Test) block.
DPI component generation does not support
doubledata types for the Vivado simulator.
packNGo (MATLAB Coder)