| EDA Simulator Link™ IN | ![]() |
Associate MATLAB component function with instantiated HDL design
matlabcp <instance> [<time-specs>] [-socket <tcp-spec>] [-rising <port>[,<port>...]] [-falling <port> [,<port>,...]] [-sensitivity <port>[,<port>,...]] [-mfunc <name>]
Specifies an instance of an HDL design that is associated with a MATLAB function. By default, matlabcp associates the instance to a MATLAB function that has the same name as the instance. For example, if the instance is myfirfilter, matlabcp associates the instance with the MATLAB function myfirfilter. Alternatively, you can specify a different MATLAB function with -mfunc.
Note Note Do not specify an instance of an HDL module that has already been associated with a MATLAB test bench function (via matlabcp or matlabtb). If you do, the new association overwrites the existing one. |
Specifies a combination of time specifications consisting of any or all of the following:
| <timen>,... | Specifies one or more discrete time values at which the specified MATLAB function is called. Each time value is relative to the current simulation time. The MATLAB function is always called once at the start of the simulation, even if you do not specify a time. Multiple time values are separated by a space, for example: matlabcp vlogtestbench_top 1e6 fs 3 2e3 ps -repeat 3 ns -cancel 7ns |
| -repeat <time> | Specifies that the MATLAB function be called repeatedly based on the specified <timen>,... pattern. The time values are relative to the value of tnow at the time the MATLAB function is first called. |
| -cancel <time> | Specifies a time at which the specified MATLAB function stops executing. The time value is relative to the value of tnow at the time the MATLAB function is first called. If you do not specify a cancel time, the command calls the MATLAB function. |
Note Time specifications must be placed after the matlabcp instance and before any additional command arguments; otherwise the time specifications are ignored. |
All time specifications for the matlabcp functions are represented by a number and optionally a time unit:
fs (femtoseconds)
ps (picoseconds)
ns (nanoseconds)
us(microseconds)
ms(milliseconds)
sec (seconds)
no units (tick)
Specifies TCP/IP socket communication for the link between the HDL simulator and MATLAB. For TCP/IP socket communication on a single computer, the <tcp_spec> argument can consist of just a TCP/IP port number or service name (alias). If you are setting up communication between computers, you must also specify the name or Internet address of the remote host that is running the MATLAB server (hdldaemon). See Specifying TCP/IP Values for some valid tcp_spec examples.
For more information on choosing TCP/IP socket ports, see Choosing TCP/IP Socket Ports.
If the HDL simulator and MATLAB are running on the same computer, you have the option of using shared memory for communication. Shared memory is the default mode of communication and takes effect if you omit -socket <tcp_spec> from the command line.
Note The communication mode that you specify with the matlabcp command must match what you specify for the communication mode when you issue the hdldaemon command in MATLAB. |
For more information on modes of communication, see Communicating with MATLAB or Simulink and the HDL Simulator. For more information on establishing the MATLAB end of the communication link, see Starting the MATLAB Server.
Indicates that the specified MATLAB function is called on the rising edge (transition from '0' to '1') of any of the specified signals. For determining signal transition in:
Verilog: Z and X are read as 0
VHDL: Z and X will not create a rate transition
Rate transitions are only from 0 -> 1 and 1-> 0. Specify -rising with the path names of one or more signals defined as a logic type.
Indicates that the specified MATLAB function is called when any of the specified signals experiences a falling edge—changes from '1' to '0'. Specify -falling with the path names of one or more signals defined as a logic type.
Indicates that the specified MATLAB function is called when any of the specified signals changes state. Specify -sensitivity with the path names of one or more signals. Signals in the sensitivity list can be any type and can be at any level in the hierarchy of the HDL model.
The name of the MATLAB function that is associated with the HDL module instance you specify for instance. If you omit this argument, matlabcp associates the HDL module instance to a MATLAB function that has the same name as the HDL instance. For example, if the HDL module instance is myfirfilter, matlabcp associates the HDL module instance with the MATLAB function myfirfilter. If you omit this argument and matlabcp does not find a MATLAB function with the same name, the command generates an error message.
The matlabcp command has the following characteristics:
Starts the HDL simulator client component of the EDA Simulator Link™ IN 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 matlabcp command that specified the same instance. For example, if you issue the command matlabcp for instance foo, all previously scheduled events initiated by matlabcp on foo are canceled.
MATLAB component functions simulate the behavior of modules in the HDL model. A stub module (providing port definitions only) in the HDL model passes its input signals to the MATLAB component function. The MATLAB component processes this data and returns the results to the outputs of the stub module. A MATLAB component typically provides some functionality (such as a filter) that is not yet implemented in the HDL code. See Coding an EDA Simulator Link™ IN MATLAB® Application.
Note For the HDL simulator to establish a communication link with MATLAB, the MATLAB server, hdldaemon, must be running with the same communication mode and, if appropriate, the same TCP/IP socket port as you specify with the matlabcp command. |
This example associates the Verilog module vlogtestbench_top.u_matlab_component with the MATLAB function vlogmatlabc using socket communication on port 4449. The '-mfunc' option specifies the m-function to connect to and '-socket' option specifies the port number for socket connection mode.
matlabcp vlogtestbench_top.u_matlab_component -mfunc vlogmatlabc -socket 4449
This example also associates the component with the MATLAB function but includes explicit times and uses the -cancel option.
matlabcp vlogtestbench_top 1e6 fs 3 2e3 ps -repeat 3 ns -cancel 7ns
This example also associates the component with the MATLAB function and also uses rising and falling edges.
matlabcp vlogtestbench_top 1 2 3 4 5 6 7 -rising outclk3 -falling u_matlab_component/inoutclk
![]() | hdlsimulink | matlabtb | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |