Skip to Main Content Skip to Search
Product Documentation

vsim - Start and configure ModelSim for use with HDL Verifier

Syntax

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

Description

vsim('PropertyName', 'PropertyValue'...) starts and configures the ModelSim simulator (vsim) for use with the MATLAB and Simulink features of HDL Verifier. The first folder in ModelSim matches your MATLAB current folder.

After you call this function, you can use HDL Verifier functions for the HDL simulator (for example, vsimmatlab, vsimulink) 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

'hdlsimdir'

Specifies the path name to the Cadence Incisive simulator executable to be started.

  • pathname

    Start a different version of the Cadence Incisive simulator or if the version of the simulator you want to run does not reside on the system path.

Default: The first version of the simulator that the function finds on the system path.

'libdir'

Creates an entry in the startup Tcl file that points to the folder containing MATLAB library files

  • folder

    Folder containing the libraries for ModelSim to communicate with MATLAB when ModelSim runs on a machine that does not have MATLAB.

'libfile'

Specifies a particular library file.

  • library_file_name

    . This value defaults to the version of the library file that was built using the same compiler that MATLAB itself uses. If the HDL simulator links other libraries, including SystemC libraries, that were built using a compiler supplied with the HDL simulator, you can specify an alternate library file with this property. See HDL Verifier Libraries for versions of the library built using other compilers.

'pingTimeout'

Time to wait, in seconds, for the HDL simulator to start.

  • seconds

    Specify 0 (the default) to immediately return without waiting.

'rundir'

Specifies where to run ModelSim.

  • dirname

    By default, the function uses the current working folder.

    The following conditions apply to this name/value pair:

    • If the value of dirname is "TEMPDIR", the function creates a temporary folder in which it runs ModelSim.

    • If you specify dirname and the folder does not exist, you will get an error.

'runmode'

Specifies how to start the HDL simulator.

  • mode

    You can set run mode to the following valid values:

    • 'Batch': Start the HDL simulator in the background with no window (Linux) or in a non-interactive command window (Windows).

    • 'CLI': Start the HDL simulator in an interactive terminal window.

    • 'GUI': Start the HDL simulator with the ModelSim graphical user interface.

    This value defaults to 'GUI'.

'socketsimulink'

Specifies TCP/IP socket communication for links between ModelSim and Simulink.

  • tcp_spec

    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.

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

    If ModelSim and Simulink run 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 do not specify -socket <tcp-spec> on the command line.

      Note   The function applies the communication mode specified by this property to all invocations of Simulink from ModelSim.

'startms'

Determines whether ModelSim will launch from vsim.

  • yes | no

    This property defaults to yes, which launches ModelSim and creates a startup Tcl file. If startms is set to no, ModelSim does not launch, but the HDL simulator still creates a startup Tcl file.

    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 HDL Verifier Libraries.

'startupfile'

Specifies Tcl script for startup.

  • pathname

    Each invocation of vsim creates a Tcl script that, when executed, compiles and launches the HDL simulator. By default, this function generates the filename of compile_and_launch.tcl in the folder specified by rundir.. With this property, you can specify the name and location of the generated Tcl script. If the file name already exists, that file's contents are overwritten. You can edit and use the generated file in a regular shell outside of MATLAB. For example:

    sh> vsim -gui -do compile_and_launch.tcl

'tclstart'

Specifies one or more Tcl commands to execute after ModelSim launches.

  • tcl_commands

    Specify a command string or a cell array of command strings.

'vsimdir'

Specifies the path name to the ModelSim simulator executable (vsim.exe) to be started.

  • pathname

    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.

Examples

The following function call sequence changes the folder 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 folder. The 'tclstart' property specifies a Tcl command that loads an instance of a VHDL entity for MATLAB verification:

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

The following function call sequence changes the folder location to VHDLproj and then calls the function vsim.

>>cd VHDLproj  % Change folder to ModelSim project folder
>>vsim('tclstart','vsimulink work.parse','socketsimulink','4449')
 
  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

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