vsim - Start and configure ModelSim for use with EDA Simulator Link™ MQ

Syntax

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

Description

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

After you call this function, you can use EDA Simulator Link MQ command extensions to perform the following actions:

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 path name 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
'rundir', 'dirname'

Specifies where to run ModelSim. By default, the function uses the current working directory.

The following conditions apply to this name/value pair:

'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. See Specifying TCP/IP Values for some valid tcp_spec examples.

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.

'startms', ['yes' | 'no']

Determines whether ModelSim is launched from vsim. The default is yes, which launches ModelSim and creates a startup Tcl file. If startms is set to no, ModelSim is not launched, but a startup Tcl file is still created.

This startup Tcl file contains pointers to MATLAB libraries. To run ModelSim on a machine without MATLAB, copy the startup Tcl file and MATLAB library files to the remote machine and start ModelSim manually. See Using the EDA Simulator Link™ MQ Libraries.

'libdir', 'directory'

Specifies the directory containing MATLAB library files. This property creates an entry in the startup Tcl file that points to the directory with the libraries needed for ModelSim to communicate with MATLAB when ModelSim is running on a machine that does not have MATLAB.

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 the 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')
 
  


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