2385 - Modelsim:  After executing the orc_cmpl.bat ModelSim VHDL library compilation script, why do I get errors about unexpanded library elements when I compile my design?

2385 - Modelsim:  After executing the orc_cmpl.bat ModelSim VHDL library compilation script, why do I get errors about unexpanded library elements when I compile my design?

The following  online software documents explain how  to compile the VHDL source library files for the stand-alone ModelSim flow:
  • from the  Lattice Diamond software tool: select Help-> Lattice Diamond Help. In the new pop-up web browser, select Simulting the Design -> Third-Party Simulators -> Performing Simulation with Mentor Graphics ModelSim 
  • from the  Lattice ispLEVER software tool: select Help-> ispLEVER Help. In the new pop-up web browser, select Design Flow User Guide -> Simulation  -> Third-Party Simulators -> Performing Simulation with Mentor Graphics ModelSim 

Per the information in the documents above, you can run the orc_cmpl.bat batch file to compile the VHDL source library files for the stand-alone ModelSim flow. This batch file is located in the following file path:


<install_path>\cae_library\simulation\vhdl\<architecture>\mti

For example, in the case of the Diamond 1.4 software and the machxo library, the path looks as follows:

C:\lscc\diamond\<diamond version>\cae_library\simulation\vhdl\machxo\mti

The script contains lines of the form:


vlib .\work

vmap MACHXO .\work

vcom -87 -explicit -work .\work ..\src\MACHXOCOMP.vhd


When you execute the batch file, your system will look under your system $PATH variable for a path containing the vlib.exe, vmap.exe, and vcom.exe commands and execute them.

Two possibilities arise:

  • The $PATH variable points to the same installation version as the standalone ModelSim MTI that you use when you later compile your design. In this case, the MACHXO compiled library ModelSim version is compatible with your simulation version. You should not expect any errors when you compile your design in the standalone ModelSim software tool.
  • The $PATH variable points to a different ModelSim installation version from the standalone ModelSim MTI that you use when you later compile your design. For example, the $PATH variable may point to C:\Modeltech_5.6a\win32 whereas you may be running your standalone ModelSim software from C:\Modeltech_6.5a\win32.  In this case, the MACHXO compiled library ModelSim version is incompatible with your simulation version. You should expect to get errors of the type:

# ** Error: ../../si5338_confA.vhd(294): (vcom-1195) Cannot find expanded name "machxo.vhi".

To avoid these errors:

    • You can edit the orc_cmpl.bat  file and explictly preprend the path to your version of the simulator to every command as shown below.

C:\modeltech_6.5a\win32\vlib .\work

C:\modeltech_6.5a\win32\vmap MACHXO .\work

C:\modeltech_6.5a\win32\vcom -87 -explicit -work .\work ..\src\MACHXOCOMP.vhd

    • You could also try refreshing the MACHXO library from within your simulator tool. The refresh process refreshes the library elements to match the version of the software you are using. You can do so  by typing the following in the command line section of your ModelSm sofware:

vcom -refesh -work <install_path>\cae_library\simulation\vhdl\<architecture>\mti\work

In the case of Diamond 1.4 software and the machxo library, the command looks as follows:

vcom -refesh -work C:\lscc\diamond\1.4\cae_library\simulation\vhdl\machxo\mti\work