This brief tutorial will help you get started using QuestaSim in both GUI mode and command line mode. GUI mode should only be used when debugging interactively. The command line mode will be used for grading. Copy the following files to complete the tutorials: counter.sv and counter_tb.sv. You are encouraged to access the help documentation within QuestaSim to get more details about the tool.
- Starting vsim in GUI mode:
vsim
- Create a new project:
File > New > Project...
- Give it a name (e.g.,
counter
) - Choose a location for the project and click
OK
- This will create a directory for your project and create a ".mpf" file for the project settings and a directory called "work" where your compiled files will be stored. It will also create a new "project" tab in the main window.
- Give it a name (e.g.,
- Add files to the project:
Project > Add to Project > Existing File ...
- Add the files
counter.sv
andcounter_tb.sv
- Add the files
- Compile the files by selecting "Compile > Compile All"
- Start simulation by selecting "Simulate > Start Simulation"
- This will open the simulation window
- Expand "Work" in the "Design tab" and select "counter_test"
- Select "Optimization Options ..."
- Select "Apply full visibility to all modules (full debug mode)"
- Click "OK" to start
- This will change the window configuration for simulation view (waveforms, object view, etc.)
- In the "Objects" tab select a few signals to add to the waveform view
- Right-click on the signal and select "Add to Wave > Wave"
- Run the simulation by selecting "Simulate > Run > Run -All"
- View the simulation waveform
- Starting vsim in command line mode:
vsim -c
- Compile the example files:
vlog counter.sv counter_tb.sv
. This will create a directorywork
with the compiled files. - Start simulation:
vsim -c work.counter_tb -voptargs=+acc
- Run the simulation to the end:
run -all
Waveform editing quick key commands:
F
: Full waveform zoomI
: Zoom inO
: Zoom Out
You can create a .do
file that helps setup your waveforms when you run vsim.
This file can include dividers and waveforms before you start:
add wave -divider "Top"
add wave -position insertpoint \
sim:/tx_top_tb/tx_top/CLK100MHZ \
sim:/tx_top_tb/tx_top/BTNC
add wave -divider "tx"
add wave -position insertpoint \
sim:/tx_top_tb/tx_top/tx_data \
sim:/tx_top_tb/tx_top/tx_out \
sim:/tx_top_tb/tx_top/tx_out_d
add wave -divider "debouncer"
add wave -position insertpoint \
sim:/tx_top_tb/tx_top/db/debounce_out \
sim:/tx_top_tb/tx_top/db/debounce_counter
Commands:
exit
:examine
:
References:
Example
vlib work
vlog tx.sv
vlog -quiet tx_tb.sv
vlog rx_model.sv
vsim -c work.tx_tb -do "run -all"
Libraries for primitives
vmap unisims_ver /tools/Xilinx/Vivado/2024.1/data/questa/unisims_ver
vcom ../vhdl/seven_segment_display.vhd
vlog mmcm_top.sv
vlog /tools/Xilinx/Vivado/2024.1/data/verilog/src/glbl.v
vsim mmcm_top glbl -L unisims_ver
add wave -position insertpoint \
sim:/counter_tb/clk \
sim:/counter_tb/rst \
sim:/counter_tb/inc \
sim:/counter_tb/load \
sim:/counter_tb/din \
sim:/counter_tb/cnt