How to Compile Xilinx Libraries for ModelSim



In order to run simulations, the Xilinx libraries must first be compiled to work with ModelSim. Note: Once ModelSim has been installed, the computer should be rebooted once before trying this process.


Compiling the Xilinx Libraries for ModelSim


1. Run ISE Design Suite 14.x


2. Open a project - FCOM in this example. This can be done 2 different ways.

a. Select FILE -> OPEN PROJECT and then get the file at ..\bld\xc6slx16-2csg\KPU55.xise.

b. If the project has already been opened it my also be obtained by selecting FILE -> RECENT PROJECTS and then select it if it exists in the list.

3. Click on the FPGA type/name (i.e. xc6slx16-2csg225) to Highlight the FPGA target

FPGA target

4. Expand the Design Utilities if it is not already expanded.

Design Utilities

5. Right click on Compile HDL Simulation Library, and select Process Properties in the drop down menu


6 Set the following:


a. Set the -dir Compiled Library Directory to C:\Xilinx\14.7\ISE_DS\ISE\verilog\mti_se\10.1c\nt64. The ...\mti_se\10.1c\nt64 path is used becuase the SE version of ModelSim, version 10.1c, on a 64bit install is being used.

Note: Look at the C:\Xilinx\14.7\ISE_DS\ISE\verilog folder and notice it does not contain an mti_se folder. After compiling look again to verify all is correct and adjust if necessary

b. Set the -s Target Simulator to the correct version of ModelSim you are using (it may not be the one listed below)

c. Set the -l Language to Verilog



7. Click OK to save and then double click on Compile HDL Simulation Library and take a nap while waiting! It will tell you in the Console window panel when it has completed.


Setting up the SIMLIB and MSIM_PATH Environment Variable in Windows

SIMLIB and MSIM_PATH are environment variables I've created that facilitate project files and scripts that can be used by various users that use different versions of ModelSim simulators and locate information in different places on their computer.


SIMLIB is used in various ModelSim scripts used to run simulations on the design.  Take a look in the ..\sim folders at files with .do extensions (script files) and you will see this system variable being used. You must create this as an Environment Variable in Windows. To set this environment variable do the following in Win 7.


1. Open the Windows Advanced System Settings window

system settings window



2. Click on the Advanced system settings and the System Properties window will appear.

System Properties window


3. Click Environment Variables


Environment Variables window


4. Click on the New.. button for System Variables


New variable window


5. Add SIMLIB as name and C:\Xilinx\14.7\ISE_DS\ISE\verilog as the value and you should get the following in the Environment Variable window.
We are using the ..verilog subfolder as the root of where the compiled libraries will be put (see tutorial about compiling Xilinx libraries).



6. Now add the MSIM_PATH with value mti_se/10.1c/nt64 (should be your specific 64 bit install) in the System Variables. It should look as follows:

Later you will notice an MSIM_PATH in the ModelSim .do script files that are used to compile Verilog code for simulation. This path, along with SIMLIB creates the following path
to the compiled libraries that will be used.




If you chose a different version of ModelSim in the ISE project setup, then MSIM_LIB will be different.




7. Reboot the computer so settings take affect.