2.3. ModelSim Simulation Setup Script Example
vsim -c -do msim_setup.tcl
# 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
# dev_com alias compiles simulation libraries for device library files
# com alias compiles IP simulation or Qsys model files and/or Qsys model files in the correct order
# Compile top level testbench that instantiates your IP
vlog -sv ./top_testbench.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.