Starting ModelSim for Use with MATLAB

Start ModelSim directly from MATLAB by calling the MATLAB function vsim. This function starts and configures the ModelSim simulator (vsim) for use with the MATLAB feature of the Link for ModelSim. By default, the function starts the first version of the simulator executable (vsim.exe) that it finds on the system path (defined by the path variable), using a temporary DO file that is overwritten each time ModelSim starts.

You can customize the DO file that starts ModelSim by specifying the call to vsim with the following property name\property value pairs:

To...Specify...
Include one or more Tcl commands in the DO file that are to execute after ModelSim launches'tclstart', 'tcl_commands', where tcl_commands is a command string or cell array of command strings, which can include the matlabtb and matlabtbevalModelSim commands that initialize the simulator for a test bench session (see Initializing the Simulator for a MATLAB Test Bench Session)
Start a specific version of the simulator or a version of the simulator that is not on the system path'vsimdir', 'pathname', where pathname identifies the path and file name for the version of the simulator executable you want to launch
Create a DO file for future reference or use'startupfile', 'pathname', where pathname specifies a path and file name for the generated DO file

The following example changes the directory location to VHDLproj and then calls the function vsim. Because the command line omits the 'vsimdir' and 'startupfile' properties, vsim creates a temporary DO file. The 'tclstart' property specifies Tcl commands that load and initialize the ModelSim simulator for test bench instance modsimrand.

cd VHDLproj
vsim('tclstart',...
 'vsimmatlab modsimrand; matlabtb modsimrand 10 ns -socket 4449')


Learn more about the latest releases of MathWorks products:

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