hdldaemon
Control MATLAB server that supports interactions with HDL simulator
Description
hdldaemon
starts the HDL Link MATLAB® server
using shared memory inter-process communication. Only one hdldaemon
per MATLAB session
can be running at any given time.
hdldaemon(
uses additional options
specified by one or more Name,Value
)Name,Value
pair arguments.
If you do not specify memory type, the server starts using shared memory.
If you specify the
socket
Name, Value
argument, the server starts using socket memory.
Note
If server is already running, issuing hdldaemon
with
these arguments shuts down the current server and then starts a new
server session using shared memory (unless socket is specified).
Examples
Start MATLAB Server With Shared Memory
Start the MATLAB server using shared memory communication and use an integer representation of time.
hdldaemon('time','int64')
HDLDaemon shared memory server is running with 0 connections
Start MATLAB Server With Socket Communication
Start MATLAB server and specify socket communication on port 4449.
hdldaemon('socket',4449)
HDLDaemon socket server is running on port 4449 with 0 connections
Check Server Status
With one or more connections:
hdldaemon('status')
HDLDaemon socket server is running on port 4449 with 1 connections
With no connections:
hdldaemon('status')
HDLDaemon shared memory server is running with 0 connections
Server has not been started:
hdldaemon('status')
HDLDaemon is NOT running
Check Connection Information
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.
Returned message for a socket connection:
x=hdldaemon('status')
x = comm: 'sockets' connections: 0 ipc_id: '4449'
Returned message for a shared memory connection:
x=hdldaemon('status')
x = comm: 'shared memory' connections: 0 ipc_id: '\\.\pipe\E505F434-F023-42a6-B06D-DEFD08434C67'
You can examine ipc_id
by entering
it at the MATLAB command prompt:
x.ipc_id
'\\.\pipe\E505F434-F023-42a6-B06D-DEFD08434C67'
Shut Down Server
Shut down server without shutting down MATLAB.
hdldaemon('kill')
HDLDaemon server was shutdown
Issue Tcl Commands
Issue simple or complex Tcl commands.
Simple example:
hdldaemon('tclcmd','puts "This is a test"')
Complex example:
tclcmd = {['cd ',unixprojdir],... 'vlib work',... % create library (if applicable) ['vcom -performdefaultbinding ' unixsrcfile1],... ['vcom -performdefaultbinding ' unixsrcfile2],... ['vcom -performdefaultbinding ' unixsrcfile3],... 'vsimmatlab work.osc_top ',... 'matlabcp u_osc_filter -mfunc oscfilter',... 'add wave sim:/osc_top/clk',... 'add wave sim:/osc_top/clk_enable',... 'add wave sim:/osc_top/reset',... ['add wave -height 100 -radix decimal -format analog-step -scale 0.001 -offset 50000 ',... 'sim:/osc_top/osc_out'],... ['add wave -height 100 -radix decimal -format analog-step -scale 0.00003125 -offset 50000 ',... 'sim:/osc_top/filter1x_out'],... ['add wave -height 100 -radix decimal -format analog-step -scale 0.00003125 -offset 50000 ',... 'sim:/osc_top/filter4x_out'],... ['add wave -height 100 -radix decimal -format analog-step -scale 0.00003125 -offset 50000 ',... 'sim:/osc_top/filter8x_out'],... 'force sim:/osc_top/clk_enable 1 0',... 'force sim:/osc_top/reset 1 0, 0 120 ns',... 'force sim:/osc_top/clk 1 0 ns, 0 40 ns -r 80ns',... };
This example is taken from Implement Filter Component of Oscillator in MATLAB. See the full example for use of this complex Tcl command in context.
Input Arguments
Option
— Server option to shut down MATLAB server or display server status
'kill'
| 'stop'
| 'status'
Server option to shut down MATLAB server or display server status, specified as one of these character vectors:
'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 . |
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: 'time','int64','quiet','true'
specifies
time values are returned as 64-bit integers and output messages are
suppressed.
time
— Instruction to MATLAB server on how it should send and return time values
'sec'
(default) | 'int64'
Instruction to MATLAB server on how it should send and
return time values, specified as the comma-separated pair consisting
of 'time'
and one of these 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. |
'sec' | Specifies that the MATLAB server sends and returns
time values in the MATLAB function callbacks as |
If server is already running, issuing hdldaemon
with
the time
parameter alone will shut down the current
server and start the server up again using shared memory.
Example: 'time','int64'
quiet
— Indicator to suppress printing diagnostic messages
'false'
(default) | 'true'
Indicator to suppress printing diagnostic messages, specified
as the comma-separated pair consisting of 'quiet'
and
one of the following values:
'true' | Suppress printing diagnostic messages. |
'false' | Do not suppress 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. If server is already running, issuing hdldaemon
with
the quiet
parameter alone will shut down the current
server and start the server up again using shared memory.
Example: 'quiet', 'true'
socket
— TCP/IP port used for communication
0
| port number | character vector alias
TCP/IP port used for communication, specified as the comma-separated pair consisting of
'socket'
and a value. The value can be either 0
,
indicating that the host automatically chooses a valid TCP/IP port, an explicit port number
(1024 < port < 49151) or a service (alias) name from /etc/services
file.
If you specify the operating system option (0
),
use hdldaemon('status')
to acquire the assigned
socket port number.
Example: 'socket',4449
tclcmd
— Tcl command transmitted to all connected clients
character vector | string scalar
Tcl command transmitted to all connected clients, specified as any valid Tcl command character vector or string scalar.
The Tcl command you specify cannot include commands that load an HDL simulator project or
modify simulator state. For example, the character vector cannot include commands such as
start
, stop
, or restart
(for
ModelSim™) or run
, stop
, or
reset
(for Xcelium™).
Note
You can issue this command only after the software establishes a server connection.
Caution
Do not call hdldaemon('tclcmd', 'Tcl command')
from
inside a matlabtb
or matlabcp
function.
Doing so results in a race condition, and the simulator hangs.
Example: 'tclcmd','puts' '"done"'
Output Arguments
s
— Structure containing information about the connection
'comm'
| 'connections'
| 'ipc_id'
Structure containing information about the connection. The structure contains the following variables:
'comm' | Either 'shared memory' or 'sockets' |
'connections' | Number of open connections |
'ipc_id' | If shared memory, file system name for the shared memory communication channel. If socket, the TCP/IP port number. |
Version History
Introduced in R2008a
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
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)