Intel® Quartus® Prime Standard Edition User Guide: Third-party Simulation

ID 683080
Date 2/05/2024
Document Table of Contents

2.3. QuestaSim* Simulation Setup Script Example

The Intel® Quartus® Prime software can generate a msim_setup.tcl simulation setup script for IP cores in your design. The script compiles the required device library models, compiles the design files, and elaborates the design with or without simulator optimization. To run the script, type source msim_setup.tcl in the simulator Transcript window.
Alternatively, if you are using the simulator at the command line, you can type the following command:
vsim -c -do msim_setup.tcl

In this example the custom top-level simulation script sets the hierarchy variable TOP_LEVEL_NAME to top_testbench for the design, and sets the variable QSYS_SIMDIR to the location of the generated simulation files.

# Set hierarchy variables used in the IP-generated files
set TOP_LEVEL_NAME "top_testbench"
set QSYS_SIMDIR "./ip_top_sim" 
# Source generated simulation script which defines aliases used below
source $QSYS_SIMDIR/mentor/msim_setup.tcl 
# dev_com alias compiles simulation libraries for device library files
# com alias compiles IP simulation or Platform Designer model files and/or Platform Designer model files in the correct order
# Compile top level testbench that instantiates your IP
vlog -sv ./ 
# elab alias elaborates the top-level design and testbench
# Run the full simulation
run - all

In this example, the top-level simulation files are stored in the same directory as the original IP core, so this variable is set to the IP-generated directory structure. The QSYS_SIMDIR variable provides the relative hierarchy path for the generated IP simulation files. The script calls the generated msim_setup.tcl script and uses the alias commands from the script to compile and elaborate the IP files required for simulation along with the top-level simulation testbench. You can specify additional simulator elaboration command options when you run the elab command, for example, elab +nowarnTFMPC. The last command run in the example starts the simulation.