| EDA Simulator Link™ MQ | ![]() |
hdldaemon
hdldaemon('PropertyName',
'PropertyValue'...)
hdldaemon('status')
hdldaemon('kill')
Use hdldaemon to activate servers, check link status, and shutdown servers.
hdldaemon starts the MATLAB server component of the EDA Simulator Link MQ software with the following default settings:
Shared memory communication enabled
Time resolution for the MATLAB simulation function output ports set to scaled (type double)
You can use TCP/IP on a single system (one that runs both MATLAB and the HDL simulator). However, consider using shared memory communication when your application configuration consists of a single system. This approach can result in increased performance.
Only one hdldaemon per MATLAB session can be running at any given time.
The communication mode that you specify (shared memory or TCP/IP sockets) must match what you specify for the communication mode when you issue the matlabcp, matlabtb, or matlabtbeval command in the HDL simulator.
In addition, if you specify TCP/IP socket mode, you must also identify a socket port to be used for establishing links. You can choose and then specify a socket port yourself, or you can use an option that instructs the operating system to identify an available socket port for you. Regardless of how you identify the socket port, the socket you specify with the HDL simulator must match the socket being used by the server.
For more information on modes of communication, see Communicating with MATLAB or Simulink and the HDL Simulator. For more information on establishing the HDL simulator end of the communication link, see Associating a MATLAB Link Function with an HDL Module.
hdldaemon('PropertyName', 'PropertyValue'...) starts the EDA Simulator Link MQ MATLAB server component with property-value pair settings that specify the communication mode for the link between MATLAB and the HDL simulator, the resolution of tnow (the current time argument passed by the associated m-function), and, optionally, a Tcl command to be executed immediately in the HDL simulator. See hdldaemon Property Name/Property Value Pairs for details.
hdldaemon('status') returns the following message indicating that a link (connection) exists between MATLAB and the HDL simulator:
HDLDaemon socket server is running on port 4449 with 0 connections
You can also use this function to check on the communication mode being used, the number of existing connections, and the interprocess communication identifier (ipc_id) being used for a link by assigning the return value of hdldaemon to a variable. The ipc_id identifies a port number for TCP/IP socket links or the file system name for a shared memory communication channel. For example:
x=hdldaemon('status')
x =
comm: 'sockets'
connections: 0
ipc_id: '4449'
This function call indicates that the server is using TCP/IP socket communication with socket port 4449 and is running with no active HDL simulator clients. If you are using a shared memory link, set the value of comm to 'shared memory' and make the value of ipc_id a file system name for the shared memory communication channel. For example:
x=hdldaemon('status')
HDLDaemon shared memory server is running with 0 connections
x =
comm: 'shared memory'
connections: 0
ipc_id: [1x45 char]
hdldaemon('kill') shuts down the MATLAB server without shutting down MATLAB.
hdldaemon accepts the following valid property name/property value pairs:
Specifies the TCP/IP socket mode of communication for the link between MATLAB and the HDL simulator. If you omit this argument, the server uses the shared memory mode of communication.
Note You must use TCP/IP socket communication when your application configuration consists of multiple computing systems. |
The tcp_spec can be a TCP/IP port number, TCP/IP port alias or service name, or the value zero, indicating that the port is to be assigned by the operating system. 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.
Note If you specify the operating system option ('0' or 0), use hdldaemon('status') to acquire the assigned socket port number. You must specify this port number when you issue a link request with the matlabtb or matlabtbeval command in the HDL simulator. |
Specifies the time resolution for MATLAB function ports and simulation times (tnow).
| Specify... | For... |
|---|---|
| 'time' 'sec' (default) | A double value that is scaled to seconds based on the current HDL simulation resolution |
| 'time' 'int64' | 64-bit integer representing the number of simulation steps |
If you omit this argument, the server uses scaled resolution time.
Passes a TCL command string, to be executed in the HDL simulator, from MATLAB to the HDL simulator. You may use a compound command and separate the commands with semicolons.
Note The Tcl command string you specify cannot include commands that load an HDL simulator project or modify simulator state. For example, the string cannot include commands such as run, stop, or reset. |
Caution Do not call hdldaemon(tclcmd, 'tclcmd') inside of a matlabtb or matlabcp function. You will get a race condition and the simulator will hang. |
Suppresses printing messages to the standard queue. Errors still appear.
The following table provides guidelines on when and how to specify property name/property value pairs.
| If Your Application Is to... | Do the Following... |
|---|---|
| Operate in shared memory mode | Omit the 'socket', tcp_spec property name/property value pair. The interface operates in shared memory mode by default. You should use shared memory mode if your application configuration consists of a single system and uses a single communication channel. |
| Operate in TCP/IP socket mode, using a specific TCP/IP socket port | Specify the 'socket', tcp_spec property name and value pair. The tcp_spec can be a socket port number or service name. Examples of valid port specifications include '4449', 4449, and MATLAB Service. For information on choosing a TCP/IP socket port, see Choosing TCP/IP Socket Ports. |
| Operate in TCP/IP socket mode, using a TCP/IP socket that the operating system identifies as available | Specify 'socket', 0 or 'socket', '0'. |
| Return time values in seconds (type double) | Specify 'time', 'sec' or omit the parameter. This is the default time value resolution. |
| Return 64-bit time values (type int64) | Specify 'time', 'int64' . |
Execute Tcl command immediately upon simulator connection | Specify the 'tclcmd', 'command' property name and value pair. Command must be a valid Tcl command but cannot include commands that load an HDL simulator project or modify the simulator state. |
| Suppress server shutdown message when using hdldaemon to get an unused socket number (message can appear confusing) | Specify 'quiet', 'true'. |
The following function call starts the MATLAB server with shared memory communication enabled and a 64-bit time resolution format for the MATLAB function's tnow parameter:
hdldaemon('time', 'int64')
The following function call starts the MATLAB server with TCP/IP socket communication enabled on socket port 4449. Although you do not need to use TCP/IP socket communication on a single-computer application, you can use that mode of communication locally. Because the function does not specify a time resolution, the HDL simulator applies the default, scaled simulation time resolution to the MATLAB function's output ports:
hdldaemon('socket', 4449)
The following function call starts the MATLAB server with TCP/IP socket communication enabled on port 4449. This call also specifies a 64-bit time resolution format:
hdldaemon('socket', 4449, 'time', 'int64')
You also can start the server from a script. Consider the following function call sequence:
dstat = hdldaemon('socket', 0)
portnum = dstat.ipc_id
The first call to hdldaemon specifies that the server use TCP/IP communication with a port number that the operating system identifies and returns connection status information, including the assigned port number, to dstat. The statement on the second line assigns the socket port number to portnum for future reference.
The following function call causes the string This is a test to be displayed at the HDL simulator prompt:
hdldaemon('tclcmd','puts "This is a test"')The following is an example of a compound Tcl command used with hdldaemon:
hdldaemon('tclcmd','{force filter2d_v.clk_enable 1
-after 0ns;
force filter2d_v.reset 1 -after 0 ns 0 -after 1 ns;
puts {Running Simulink Cosimulation block};
puts [clock format [clock seconds]]}')
![]() | dec2mvl | mvl2dec | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |