Products & Services Solutions Academia Support User Community Company

Learn more about EDA Link Simulator   

Specifying TCP/IP Socket Communication

Communication Modes and Socket Ports

Depending on your particular configuration (for example, when the MATLAB software and the HDL simulator reside on separate machines), when creating an EDA Simulator Link MATLAB application or defining the block parameters of an HDL Cosimulation block, you may need to identify the TCP/IP socket port number or service name (alias) to be used for EDA Simulator Link connections.

To use the TCP/IP socket communication, you must choose a TCP/IP socket port number for the server component to listen on that is available in your computing environment. Client components can connect to a specific server by specifying the port number on which the server is listening. For remote network configurations, the Internet address helps distinguish multiple connections.

The socket port resource is associated with the server component of an EDA Simulator Link configuration. That is, if you use MATLAB in a test bench configuration, the socket port is a resource of the system running MATLAB. If you use a Simulink design in a cosimulation configuration, the socket port is a resource of the system running the HDL simulator.

For any given command or function, 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.

The port 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 examples.

For more information on choosing TCP/IP socket ports, see Choosing TCP/IP Socket Ports.

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 Start hdldaemon to Provide Connection to HDL Simulator.

Choosing TCP/IP Socket Ports

A TCP/IP socket port number (or alias) is a shared resource. To avoid potential collisions, particularly on servers, you should use caution when choosing a port number for your application. Consider the following guidelines:

Specifying TCP/IP Values

Specifies TCP/IP socket communication for links between the HDL simulator and Simulink software. For TCP/IP socket communication on a single computing system, the <tcp_spec> parameter of matlabcp or matlabtb can consist of just a TCP/IP port number or service name. If you are setting up communication between computing systems, you must also specify the name or Internet address of the remote host.

If the HDL simulator and MATLAB are running on the same system, the TCP/IP specification identifies a unique TCP/IP socket port to be used for the link. If the two applications are running on different systems, you must specify a remote host name or Internet address in addition to the socket port. See Specifying TCP/IP Socket Communication for more detail in specifying TCP/IP values.

The following table lists different ways of specifying tcp_spec.

FormatExample
<port-num>4449
<port-alias>matlabservice
<port-num>@<host>4449@compa
<host>:<port-num>compa:4449
<port-alias>@<host-ia>matlabservice@123.34.55.23

An example of a matlabcp call using port 4449 might look like this:

> matlabcp u_osc_filter -mfunc oscfilter -socket 4449

A remote connection might look like this:

> matlabcp u_osc_filter -mfunc oscfilter -socket computer93:4449

TCP/IP Services

By setting up the MATLAB server as a service, you can run the service in the background, allowing it to handle different HDL simulator client requests over time without you having to start and stop the service manually each time. Although it makes less sense to set up a service for the Simulink software as you cannot really automate the starting of an HDL simulator service, you might want to use a service with Simulink to reserve a TCP/IP socket port.

Services are defined in the etc/services file located on each computer; consult the User's Guide for your particular operating system for instructions and more information on setting up TCP/IP services.

For remote connections, the service name must be set up on both the client and server side. For example, if the service name is "matlabservice" and you are performing a Windows-Linux cross-platform simulation, the service name must appear in the service file on both the Windows machine and the Linux machine.

  


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