Skip to content

HOWTO: Using pre compiled libraries on ModelSim or Questa

Andre Souto edited this page Jan 14, 2020 · 1 revision

Using pre compiled libraries on ModelSim/Questa

Analytics

You don't need to include vendor libraries' HDL sources on the config file to make HDL Checker aware of them -- they can be picked up automatically.

For this example, we'll use $LIBRARIES to refer to the path where the libraries are.

  1. The contents of this folder should be something similar to

    $ tree $LIBRARIES
    $LIBRARIES
    ├── modelsim.ini
    ├── ahblite_axi_bridge_v3_0_10
    │   ├── _info
    │   ├── _lib1_0.qdb
    │   ├── _lib1_0.qpg
    │   ├── _lib1_0.qtl
    │   ├── _lib.qdb
    │   └── _vmake
    ├── axi4svideo_bridge_v1_0_6
    │   ├── _info
    │   ├── _lib1_0.qdb
    │   ├── _lib1_0.qpg
    │   ├── _lib1_0.qtl
    │   ├── _lib.qdb
    │   └── _vmake
    ├── axi_ahblite_bridge_v3_0_10
    │   ├── _info
    │   ├── _lib1_0.qdb
    │   ├── _lib1_0.qpg
    ...

    The modelsim.ini inside this directory should have the configuration needed to use the libraries inside $LIBRARIES.

    Side note: avoid using this file directly, ModelSim will change the ini file when adding libraries, so you might end up with a unusable setup! (you'll see in the next steps)

  2. We'll make a local ini file that will point to the correct one. To do that, open ~/modelsim.ini file with any editor and add the following (replace $LIBRARY with the actual path!)

    [Library]
    ; Replace with the actual path!
    others = $LIBRARY/modelsim.ini
  3. Save and exit

  4. To make ModelSim recognize this change, we'll use the MODELSIM environment variable. To check if things up to here are OK, we can use the vmap command (it's on ModelSim's path):

    • Before setting up

      $ vmap
      Reading modelsim.ini
      "std" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../std.
      "ieee" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../ieee.
      "verilog" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../verilog.
      "vital2000" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../vital2000.
      "std_developerskit" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../std_developerskit.
      "synopsys" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../synopsys.
      "modelsim_lib" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../modelsim_lib.
      "sv_std" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../sv_std.
    • After setting up (note the env variable)

      $ MODELSIM=~/modelsim.ini vmap
      Reading </content/of/$MODELSIM/variable>
      Reading </path/to/$LIBRARY/modelsim.ini>
      "secureip" maps to directory </$LIBRARY/secureip>.
      "unisim" maps to directory </$LIBRARY/unisim>.
      "unimacro" maps to directory </$LIBRARY/unimacro>.
      "unifast" maps to directory </$LIBRARY/unifast>.
      "unisims_ver" maps to directory </$LIBRARY/unisims_ver>.
      "unimacro_ver" maps to directory </$LIBRARY/unimacro_ver>.
      "unifast_ver" maps to directory </$LIBRARY/unifast_ver>.
      "simprims_ver" maps to directory </$LIBRARY/simprims_ver>.
      "xpm" maps to directory </$LIBRARY/xpm>.
      "v_frmbuf_wr_v1_0_0" maps to directory </$LIBRARY/v_frmbuf_wr_v1_0_0>.
      "gtwizard_ultrascale_v1_6_6" maps to directory </$LIBRARY/gtwizard_ultrascale_v1_6_6>.
      ...
      "std" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../std.
      "ieee" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../ieee.
      "verilog" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../verilog.
      "vital2000" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../vital2000.
      "std_developerskit" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../std_developerskit.
      "synopsys" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../synopsys.
      "modelsim_lib" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../modelsim_lib.
      "sv_std" maps to directory /opt/ModelSim/modelsim_ase/linuxaloem/../sv_std.
  5. Create an alias for your editor command (safe to add to ~/.bashrc or equivalent, avoid exporting the MODELSIM variable unless you know what you're doing)

    # Vim
    alias vim='MODELSIM=~/modelsim.ini vim'
    # VSCode
    alias code='MODELSIM=~/modelsim.ini code'
    # etc