Set Up for HDL Cosimulation

To cosimulate your HDL code with a MATLAB® or Simulink® design, you must first:

  • Decide how to connect your HDL simulator with MATLAB or Simulink. You may have one or multiple HDL modules in a cosimulation setup. The modules are represented by matlabcp and matlabtb functions for MATLAB, or by HDL Cosimulation blocks for Simulink. See Cosimulation Configurations.

  • Start the HDL simulator from MATLAB, or from a shell. You must use a shell for a cross-network simulation, such as if the HDL simulator runs on a different machine from your MATLAB host. Starting the simulator from MATLAB allows you to specify the library by name rather than exact path. See HDL Simulator Startup.

  • If you require a non-default library or customized library location, specify the library when you start the HDL simulator. If you start the HDL simulator from MATLAB, use the name of the library. If you start the HDL simulator from a shell, use the library path. See Cosimulation Libraries.

  • Optionally, use the configuration and diagnostic script to configure your library location and test the TCP/IP connection. This script is supported only for Linux® machines. For Windows® machines, you can create a configuration file. See Set Up Configuration and Run Diagnostics.

Cosimulation Configurations

There are several ways to connect your HDL simulator to a design in MATLAB or Simulink. You can run your HDL simulator on the same or different host machine as MATLAB. Each HDL simulator can connect to one or more functions in MATLAB, or one or more HDL Cosimulation blocks in a Simulink model. In a network configuration, to identify your application servers, use an Internet address and a TCP/IP socket port.

Note

  • An instance of MATLAB can run only one instance of the MATLAB server (hdldaemon) at a time.

  • Each HDL simulator must communicate with a unique instance of the MATLAB server.

  • Shared memory communication is an option for configurations that require only one communication link on a single computing system.

  • TCP/IP socket communication is required for configurations that use multiple communication links on one or more computing systems. Unique TCP/IP socket ports distinguish the communication links.

Valid Configurations for HDL Cosimulation with MATLAB

An HDL simulator session connected to a MATLAB function through a single instance of the MATLAB server.
An HDL simulator session connected to multiple MATLAB functions through a single instance of the MATLAB server.
An HDL simulator session connected to a MATLAB function through multiple instances of the MATLAB server. Each instance runs within the scope of a unique MATLAB session). This configuration is not supported by the Cosimulation Wizard.
Multiple HDL simulator sessions, each connected to a MATLAB function through multiple instances of the MATLAB server. Each instance runs within the scope of a unique MATLAB session.

Valid Configurations for Cosimulation with Simulink

An HDL Cosimulation block in a Simulink model connected to a single HDL simulator session.
Multiple HDL Cosimulation blocks in a Simulink model connected to the same HDL simulator session. This configuration is not supported by the Cosimulation Wizard. You can combine multiple HDL modules into a higher level module to include them in a single HDL Cosimulation block.
Multiple HDL Cosimulation blocks in a Simulink model connected to different HDL simulator sessions. HDL Cosimulation blocks in a Simulink model can connect to the same or different HDL simulator sessions. Each HDL Cosimulation block can communicate with only one HDL simulator.

HDL Simulator Startup

Before you start the HDL simulator, start the cosimulation server using the hdldaemon function.

You can start the HDL simulator from MATLAB, or from a shell. You must use a shell for a cross-network simulation, such as if the HDL simulator runs on a different machine from your MATLAB host. Starting the simulator from MATLAB allows you to specify the library by name rather than exact path.

Start the HDL Simulator from MATLAB

Each supported HDL simulator has a unique command that opens it from MATLAB.

Note

If you use the Cosimulation Wizard, you do not need to start the HDL simulator separately.

HDL SimulatorCommand to Open the SimulatorExample
Cadence Incisive® nclaunchStart Cadence Incisive from MATLAB
Mentor Graphics® ModelSim® vsimStart Mentor Graphics ModelSim from MATLAB

In either function, you can specify the HDL Verifier library, the design to load, the type of communication connection information and other required parameters as name-value pair arguments. No special setup is required. See Cosimulation Libraries.

This function starts and configures the HDL simulator for use with the HDL Verifier™ software. By default, the function starts the first version of the simulator executable that it finds on the system path, as defined by the path variable. This function uses a temporary file that is overwritten each time the HDL simulator starts.

You can customize the startup file and communication mode to be used between MATLAB or Simulink and the HDL simulator by specifying name-value pairs when you call the function. For property details, see nclaunch or vsim.

To start a different version of the simulator executable than the first one found on the system path, use the setenv and getenv MATLAB functions to set and get the environment of any subshells spawned by UNIX(), DOS(), or system().

If you specify a communication mode when you call one of the functions that open the HDL simulator, the specified mode applies to all HDL simulator sessions connected to either MATLAB or Simulink.

For more information on how HDL Verifier links the HDL simulator with MATLAB, see Linking with MATLAB and the HDL Simulator.

For a full cosimulation example that demonstrates starting the HDL simulator from MATLAB, see Verify HDL Module with MATLAB Test Bench.

To diagnose your cosimulation setup and customize your setup for future calls of the functions that open the HDL simulator, follow the process in Set Up Configuration and Run Diagnostics.

Start Cadence Incisive from MATLAB.  To start the Cadence Incisive HDL simulator from MATLAB, at the MATLAB command prompt, enter:

nclaunch('PropertyName', 'PropertyValue', ...)

This example changes the folder location to VHDLproj and then opens Incisive®. Because the command line omits the 'hdlsimdir' and 'startupfile' properties, nclaunch creates a temporary file. The 'tclstart' property specifies Tcl commands that load and initialize the HDL simulator for test bench instance modsimrand.

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

This example changes the folder location to VHDLproj and then opens Incisive. Because the function call omits the 'hdlsimdir' and 'startupfile' properties, nclaunch creates a temporary file. The 'tclstart' property specifies a Tcl command that loads the VHDL® entity parse in library work for cosimulation between nclaunch and Simulink. The 'socketsimulink' property specifies TCP/IP socket communication on the same computer, using port 4449.

cd VHDLproj
nclaunch('tclstart', 'hdlsimulink work.parse', 'socketsimulink', '4449')

Start Mentor Graphics ModelSim from MATLAB.  To start the Mentor Graphics ModelSim HDL simulator from MATLAB, at the MATLAB command prompt, enter:

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

This example changes the folder location to VHDLproj and then opens ModelSim. Because the vsim call omits the 'vsimdir' and 'startupfile' properties, the function creates a temporary DO file. The 'tclstart' property specifies Tcl commands that load and initialize the HDL simulator for test bench instance modsimrand.

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

This example changes the folder location to VHDLproj and then opens ModelSim. Because the vsim call omits the 'vsimdir' and 'startupfile' properties, vsim creates a temporary DO file. 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 TCP/IP socket communication on the same computer, using socket port 4449.

cd VHDLproj
vsim('tclstart','vsimulink work.parse','socketsimulink','4449')

This example includes Tcl commands that run HDL compilation and simulation when the ModelSim software starts up.

vsim('tclstart',{'vlib work','vlog +acc clocked_inverter.v hdl_top.v','vsim +acc hdl_top'});

This example loads the hdl_top module for Simulink cosimulation. The vsimulink command also specifies socket number 5678 for communication with HDL Cosimulation blocks in Simulink models, and specifies an HDL time precision of 10 ps. Specifying the socket this way is equivalent to using the socketsimulink property of the vsim function.

vsim('tclstart', …
             {'vlib work', 'vlog -voptargs=+acc clocked_inverter.v hdl_top.v', …
              'vsimulink hdl_top -socket 5678 -t 10ps'});

Start the HDL Simulator from a Shell

Before you start the HDL simulator from a shell and include the HDL Verifier libraries, first run the configuration script. The configuration file generated by the script persists for future cosimulation sessions. See Set Up Configuration and Run Diagnostics.

Start Cadence Incisive from a Shell.  If you already have a configuration file, in your shell window, run:

ncsim -f configfile modelname

configfile is the name of the configuration file. You must also specify the path to the configuration file, even if it resides in the same folder as vsim.exe. When you include the design_name argument, the ncsim.exe call also starts the simulation. You can also specify any other existing configuration files you are using.

Start Mentor Graphics ModelSim from a Shell.  If you already have a configuration file, in your shell window, run:

vsim design_name -f configfile

configfile is the name of the configuration file. You must also specify the path to the configuration file, even if it resides in the same folder as vsim.exe. When you include the design_name argument, the vsim call also starts the simulation.

The configuration file defines the -foreign option to vsim. This option loads the HDL Verifier shared library and specifies its entry point. You can also specify any other existing configuration files you are using.

If you do not use the generated config file, to load the client shared library and specify its entry point, open vsim with a command like this:

vsim design_name -foreign matlabclient /path/library

where path is the path to the HDL Verifier cosimulation library. See Cosimulation Libraries to find the applicable library name for your machine.

Note

You can also call this command from inside the HDL simulator.

Cosimulation Libraries

It is recommended to use the same compiler for all libraries linked into the same executable. HDL Verifier versions of the library for the compilers that the HDL simulators support. Using the same libraries helps the cosimulation software stay compatible with other C++ libraries that you might link into the HDL simulator, including SystemC libraries.

If any of these conditions apply, choose the version of the HDL Verifier library that matches the compiler used for that code:

  • You link other third-party applications into your HDL simulator.

  • You compile and link SystemC code as part of your design or test bench.

  • You link custom C/C++ applications into your HDL simulator.

If you do not link any other code into your HDL simulator, you can use any version of the supplied libraries. The function for opening the HDL simulator (nclaunch or vsim) chooses a default version of this library.

For examples on specifying HDL Verifier libraries when cosimulating across a network, see Cross-Network Cosimulation.

Library Naming Format

The HDL Verifier cosimulation libraries use the following naming format:

edalink/extensions/{version}/{arch}/lib{version_short_name}{client_server_tag}_{compiler_tag).{libext}
 
ArgumentIncisive ValuesModelSim Values
versionincisivemodelsim
archlinux64linux64, windows32, or windows64
version_short_name lfihdllfmhdl
client_server_tagMATLAB: c
Simulink: s
MATLAB: c
Simulink: s
compiler_taggcc41, gcc44

Linux: gcc433, gcc450vc12
Windows 32: gcc421vc12
Windows 64: gcc450vc12, tmwvs

Note

gcc450vc12 or gcc421vc12 requires Visual Studio® 2013 redistribute, available from Microsoft®.

libextsodll or so

Not all combinations are supported. See Default Libraries for valid combinations.

For more on MATLAB build compilers, see MATLAB Build Compilers.

Default Libraries

HDL Verifier scripts fully support the use of default libraries. The table lists the libraries shipped with HDL Verifier for each supported HDL simulator. The default libraries for each platform are in bold text.

Cadence Incisive Libraries

PlatformMATLAB LibrarySimulink Library
Linux 64

liblfihdlc_gcc41.so
liblfihdlc_gcc44.so

liblfihdls_gcc41.so
liblfihdls_gcc44.so

Mentor Graphics ModelSim Libraries

PlatformMATLAB LibrarySimulink Library
Linux 64

liblfmhdlc_gcc433.so
liblfmhdls_gcc450.dll

liblfmhdls_gcc433.so
liblfmhdls_gcc450.dll

Windows 32

liblfmhdlc_gcc421vc12.dll

liblfmhdls_gcc421vc12.dll

Windows 64liblfmhdlc_tmwvs.dll
liblfmhdlc_gcc450.dll
liblfmhdls_tmwvs.dll
liblfmhdls_gcc450.dll

Alternative HDL Simulator Libraries

You can use a different HDL-side library by specifying the libfile name-value pair when you call the nclaunch or vsim function. Choose the version of the library that matches the compiler and system libraries you are using for any other C/C++ libraries linked into the HDL simulator. Depending on the version of your HDL simulator, you might need to explicitly set additional paths in the LD_LIBRARY_PATH environment variable.

For example, to use a nondefault library:

  1. Copy the system libraries from the MATLAB installation to the machine with the HDL simulator. The system libraries are installed in matlabroot/sys/os.

  2. Modify the LD_LIBRARY_PATH environment variable to add the path to the copied system libraries.

Specify Alternate Library Using nclaunch.  This example shows library settings for an HDL simulation that links in a custom C++ application, compiled with gcc44. Therefore, the simulator must use the cosimulation libraries compiled with gcc44, instead of using the default library. Both MATLAB and Incisive are running on the same 64-bit Linux machine.

Modify the PATH variable so that the nclaunch function finds the desired version of the HDL simulator. Then, specify the library name with the libfile name-value pair. At the MATLAB command prompt, type:

currPath = getenv('PATH');
setenv('PATH',['/tools/IUS-1110/bin:' currPath]);
nclaunch('tclstart',{'exec ncvhdl -64bit inverter.vhd', ...
                     'exec ncelab -64bit -access +rwc inverter', ...
                     'hdlsimulink -gui inverter' }, ...
                     'libfile','liblfihdls_gcc44');

Verify the library resolution using ldd from within the ncsim console.

exec ldd /path/to/matlab/toolbox/edalink/extensions/incisive/linux64/liblfihdls_gcc44.so
        linux-vdso.so.1 =>  (0x00007fff2ffff000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f98361a0000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f9835e99000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f9835c16000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f9835a00000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9835676000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f983661c000)

Specify Alternate Library for Incisive Using System Shell.  This example shows how to start Incisive with an explicit option to specify the cosimulation library. You can start Incisive from a system shell on the same machine as MATLAB, on a different machine, or on a machine with a different operating system.

This example code runs on a 64-bit Linux version of Incisive. It does not matter what machine MATLAB is running on. Instead of using the default library in the Incisive distribution, this example uses the library compiled with GCC 4.4.

Modify the PATH variable to point to the desired version of the HDL simulator. Although ncsim finds any GCC libraries in the installation, this example changes the LD_LIBRARY_PATH to show how to use a custom installation of GCC. In a csh-compatible system shell, enter:

setenv PATH /tools/ius/lnx/tools/bin/64bit:${PATH}
setenv LD_LIBRARY_PATH /tools/ius/lnx/tools/systemc/gcc/4.4-x86_64/install/lib64:${LD_LIBRARY_PATH}
ncvhdl -64bit inverter.vhd
ncelab -64bit -access +rwc inverter
ncsim -tcl -loadvpi /tools/matlab/toolbox/edalink/extensions/incisive/linux64/liblfihdlc_gcc44:matlabclient inverter.vhd

You can check the library resolution using ldd, as in the previous example.

Specify Alternate Library Using vsim.  This example shows library settings for an HDL simulation that uses some SystemC applications, compiled with gcc450. You can download this version of GCC with its associated system libraries from Mentor Graphics. Therefore, the simulator must use the cosimulation libraries compiled with gcc450, instead of using the default library. Both MATLAB and ModelSim are running on the same 64-bit Linux machine.

Modify the PATH variable so that the vsim function finds the desired version of the HDL simulator. Modify theLD_LIBRARY_PATH because the HDL simulator does not add the path to the system libraries. Then, specify the library name with the libfile name-value pair. At the MATLAB command prompt, type:

currPath = getenv('PATH');
currLdPath = getenv('LD_LIBRARY_PATH');
setenv('PATH',['/tools/modelsim-10.1c/bin:' currPath]);
setenv('LD_LIBRARY_PATH',['/tools/modelsim-10.1c/gcc-4.5.0-linux/lib:' currLdPath]);
vsim('tclstart',{'vlib work','vcom inverter.vhd','vsimulink inverter'}, ...
       'libfile','liblfmhdls_gcc450');

Verify the library resolution using ldd from within the vsim GUI.

exec ldd /path/to/matlab/toolbox/edalink/extensions/modelsim/linux64/liblfmhdls_gcc450.so 
        linux-vdso.so.1 =>  (0x00007fff06652000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f505083d000)
        libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f5050536000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f50502b3000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f505009d000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f504fd13000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f5050cb8000)

Specify Alternate ModelSim Library Using System Shell.  This example shows how to start ModelSim with an explicit option to specify the cosimulation library. You can start ModelSim from a system shell on the same machine as MATLAB, on a different machine, or on a machine with a different operating system.

This example code runs on a 64-bit Linux version of ModelSim. It does not matter what machine MATLAB is running on. Instead of using the default library in the ModelSim distribution, this example uses the library compiled with GCC 4.5.0. You can download this version of GCC with its associated system libraries from Mentor Graphics.

Modify the PATH variable to point to the desired version of the HDL simulator. Modify theLD_LIBRARY_PATH because the HDL simulator does not add the path to the system libraries, unless you saved the GCC at the root of the ModelSim installation. In a csh-compatible system shell, enter:

setenv PATH /tools/questasim/bin:${PATH}
setenv LD_LIBRARY_PATH /tools/mtigcc/gcc-4.5.0-linux_x86_64/lib64:${LD_LIBRARY_PATH}
setenv MTI_VCO_MODE 64
vlib work
vcom +acc+inverter inverter.vhd
vsim +acc+inverter -foreign "matlabclient /tools/matlab/toolbox/edalink/extensions/modelsim/linux64/liblfmhdlc_gcc450.so" work.inverter

You can check the library resolution using ldd, as in the previous example.

Set Up Configuration and Run Diagnostics

If your HDL simulator is installed on UNIX® or Linux, you can use a guided setup script (syscheckmq for ModelSim and syscheckin for Incisive) to configure the MATLAB and Simulink connections to your simulator. This script works whether you have installed HDL Verifier and MATLAB on the same machine as the HDL simulator, or on different machines. The setup script creates a configuration file containing the location of the specified cosimulation libraries for MATLAB and Simulink. You can also use the setup script to help diagnose connection or library problems.

For Windows HDL simulators, you can manually create a configuration file, following the instructions in Create Configuration Files for Windows.

You can then include this file when you start your HDL simulator. You only need to run this script once.

You can find the setup scripts in this folder:

matlabroot/toolbox/edalink/foundation/hdllink/scripts

For more information on the libraries, see Cosimulation Libraries.

After you have created your configuration files, see Start the HDL Simulator from a Shell.

Run the Configuration and Diagnostic Script for UNIX or Linux

This example shows how to run the setup script, and test the TCP/IP connection, with these conditions:

  • You have installed HDL Verifier on a 64-bit Linux machine.

  • You have moved the HDL Verifier libraries to a different folder than the default installation. Or, you have moved them to a different machine than your MATLAB installation.

Cadence Incisive (syscheckin).  Start the script by typing syscheckin at a system prompt. The system returns the following information:

% syscheckin
********************************************************************************

Kernel name: Linux
Kernel release: 2.6.22.8-mw017
Machine: x86_64
********************************************************************************

The script first returns the location of the HDL simulator installation (ncsim.exe). If it does not find an installation, you receive an error message. Either provide the path to the installation or quit the script and install the HDL simulator. You are then prompted to accept this installation or provide a path to another one, after which you receive a message confirming the HDL simulator installation:

Found /hub/share/apps/HDLTools/IUS/IUS-61-tmw-000/lnx/tools/bin/64bit/ncsim on the path.
Press Enter to use the path we found or enter another one:

********************************************************************************

/hub/share/apps/HDLTools/IUS/IUS-61-tmw-000/lnx/tools/bin/64bit/ncsim -version
TOOL: ncsim(64) 06.11-s005
Cadence Incisive mode: 64 bits
********************************************************************************

Next, specify where the script can find the HDL Verifier libraries.

Select method to search for HDL Verifier libraries:
1. Use libraries in a MATLAB installation.
2. Prompt me to specify the direct path to the libraries.
2
Enter the path to liblfihdlc_gcc44.so and liblfihdls_gcc44.so:
tmp/extensions/incisive/linux64
Found /tmp/extensions/incisive/linux64/liblfihdlc_gcc44.so
and /tmp/extensions/incisive/linux64/liblfihdls_gcc44.so.

The script then runs a dependency checker to check for supporting libraries. If it cannot find the libraries, append your environment path to find them.

********************************************************************************

Running dependency checker "ldd /tmp/extensions/incisive/linux64/liblfihdlc_gcc44.so".
Dependency checker passed.
Dependency status:
     librt.so.1 => /lib/librt.so.1 (0x00002b6119631000)
     libstdc++.so.5 => /usr/lib/libstdc++.so.5 (0x00002b611973a000)
     libm.so.6 => /lib/libm.so.6 (0x00002b6119916000)
     libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00002b6119a99000)
     libc.so.6 => /lib/libc.so.6 (0x00002b6119ba6000)
     libpthread.so.0 => /lib/libpthread.so.0 (0x00002b6119de3000)
     /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)
********************************************************************************

Next, the script loads the HDL Verifier libraries and compiles a test module to verify that the libraries loaded as expected.

Press Enter to load HDL Verifier or enter 'n' to skip this test:

ncvlog(64): 06.11-s005: (c) Copyright 1995-2007 Cadence Design Systems, Inc.
define linux64 /work/matlab/toolbox/incisive/linux64
.
.
.
ncsim> exit

********************************************************************************

HDL Verifier libraries loaded successfully.
********************************************************************************

Then, the script checks for a TCP connection. If you skip this step, the configuration file specifies the use of shared memory. Both shared memory and socket configurations are in the configuration file. Depending on your choice, one configuration or the other is commented out.

Press Enter to check for TCP connection or enter 'n' to skip this test:

Enter an available port [5001]

Enter remote host [localhost]

Press Enter to continue

ttcp_glnx -t -p5001 localhost
Connection successful

Lastly, the script creates the configuration files. It creates files for both MATLAB and Simulink.

********************************************************************************

Press Enter to Create Configuration files or 'n' to skip this step:

********************************************************************************

Created template files simulink9675.arg and matlab8675.arg. Inspect and modify
if desired.
********************************************************************************

Diagnosis Completed

The file names are different each time you run this script.

After the script is complete, you can leave the configuration files where they are or move them to a convenient location. Now, use the file when you Start the HDL Simulator from a Shell.

Mentor Graphics ModelSim (syscheckmq).  Start the script by typing syscheckmq at a system prompt. The system returns the following information:

syscheckmq
********************************************************************************

Kernel name: Linux
Kernel release: 2.6.22.8-mw017
Machine: x86_64
********************************************************************************

The script first returns the location of the HDL simulator installation (vsim.exe). If it does not find an installation, you receive an error message. Either provide the path to the installation or quit the script and install the HDL simulator. You are then prompted to accept this installation or provide a path to another one, after which you receive a message confirming the HDL simulator installation.

Found /hub/share/apps/HDLTools/ModelSim/modelsim-6.4a-tmw-000/modeltech/bin/vsim
    on the path.
Press Enter to use the path we found or enter another one:

********************************************************************************

/hub/share/apps/HDLTools/ModelSim/modelsim-6.4a-tmw-000/modeltech/bin/vsim -version
Model Technology ModelSim SE-64 vsim 6.4a Simulator 2008.08 Aug 28 2008
ModelSim mode: 32 bits
********************************************************************************

Next, specify where the script can find the HDL Verifier libraries.

Select method to search for HDL Verifier libraries:
1. Use libraries in a MATLAB installation.
2. Prompt me to specify the direct path to the libraries.
2
Enter the path to liblfmhdlc_gcc450.so and liblfmhdls_gcc450.so:
/tmp/extensions/modelsim/linux64
Found /tmp/extensions/modelsim/linux64/liblfmhdlc_gcc450.so
and /tmp/extensions/modelsim/linux64/liblfmhdls_gcc450.so.

The script then runs a dependency checker to check for supporting libraries. If it cannot find the libraries, append your environment path to find them.

********************************************************************************

Running dependency checker "ldd /tmp/extensions/modelsim/linux64/liblfmhdlc_gcc450.so".
Dependency checker passed.
Dependency status:
        librt.so.1 => /lib/librt.so.1 (0x00002acfe566e000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00002acfe5778000)
        libm.so.6 => /lib/libm.so.6 (0x00002acfe5976000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00002acfe5af8000)
        libc.so.6 => /lib/libc.so.6 (0x00002acfe5c6000)
        /lib64/ld-linux-x86-64.so.2 (0x0000555555554000)
********************************************************************************

Next, the script loads the HDL Verifier libraries and compiles a test module to verify that the libraries loaded as expected.

Press Enter to load HDL Verifier or enter 'n' to skip this test:

Reading /hub/share/apps/HDLTools/ModelSim/modelsim-6.4a-tmw-000/se/modeltech/
    linux_x86_64/../modelsim.ini "worklfx9019" maps to directory worklfx9019. 
    (Default mapping)
Model Technology ModelSim SE-64 vlog 6.4a Compiler 2008.08 Aug 28 2008
-- Compiling module d9019

Top level modules:
        d9019

********************************************************************************

Reading /hub/share/apps/HDLTools/ModelSim/modelsim-6.4a-tmw-000/se/modeltech/tcl
    /vsim/pref.tcl 

# 6.4a

# vsim -do exit -foreign {matlabclient /tmp/lfmconfig/linux64/liblfmhdlc_gcc450.so} 
      -noautoldlibpath -c worklfx9019.d9019
# //  ModelSim SE-64 6.4a Aug 28 Linux 2.6.22.8-mw017
.
.
.
# Loading work.d9019
# Loading /tmp/lfmconfig/linux64/liblfmhdlc_gcc450.so
# exit 

********************************************************************************

HDL Verifier libraries loaded successfully.
********************************************************************************

Then, the script checks for a TCP connection. If you skip this step, the configuration file specifies the use of shared memory. Both shared memory and socket configurations are in the configuration file. Depending on your choice, one configuration or the other is commented out.

Press Enter to check for TCP connection or enter 'n' to skip this test:

Enter an available port [5001]

Enter remote host [localhost]

Press Enter to continue

ttcp_glnx -t -p5001 localhost
Connection successful

Lastly, the script creates the configuration files. It creates files for both MATLAB and Simulink.

********************************************************************************

Press Enter to Create Configuration files or 'n' to skip this step:

********************************************************************************

Created template files simulink9675.arg and matlab8675.arg. Inspect and modify
if desired.
********************************************************************************

Diagnosis Completed

The file names are different each time you run this script.

After the script is complete, you can leave the configuration files where they are or move them to a convenient location. Now, use the file when you Start the HDL Simulator from a Shell.

Create Configuration Files for Windows

The setup script does not run on Windows. However, if your HDL simulator runs on Windows, you can manually create configuration files. Only the ModelSim HDL simulator is supported for Windows.

The configuration file must contain the -foreign argument used for calls to vsim. Specify the path to the HDL Verifier shared library you want to call. See Cosimulation Libraries.The comment lines, marked with //, are optional.

For more information on the -foreign option, refer to the ModelSim documentation.

  • Create a MATLAB configuration file:

    //Command file for HDL Verifier MATLAB library
    //for use with Mentor Graphics ModelSim.
    //Loading of foreign Library, usage example: vsim -f matlab14455.arg entity.
    //You can manually change the following line to point to the applicable library.
    //The default location of the 32-bit Windows library is at
    //MATLABROOT/toolbox/edalink/extensions/modelsim/windows32/liblfmhdlc_gcc421vc12.dll.
    
    -foreign "matlabclient c:/path/liblfmhdlc_gcc421vc12.dll"
  • Create a Simulink configuration file:

    //Command file for  HDL Verifier Simulink library
    //for use with Mentor Graphics ModelSim.
    //Loading of foreign Library, usage example: vsim -f simulink14455.arg entity.
    //You can manually change the following line to point to the applicable library.
    //For example the default location of the 32-bit Windows library is at
    //MATLABROOT/toolbox/edalink/extensions/modelsim/windows32/liblfmhdls_gcc421vc12.dll.
    
    //For socket connection uncomment and modify the following line:
    -foreign "simlinkserver c:/path/liblfmhdls_gcc421vc12.dll  ; -socket 5001"
    
    //For shared connection uncomment and modify the following line:
    //-foreign "simlinkserver c:/path/liblfmhdls_gcc421vc12.dll"

    Note

    This example shows the -foreign syntax for both shared memory and socket connections. Comment out whichever type of communication you are not using. If you use a TCP/IP socket connection, confirm the port number used in this configuration file is available.

Save the configuration file to a convenient location. Now, use the file when you Start the HDL Simulator from a Shell.

See Also

Functions

Blocks

Related Topics