Products & Services Industries Academia Support User Community Company

Learn more about EDA Link Simulator   

hdldaemon - (For ModelSim) Control MATLAB server that supports interactions with ModelSim simulator

Syntax

hdldaemon
s=hdldaemon
hdldaemon('ParameterName',ParameterValue)
s=hdldaemon('ParameterName',ParameterValue)
hdldaemon('Option')

Description

hdldaemon starts the HDL Link MATLAB server using shared memory interprocess communication. Only one hdldaemon per MATLAB session can be running at any given time.

s=hdldaemon starts the MATLAB server using shared memory and returns the server status connection in structure s.

hdldaemon('ParameterName',ParameterValue) starts the MATLAB server using shared memory and accepts optional inputs as one or more comma-separated parameter-value pairs. ParameterName is the name of the parameter inside single quotes. ParameterValue is the value corresponding to ParameterName. To start the server in socket mode, use the 'socket' parameter.

s=hdldaemon('ParameterName',ParameterValue) works the same as hdldaemon('ParameterName',ParameterValue) and returns the server status connection in structure s.

hdldaemon('Option') accepts a single optional input. Only one option may be specified in a single call. You must establish the server connection before calling hdldaemon with one of these options.

Inputs

Option

Select one of the following options:

  • 'kill'

    Shuts down the MATLAB server without shutting down MATLAB.

  • 'stop'

    Shuts down the MATLAB server without shutting down MATLAB. There is no difference between using 'kill' and 'stop'.

  • 'status'

    Displays status of the MATLAB server. You can also use s=hdldaemon('status'), which displays MATLAB server status and returns status in structure s.

Parameter/Value Pairs

'time'

Specifies how the MATLAB server sends and returns time values.

  • 'int64'

    Specifies that the MATLAB server send and return time values in the MATLAB function callbacks as 64-bit integers representing the number of simulation steps.
    See the matlabcp/matlabtb tnow parameter reference (Defining EDA Simulator Link M-Functions and Function Parameters).

  • 'sec'

    Specifies that the MATLAB server sends and returns time values in the MATLAB function callbacks as double values that EDA Simulator Link scales to seconds based on the current HDL simulation resolution.

Default: 'sec'

'quiet'

Suppresses printing diagnostic messages. Errors still appear. Use this option to suppress the MATLAB server shutdown message when using hdldaemon to get an unused socket number.

  • 'true'

    Suppress printing diagnostic messages.

  • 'false'

    Do not suppress printing diagnostic messages.

Default: 'false'

'socket'

Defines the TCP/IP port used for communication. The socket value can be:

  • 0, indicating the host automatically chooses a valid TCP/IP port

  • An explicit port number (1024 < port < 49151)

  • A service name (that is, alias) from /etc/services file

If you specify the operating system option (0), use hdldaemon('status') to acquire the assigned socket port number.

See Specifying TCP/IP Socket Communication for more information about TCP/IP ports.

'tclcmd'

Transmits a Tcl command to all connected clients.

You may specify any valid Tcl command string. 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.

    Note   You can issue this command only after the software establishes a server connection.

    Caution   Do not call hdldaemon(tclcmd, 'tclcmd') from inside a matlabtb or matlabcp function. Doing so results in a race condition, and the simulator hangs.

Outputs

s

s is a structure with these fields:

  • comm

    Shared memory or sockets

  • connections

    Number of open connections

  • ipc_id

    File system name (for shared memory communication channel) or TCP/IP port number (for socket)

Examples

Start the MATLAB server using shared memory communication and use an integer representation of time:

hdldaemon('time', 'int64')
 

Start MATLAB server and specify socket communication on port 4449:

hdldaemon('socket', 4449)
 

Start MATLAB server with socket communication and use a 64-bit representation of time:

hdldaemon('socket', 4449, 'time', 'int64')
 

Check hdldaemon server status:

hdldaemon('status')

Returns, for example,

HDLDaemon socket server is running on port 4449 with 1 connections

Or

HDLDaemon shared memory server is running with 0 connections

Or

HDLDaemon is NOT running
 

Check connection information for communication mode, number of existing connections, and the interprocess communication identifier (ipc_id) the MATLAB server is using for a link:

x=hdldaemon('status')

For a socket connection, returns:

x = 
           comm: 'sockets'
    connections: 0
         ipc_id: '4449'

For shared memory, returns:

x = 
           comm: 'shared memory'
    connections: 0
         ipc_id: [1x45 char]

You can examine ipc_id by entering it at the MATLAB command prompt:

>>x.ipc_id
 

Shut down server without shutting down MATLAB:

hdldaemon('kill')
 

Issue simple Tcl commands:

hdldaemon('tclcmd','puts "This is a test"')
 

Issue complex Tcl commands:

See the demo for Implementing the Filter Component of an Oscillator in MATLAB for an extensive example of a compound Tcl command.

See Also

vsim

How To

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS