matlabtb
Schedule MATLAB testbench session for instantiated HDL module
Description
Note
Enter this command in the HDL simulator, not in MATLAB®.
matlabtb
performs the following
actions: instance
Starts the HDL simulator client component of the HDL Verifier™ software.
Associates a specified instance of an HDL design created in the HDL simulator with a MATLAB function.
Creates a process that schedules invocations of the specified MATLAB function.
Cancels any pending events scheduled by a previous
matlabtb
command that specified the same instance. For example, if you issue the commandmatlabtb
for instancefoo
,matlabtb
cancels all previously scheduled events initiated bymatlabtb
onfoo
.This command is issued in the HDL simulator.
MATLAB testbench functions mimic stimuli passed to entities in the HDL model. Force stimulus from MATLAB or HDL scheduled with
matlabtb
.Note
The communication mode that you specify for
matlabtb
must match the communication mode you specified forhdldaemon
when you established the server connection.For socket communications, specify the port number you selected for
hdldaemon
when you issue a link request with thematlabtb
command in the HDL simulator.
matlabtb
adds time specifications for scheduling the specified MATLAB function.instance
time-specs
matlabtb
specifies one or more additional specifications as pairs consisting of a valid specification
name and its value. For example, instance
___ pair1 ... pairN
-mfunc vlogmatlabc
specifies for the
MATLAB function vlogmatlabc
to be associated with the specified
HDL module. You can specify these pairs with or without
time-specs
.
Examples
Use matlabtb
with -socket
Argument and Time Parameters
Start the HDL simulator client component of HDL Verifier, associate an instance of the entity myfirfilter
with the
MATLAB function myfirfilter
, and begin a local TCP/IP
socket-based testbench session using TCP/IP port 4449. Based on the specified testbench
stimuli, myfirfilter.m
executes 5 nanoseconds from the current time and
then executes repeatedly every 10 nanoseconds.
hdlsim> matlabtb myfirfilter 5 ns -repeat 10 ns -socket 4449
Apply Rising Edge Clocks and State Changes
Start the HDL simulator client component of HDL Verifier. Begin a remote TCP/IP socket-based session using the remote MATLAB host computer named computer123
and TCP/IP port 4449.
Based on the specified testbench stimuli, myfirfilter.m
executes 10
nanoseconds from the current time, each time the signal /top/fclk
experiences a rising edge, and each time the signal /top/din
changes
state.
hdlsim> matlabtb /top/myfirfilter 10 ns -rising /top/fclk -sensitivity /top/din -socket 4449@computer123
Specify a MATLAB Function Name and Sensitizing Signals
Start the HDL simulator client component of the HDL Verifier software. The -mfunc
option specifies the MATLAB function to connect to and the -socket
pair specifies the
port number for socket connection mode. The -sensitivity
pair indicates
that the testbench session is sensitized to the signal sine_out
.
hdlsim> matlabtb osc_top -sensitivity /osc_top/sine_out -socket 4448 -mfunc hosctb
Input Arguments
instance
— Instance of HDL module associated with MATLAB testbench function
character vector | string scalar
Instance of an HDL module that is associated with a MATLAB function, specified as a character vector or string scalar that indicates
an HDL module instance. By default, the matlabtb
command associates
the instance to a MATLAB function that has the same name as the instance. For example, if the
instance is myfirfilter
, matlabtb
associates the
instance with the MATLAB function myfirfilter
The command ignores hierarchy
names. For example, if the instance is top.myfirfilter
, the
matlabtb
command associates only myfirfilter
with the MATLAB function. To associate the specified instance with a MATLAB function that differs from the instance name, use the
-mfunc
specification as in the pair1 ...
pairN
argument.
Note
If you specify an instance of an HDL module that is already associated with a
MATLAB function (via matlabcp
or
matlabtb
) the new association overwrites the existing
one.
Data Types: char
| string
time-specs
— Schedule execution of MATLAB function
space-separated list of one or more time specifications
Space-separated list of one or more time specifications, specified as a space-separated list of one or more time specifications listed in this table.
Time Specification | Description |
---|---|
time_1
time_2 ...
time_n | Specify one or more discrete times at which the HDL simulator calls the specified MATLAB function. The specified times are relative to the current simulation time. If you do not specify a time, the HDL simulator calls the MATLAB function once at the start of the simulation. Each time_i consists of a number indicating the time value and an optional time unit of:
If you do not specify a time unit, the command treats the time value as a value of HDL simulation ticks. Separate each time_i by a space. For example, this code specifies for the MATLAB
function matlabtb vlogmodel_top 10 ns, 10 ms, 10 sec |
-repeat <time> | Specify that the HDL simulator calls the MATLAB function repeatedly based on the specified times. The time values
are relative to the value of tnow at the time the HDL
simulator first calls the MATLAB function. |
-cancel <time> | Specify a single time at which the specified MATLAB function stops executing. The time value is relative to the
value of Note The |
Note
Place time specifications after the matlabtb
instance and
before any additional command arguments; otherwise the time specifications are
ignored.
pair1 ... pairN
— Additional specifications
space-separated list of one or more specification pairs
Additional specifications, specified as a space-separated list of one or more specification pairs. A specification pair consists of a name and value. This table shows valid options for these pairs.
Specification Pairs
Name | Value | Description |
---|---|---|
-socket | Communication mode that matches the communication mode issued with the
hdldaemon command | Specify for HDL Verifier to use TCP/IP sockets to communicate between the HDL simulator
and MATLAB. Shared memory is the default mode of communication and takes
effect if you do not specify For more information on choosing TCP/IP socket ports, see TCP/IP Socket Ports. Note The communication mode that you specify with the
|
-rising | Comma-separated list of one or more signal names | Specify
Note When specifying signals with the |
-falling | Comma-separated list of one or more signal names | Specify the path names of one or more signals defined as a logic type
( For determining signal transition in:
Note When specifying signals with the |
-sensitivity | Comma-separated list of one or more signal names | Specify the path names of one or more signals. This pair indicates that the application calls the specified MATLAB function whenever any of the specified signals change state. Signals of any type can appear in the sensitivity list and can be positioned at any level in the HDL model hierarchy. Note When specifying signals with the |
-mfunc | MATLAB function name | Specify the name of the MATLAB function that is associated with the HDL module instance you
specify for |
-use_instance_obj | Structure with fields as described in the table in -use_instance_obj Fields | This pair Instructs the function specified with the argument
|
-argument | HDL instance argument | Pass user-defined arguments from the |
-use_instance_obj
Fields
Field | Read or Write Access | Description |
---|---|---|
tnext | Write-only | Schedule a callback during the set time. This field is equivalent to
old hdl_instance_obj.tnext = hdl_instance_obj.tnow + 5e-9 |
userdata | Read or Write | Store state variables of the current matlabtb
instance. You can retrieve the variables the next time the callback of this
instance is scheduled. |
simstatus | Read-only | Store the status of the HDL simulator. The HDL Verifier software sets this field to >> hdl_instance_obj.simstatus ans= Init |
instance | Read-only | Store the full path of the Verilog or VHDL instance associated with the callback.
In the HDL simulator: hdlsim> matlabtb osc_top -mfunc oscfilter use_instance_obj In MATLAB: >> hdl_instance_obj.instance ans= osc_top |
argument | Read-only | Store the argument that is set by the matlabtb osc_top -mfunc oscfilter -use_instance_obj -argument foo -argument option only when
it is used with the -use_instance_obj pair. Otherwise, the
command ignores the argument. argument is a read-only
property.
>> hdl_instance_obj.argument ans= foo |
portinfo | Read-only | Store information about the VHDL and Verilog ports that are associated with this instance.
hdl_instance_obj.portinfo.field1.field2.field3
Note When you use |
tscale | Read-only | Store the resolution limit (tick) in seconds of the HDL simulator.
>> hdl_instance_obj.tscale ans= 1.0000e-009 Note When you use |
tnow | Read-only | Store the current time. hdl_instance_obj.tnext = hld_instance_obj.tnow + fastestrate; |
portvalues | Read or Write | Store the current values of and set new values for the output and
input ports for a >> hdl_instance_obj.portvalues ans = Read Only Input ports: clk_enable: [] clk: [] reset: [] Read/Write Output ports: sine_out: [22x1 char] |
linkmode | Read-only | Store the status of the callback. HDL Verifier sets this field to >> hdl_instance_obj.linkmode ans= component |
Version History
Introduced in R2008a
See Also
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)