Set Up MATLAB-HDL Simulator Connection
Start MATLAB Server
Start a MATLAB® server for cosimulation with an HDL simulator. This is not required for Vivado® simulator users, since the simulation runs as a single process with a shared DLL.
Start the MATLAB server as follows:
Start MATLAB.
In the MATLAB Command Window, call the
hdldaemon
function with property name/property value pairs that specify whether the HDL Verifier™ software is to perform the following tasks:Use shared memory or TCP/IP socket communication
Return time values in seconds or as 64-bit integers
See hdldaemon
reference
documentation for when and how to specify property name/property value
pairs and for more examples of using hdldaemon
.
The communication mode that you specify (shared memory or TCP/IP sockets) must match what you
specify for the communication mode when you initialize the HDL simulator for use with a
MATLAB cosimulation session using the matlabtb
or
matlabcp
function. In addition, if you specify TCP/IP socket mode,
the socket port that you specify with hdldaemon
and
matlabtb
or matlabcp
must match. See TCP/IP Socket Ports for more information.
The MATLAB server can service multiple simultaneous HDL simulator modules and clients. However, your code must track the I/O associated with each entity or client.
Note
You cannot begin an HDL Verifier transaction between MATLAB and the HDL simulator from MATLAB. The MATLAB server simply responds to function call requests that it receives from the HDL simulator.
This command sets up socket communication on port 4449, and specifies a 64-bit time resolution format for the MATLAB function's output ports.
hdldaemon('socket',4449,'time','int64')
Start HDL Simulator
Start the HDL simulator directly from MATLAB by calling
the HDL Verifier function vsim
or nclaunch
.
>>vsim
You can call vsim
or nclaunch
with additional parameters; see
the reference pages for details.
You must make sure the HDL simulator executables — also called vsim
(ModelSim™) and nclaunch
(Cadence®
Xcelium™) — are on the system path. See your system documentation for
instruction on setting environment variables.
Linux Users
Make sure the HDL simulator executable is still on the system path after the shell is launched from MATLAB. If it is not, make sure the shell startup file does not remove it from the path environment variable.
Load an HDL Design for Verification
After you start the HDL simulator from MATLAB with a call to vsim
or nclaunch
, load an instance of an HDL module for verification or
visualization with the function vsimmatlab
or hdlsimmatlab
. At this point, you should have coded and compiled your HDL
model. Issue the function vsimmatlab
or
hdlsimmatlab
for each instance of an entity or module in your model
that you want to cosimulate. For example (for use with Xcelium):
hdlsimmatlab work.osc_top
This command loads the HDL Verifier library, opens
a simulation workspace for osc_top
, and display
a series of messages in the HDL simulator command window as the simulator
loads the entity (see example for remaining code).