Main Content

MATLAB Cosimulation

Cosimulate HDL code with MATLAB®


Cosimulation WizardGenerate a cosimulation block or System object from existing HDL files


expand all

nclaunchStart and configure Cadence Incisive simulators for use with HDL Verifier software
vsimStart and configure ModelSim for use with HDL Verifier
hdlsimmatlabLoad instantiated HDL module for verification with Cadence Incisive and MATLAB
hdlsimmatlabsysobjLoad instantiated HDL module for cosimulation with Cadence Incisive and MATLAB System object
matlabcpAssociate MATLAB component function with instantiated HDL design
matlabtbSchedule MATLAB test bench session for instantiated HDL module
nomatlabtbEnd active MATLAB test bench and MATLAB component sessions
matlabtbevalCall MATLAB function once and immediately on behalf of instantiated HDL module
vsimmatlabLoad instantiated HDL module for verification with ModelSim and MATLAB
vsimmatlabsysobjLoad instantiated HDL module for cosimulation with ModelSim and MATLAB System object
hdldaemonControl MATLAB server that supports interactions with HDL simulator
notifyMatlabServerSend HDL simulator event ID and process ID to MATLAB server
pingHdlSimBlock cosimulation until HDL simulator is ready
waitForHdlClientWait until specified event ID is obtained or time-out occurs
dec2mvlConvert decimal to binary character vector
mvl2decConvert multivalued logic to decimal


hdlverifier.HDLCosimulationCreate a System object for HDL cosimulation with MATLAB


Startup and Connection

Set Up for HDL Cosimulation

To cosimulate your HDL code with a MATLAB or Simulink® design, you must first:

Supported EDA Tools and Hardware

List of supported third-party EDA software and FPGA boards.

Set Up MATLAB-HDL Simulator Connection

Cosimulation requires a connection between MATLAB and your HDL simulation tool.

TCP/IP Socket Ports

Provides some direction for choosing TCP/IP socket ports.

Cross-Network Cosimulation

Provides instructions for performing cosimulation across a local network.

Run MATLAB-HDL Cosimulation

Run your test bench or component, including the cosimulation of your HDL module.

Cosimulation with System Object

Create a MATLAB System Object

You can verify HDL modules using the HDL Cosimulation System object™.

Verify Viterbi Decoder Using MATLAB System Object and HDL Simulator

This example shows you how to use MATLAB® System objects and Mentor Graphics® ModelSim®/QuestaSim® or Cadence® Incisive®/Xcelium® to cosimulate a Viterbi decoder implemented in VHDL.

Import HDL Code for MATLAB System Object

Generate a MATLAB System object to cosimulate your HDL code.

Cosimulation with Function

Import HDL Code for MATLAB Function

Generate a MATLAB function to cosimulate your HDL code.

Test Bench and Component Function Writing

This section explains how you use the use_instance_obj argument for MATLAB functions matlabcp and matlabtb.

Verify Raised Cosine Filter Design Using MATLAB

This tutorial guides you through the basic steps for setting up an HDL Verifier™ cosimulation that uses MATLAB and the HDL Simulator.

Automatic Verification

Automatic Verification of Generated HDL Code from MATLAB

Verify generated HDL code using a generated cosimulation script.

Verify Code with HDL Test Bench (HDL Coder)

Simulate the generated HDL design under test (DUT) with test vectors from the test bench using the specified simulation tool.

All Cosimulation

HDL Cosimulation

The HDL Verifier software consists of MATLAB functions, a MATLAB System object, and a library of Simulink blocks, all of which establish communication links between the HDL simulator and MATLAB or Simulink.

Prepare to Import HDL Code for Cosimulation

Prepare for cosimulation and choose whether to cosimulate your HDL code as a function, System object, or block.

Supported Data Types

If your HDL application needs to send HDL data to a MATLAB function, you may first need to convert the data to a type supported by MATLAB and the HDL Verifier software.

Race Conditions in HDL Simulators

Describes ways to avoid race conditions in hardware cosimulations with MATLAB and Simulink software.

Featured Examples