vsim

Start and configure ModelSim for use with the Link for ModelSim

Syntax

vsim('PropertyName', 'PropertyValue'...)

Description

vsim('PropertyName', 'PropertyValue'...) starts and configures the ModelSim simulator (vsim) for use with the MATLAB and Simulink features of the Link for ModelSim. The initial directory in ModelSim matches your MATLAB current directory.

After you call this function, you can use ModelSim commands to

The property name/property value pair settings allow you to customize the Tcl commands used to start ModelSim, the vsim executable to be used, the path and name of the DO file that stores the start commands, and for Simulink applications, details about the mode of communication to be used by the applications.

Property Name/Property Value Pairs

'tclstart', 'tcl_commands'

Specifies one or more Tcl commands to execute after ModelSim launches. Specify a command string or a cell array of command strings.

'vsimdir', 'pathname'

Specifies the pathname to the ModelSim simulator executable (vsim.exe) to be started. By default, the function uses the first version of vsim.exe that it finds on the system path (defined by the path variable) . Use this option to start different versions of the ModelSim simulator or if the version of the simulator you want to run does not reside on the system path.

'startupfile', 'pathname'

Specifies a DO macro file that defines the behavior of the ModelSim commands vsimmatlab and vsimulink. The DO file consists of some general-purpose Tcl commands for launching ModelSim and any commands you specify with the 'tclstart' property. If you omit this property, the function creates a temporary file that is overwritten each time ModelSim starts. If you specify a name for the DO file, later you can use the file to start ModelSim from the command line as shown in the following syntax:

vsim -gui -do do_file

'socketsimulink', 'tcp_spec'

Specifies TCP/IP socket communication for links between ModelSim and Simulink. For TCP/IP socket communication on a single computing system, the tcp_spec 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. 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

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

If ModelSim and Simulink are running on the same computing system, you have the option of using shared memory for communication. Shared memory is the default mode of communication and takes effect if you omit –socketsimulink tcp_spec from the function call.

Examples

The following function call sequence changes the directory location to VHDLproj and then calls the function vsim. Because the call to vsim omits the 'vsimdir' and 'startupfile' properties, vsim uses the default vsim executable and creates a temporary DO file in a temporary directory. The 'tclstart' property specifies a Tcl command that loads an instance of a VHDL entity for MATLAB verification.

cd VHDLproj  % change directory to ModelSim project directory
vsim('tclstart','vsimmatlab work.parse; matlabtb parse 10 ns
-socket 4449')

The following function call sequence changes the directory location to VHDLproj and then calls the function vsim. Because the call to vsim omits the 'vsimdir' and 'startupfile' properties, vsim uses the default vsim executable and creates a DO file in a temporary directory. The 'tclstart' property specifies a Tcl command that loads the VHDL entity parse in library work for cosimulation between vsim and Simulink. The 'socketsimulink' property specifies that TCP/IP socket communication on the same computer is to be used for links between Simulink and ModelSim, using socket port 4449:

cd VHDLproj  % change directory to ModelSim project directory
vsim('tclstart','vsimulink work.parse','socketsimulink','4449',)
 


Learn more about the latest releases of MathWorks products:

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