Documentation

hdlverifier.HDLCosimulation System object

Construct System object for HDL cosimulation with MATLAB

Description

The HDLCosimulation System object™ cosimulates MATLAB® and a hardware component. It does so by applying input signals to and reading output signals from an HDL model under simulation in the HDL simulator. You can use this object to model a source or sink device by configuring the object with input or output ports only.

Note

Starting in R2016b, instead of using the step method to perform the operation defined by the System object, you can call the object with arguments, as if it were a function. For example, y = step(obj,x) and y = obj(x) perform equivalent operations.

Construction

h = HDLCosimulation(Name,Value) creates a new instance of HDLCosimulation with additional options specified by one or more Name,Value pair arguments. Name can also be a property name and Value is the corresponding value. Name must appear inside single quotes (''). You can specify several name-value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

h = hdlcosim(Name,Value) creates a new instance of HDLCosimulation using a shortcut constructor.

The Cosimulation Wizard creates an HDL Cosimulation System object using existing HDL code. This workflow creates an HDL launch script for easier startup.

Properties

Connection

Parameters for the connection with the HDL simulator.

  • The first element is the connection type ('SharedMemory','Socket'). If shared memory is used, then port number and host name are not applicable.

  • The second element is the port number, which must be a positive integer. Optional. It is set to 4449 if not otherwise specified.

  • The third element is the host name of the HDL session. Optional. Set to localhost if not specified.

Default: {'SharedMemory'}

Example values:

{'SharedMemory'}
{'Socket'}
{'Socket',1234}
{'Socket',1234,'hostname'}

FrameBasedProcessing

Note

FrameBasedProcessing property will be removed in a future release. Sample mode or frame mode is automatically detected based on the size of the inputs during the step method execution.

Enable frame-based processing

Default: false

Example values:

true/false

InputSignals

Input paths in the HDL code

Default: ''

Example values:

'/top/in1'
{'/top/in1','/top/in2'}

OutputDataTypes

Data types of the output signals.

Default: ''

Example values:

{'fixedpoint'}
{'double','single'}

Note

When OutputDataTypes is fixedpoint, and the size matches the size of a built-in type (8,16,32,64), and OutputFractionLengths is set to 0, the output signal is returned as the built-in type.

OutputFractionLengths

Output fraction lengths. Must be an integer or vector of integer specifying the fraction length of the outputs. If you provide only a scalar, all the outputs are of the same type. Otherwise, provide a vector of the same size as the number of outputs.

Default: 0

Example values:

10
[12,6]

OutputSignals

Output paths in the HDL code

Default: ''

Example values:

'/top/out1'
{'/top/out1','/top/out2'}

OutputSigned

Output sign. Must be a boolean or vector of boolean specifying the sign of the outputs. If you provide only a scalar, all outputs are of the same type. Otherwise, provide a vector of the same size as the number of outputs.

Default: false

Example values:

true/false
[true,true]

PreRunTime

Delay in HDL simulator before the cosimulation starts

Default: {0,'ns'}

Example values:

{10,'fs'}
{25,'ps'}
{4,'ns'}
{500,'us'}
{5,'ms'}
{1,'s'}

SampleTime

Elapsed time in the HDL simulator between each call to step

Default: {10,'ns'}

Example values:

{10,'fs'}
{25,'ps'}
{4,'ns'}
{500,'us'}
{5,'ms'}
{1,'s'}

TclPostSimulationCommand

Tcl post-simulation command executed by the HDL simulator during a call to release

Default: ''

Example value:

'echo "done"'

TclPreSimulationCommand

Tcl presimulation command executed by the HDL simulator during the first call to step or during the next call to step after a call to release

Default: ''

Example value:

'force /top/rst 1 0, 0 2 ns; force /top/clk 0 0, 1 1 ns -repeat 2 ns'

Methods

resetUnlock object, release connection to HDL simulator, and reset internal state
stepRun HDL simulator for set of inputs and return output
Common to All System Objects
clone

Create System object with same property values

getNumInputs

Expected number of inputs to a System object

getNumOutputs

Expected number of outputs of a System object

isLocked

Check locked states of a System object (logical)

release

Allow System object property value changes

Examples

See the following Featured Examples:

Introduced in R2012b

Was this topic helpful?