这是用户在 2024-5-29 13:31 为 https://ww2.mathworks.cn/help/hdlverifier/ref/hdldaemon.html 保存的双语快照页面,由 沉浸式翻译 提供双语支持。了解如何保存?
Main Content 主要内容

hdldaemon

Control MATLAB server that supports interactions with HDL simulator
控制支持与 HDL 模拟器交互的 MATLAB 服务器

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 使用共享内存进程间通信启动 HDL Link MATLAB ® 服务器。每个 MATLAB 会话在任何给定时间只能运行一个 hdldaemon

example  例子

hdldaemon(Name,Value) uses additional options specified by one or more Name,Value pair arguments.
hdldaemon(Name,Value) 使用由一个或多个 Name,Value 对参数指定的附加选项。

  • 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.
    如果指定 socket Name, Value 参数,服务器将开始使用套接字内存。

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).
如果服务器已经在运行,则使用这些参数发出 hdldaemon 将关闭当前服务器,然后使用共享内存启动新的服务器会话(除非指定了套接字)。

example  例子

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.
hdldaemon(Option) 接受单个可选输入。一次调用中只能指定一个选项。您必须在使用这些选项之一调用 hdldaemon 之前建立服务器连接。

example  例子

s=hdldaemon(___) returns the server status connection in structure s, using any of the input arguments in the previous syntaxes.
s=hdldaemon(___) 使用前面语法中的任何输入参数,以结构 s 返回服务器状态连接。

Examples 例子

collapse all  全部收缩

Start the MATLAB server using shared memory communication and use an integer representation of time.
使用共享内存通信启动 MATLAB 服务器并使用时间的整数表示。

hdldaemon('time','int64')
HDLDaemon shared memory server is running with 0 connections

Start MATLAB server and specify socket communication on port 4449.
启动 MATLAB 服务器并指定端口 4449 上的套接字通信。

hdldaemon('socket',4449)
HDLDaemon socket server is running on port 4449 with 0 connections

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 for communication mode, number of existing connections, and the interprocess communication identifier (ipc_id) the MATLAB server is using for a link.
检查 MATLAB 服务器用于链接的通信模式、现有连接数以及进程间通信标识符 ( ipc_id ) 的连接信息。

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:
您可以通过在 MATLAB 命令提示符下输入来检查 ipc_id

x.ipc_id
 '\\.\pipe\E505F434-F023-42a6-B06D-DEFD08434C67'

Shut down server without shutting down MATLAB.
关闭服务器而不关闭 MATLAB。

hdldaemon('kill')
HDLDaemon server was shutdown

Issue simple or complex Tcl commands.
发出简单或复杂的 Tcl 命令。

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.
此示例取自在 MATLAB 中实现振荡器的滤波器组件。请参阅在上下文中使用此复杂 Tcl 命令的完整示例。

Input Arguments 输入参数

collapse all  全部收缩

Server option to shut down MATLAB server or display server status, specified as one of these character vectors:
用于关闭 MATLAB 服务器或显示服务器状态的服务器选项,指定为以下字符向量之一:

'kill'Shuts down the MATLAB server without shutting down MATLAB.
关闭 MATLAB 服务器而不关闭 MATLAB。
'stop'Shuts down the MATLAB server without shutting down MATLAB. There is no difference between using 'kill' and 'stop'.
关闭 MATLAB 服务器而不关闭 MATLAB。使用 'kill''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.
显示 MATLAB 服务器的状态。您还可以使用 s=hdldaemon('status') ,它显示 MATLAB 服务器状态并在结构体 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.
将可选参数对指定为 Name1=Value1,...,NameN=ValueN ,其中 Name 是参数名称, Value 是相应的值。名称-值参数必须出现在其他参数之后,但参数对的顺序并不重要。

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.
在 R2021a 之前,使用逗号分隔每个名称和值,并将 Name 括在引号中。

Example: 'time','int64','quiet','true' specifies time values are returned as 64-bit integers and output messages are suppressed.
示例: 'time','int64','quiet','true' 指定时间值作为 64 位整数返回,并且输出消息被抑制。

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:
向 MATLAB 服务器发送和返回时间值的说明,指定为由 'time' 和以下值之一组成的逗号分隔对组:

'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.
指定 MATLAB 服务器在 MATLAB 函数回调中以表示仿真步骤数的 64 位整数发送和返回时间值。

See the matlabcp/matlabtb tnow parameter reference (MATLAB Function Syntax and Function Argument Definitions).
请参阅 matlabcp / matlabtb tnow 参数参考(MATLAB 函数语法和函数参数定义)。

'sec'

Specifies that the MATLAB server sends and returns time values in the MATLAB function callbacks as double values that HDL Verifier™ scales to seconds based on the current HDL simulation resolution.
指定 MATLAB 服务器在 MATLAB 函数回调中以 double 值的形式发送和返回时间值,HDL Verifier™ 根据当前 HDL 仿真分辨率缩放为秒。

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.
如果服务器已经在运行,则单独发出带有 time 参数的 hdldaemon 将关闭当前服务器并使用共享内存再次启动服务器。

Example: 'time','int64' 示例: 'time','int64'

Indicator to suppress printing diagnostic messages, specified as the comma-separated pair consisting of 'quiet' and one of the following values:
用于禁止打印诊断消息的指示符,指定为以逗号分隔的对组,其中包含 'quiet' 和以下值之一:

'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.
错误仍然出现。使用 hdldaemon 获取未使用的套接字号时,使用此选项可以抑制 MATLAB 服务器关闭消息。如果服务器已经在运行,则单独发出带有 quiet 参数的 hdldaemon 将关闭当前服务器并使用共享内存再次启动服务器。

Example: 'quiet', 'true' 示例: 'quiet', 'true'

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.
用于通信的 TCP/IP 端口,指定为由 'socket' 和一个值组成的逗号分隔对。该值可以是 0 ,表示主机自动从 /etc/services 中选择有效的 TCP/IP 端口、显式端口号 (1024 < port < 49151) 或服务(别名)名称b2> 文件。

If you specify the operating system option (0), use hdldaemon('status') to acquire the assigned socket port number.
如果指定操作系统选项 ( 0 ),请使用 hdldaemon('status') 获取分配的套接字端口号。

Example: 'socket',4449 示例:“套接字”,4449

Tcl command transmitted to all connected clients, specified as any valid Tcl command character vector or string scalar.
Tcl 命令传输到所有连接的客户端,指定为任何有效的 Tcl 命令字符向量或字符串标量。

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™).
您指定的 Tcl 命令不能包含加载 HDL 模拟器项目或修改模拟器状态的命令。例如,字符向量不能包含 startstoprestart (对于 ModelSim ® )或 runstopreset (对于 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.
不要从 matlabtbmatlabcp 函数内部调用 hdldaemon('tclcmd', 'Tcl command') 。这样做会导致竞争条件,并且模拟器会挂起。

Example: 'tclcmd','puts' '"done"' 示例: 'tclcmd','puts' '"done"'

Output Arguments 输出参数

collapse all  全部收缩

Structure containing information about the connection. The structure contains the following variables:
包含有关连接的信息的结构。该结构体包含以下变量:

'comm'Either 'shared memory' or 'sockets'
'shared memory''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.
如果是共享内存,则为共享内存通信通道的文件系统名称。如果是套接字,则为 TCP/IP 端口号。

Version History 版本历史

Introduced in R2008a R2008a 中引入