Questa* Intel® FPGA Edition Simulation User Guide

ID 730191
Date 4/01/2024
Public
Document Table of Contents

3.3.1.1. Compilation Example 1: Compile File foo.sv into a Logical Library

The following example compiles the foo.sv file that defines module my_foo into the my_lib logical library. The logical library is mapped to physical directory /tools/libraries/my_lib.
  1. Create the library directory by running the vlib Tcl command:
    vlib /tools/libraries/my_lib

    The command creates the directory /tools/libraries/my_lib and adds a Questa* Intel® FPGA Edition proprietary file to the directory indicating that it is a library directory.

  2. Map logical library my_lib to the library directory /tools/libraries/my_lib by running the vmap Tcl command:
    vmap my_lib /tools/libraries/my_lib

    This command copies the modelsim.ini file from the Questa* Intel® FPGA Edition installation to a local directory (if a local modelsim.ini does not already exist), and adds the library mapping to modelsim.ini. View the library mapping by opening the modelsim.ini file and searching for my_lib. The mapping is a single line, such as the following:

    my_lib = /tools/libraries/my_lib
  3. Compile foo.sv to logical library my_lib by running the vlog Tcl command:
    vlog -sv foo.sv -work my_lib

    The -sv option specifies that the file type is SystemVerilog. After you run this command successfully, the /tools/libraries/my_lib directory contains the module definition of my_foo.

To run above steps 1 through 3, you first create and add the following lines to a run.do file:

vlib /tools/libraries/my_lib
vmap my_lib /tools/libraries/my_lib vlog -sv foo.sv -work my_lib
quit

The Tcl command quit exits the Tcl shell so that the vsim command can complete. Next, you can run one of the commands to invoke Questa* Intel® FPGA Edition, as Commands to Invoke Questa Intel FPGA Edition describes.

Note:
  • Alternatively, you can also type each Tcl command individually in the interactive Tcl shell that you launch by running vsim -c (or just vsim to invoke the GUI and the interactive Tcl shell).
  • Some Tcl commands, such as vlog, vcom, vlib, and vmap are also available as Linux and Windows commands.
  • For help on all vlog options, run vlog-help all. To get help on a specific option such as -suppress, run vlog -help -suppress.