Questa* Intel® FPGA Edition Simulation User Guide

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

3.3.5. Complete Tcl Script Example

In the following complete Tcl script example, the design consists of two design files, top.sv and ip1.sv. The testbench consists of one file, test1.sv, with the top-level testbench module name of test.

There are two tcl scripts: comp.tcl that only compiles the source files, and the top-level script sim.tcl, that sources comp.tcl and then elaborates the testbench module and runs simulation.

comp.tcl creates the logical library design_lib, compiles design files into design_lib, and compiles the testbench file test1.sv into the work library.

Content of comp.tcl

vlib /usr/sim/design_lib_dir
vmap design_lib /usr/sim/design_lib_dir
vlog -sv -work design_lib top.sv ip1.sv
vlog -sv test1.sv

sim.tcl sources comp.tcl to compile the source files, runs vsim with the voptargs=”+acc” argument to preserve all signals, then specifies that all signal waveforms must be captured. Finally sim.tcl runs simulation without a time limit.

Content of sim.tcl:

source comp.tcl
vsim -t ps -voptargs=”+acc” test
add wave -r /*
run -all
quit

To run sim.tcl in the GUI and see the live simulation waveforms, you run the following command at the terminal:

vsim -do sim.tcl