Create a System object for HDL cosimulation with MATLAB
The hdlverifier.HDLCosimulation
System object™ cosimulates MATLAB® and a hardware component. The System object writes input signals to and reads
output signals from an HDL model under simulation in the HDL simulator. You can use this
System object to model a source or sink device by configuring the System object with only output or input ports, respectively.
To create a System object for HDL cosimulation with MATLAB:
Customize the hdlverifier.HDLCosimulation object using Cosimulation Wizard.
Create the object in your design and set its properties.
Call the object with arguments, as if it were a function.
To learn more about how System objects work, see What Are System Objects?.
To create an hdlverifier.HDLCosimulation
System object, use the Cosimulation Wizard to customize the HDLCosimulation
System object. The output of the Cosim Wizard is a
file called hdlcosim_toplevel
.m, where
toplevel
is the name of the top level HDL module. You can then
create the System object by assigning it to a local variable.
creates
an hdlc
= hdlverifier.HDLCosimulationhdlverifier.HDLCosimulation
System object with default property values. This System object provides an interface to your HDL simulation in your MATLAB workspace.
specifies properties by one or more hdlc
= hdlverifier.HDLCosimulation(Name,Value
)Name,Value
pairs. Enclose each
property name in single quotes. For example,
hdlc = hdlverifier.HDLCosimulation('InputSignals','/top/in1', ... ,
'OutputFractionLangths',10);
creates an hdlc
= hdlcosimhdlverifier.HDLCosimulation
System object with default property values. This syntax is equivalent to the
hdlverifier.HDLCosimulation
syntax.
is equivalent to the hdlc
= hdlcosim(Name,Value
)hdlverifier.HDLCosimulation(Name,Value)
syntax.
The Cosimulation Wizard creates an
hdlverifier.HDLCosimulation
System object using existing HDL code, and an
HDL launch script. Use the Cosimulation Wizard for easier startup.
connects to the HDL simulator, writes hdloutputs
= hdlc(hdlinputs
)hdlinputs
to the HDL simulator,
and reads hdloutputs
from the HDL simulator. The elapsed simulation
time between each call to the System object is defined by the SampleTime property.
To use an object function, specify the
System object as the first input argument. For
example, to release system resources of a System object named obj
, use
this syntax:
release(obj)