ModelSim Advanced Features Tutorial

CSE 372 (Spring 2007): Digital Systems Organization and Design Lab

This tutorial covers some advanced features of ModelSim that will make debugging much less painful. Before reading this tutorial, you should be familiar with the basic use of Modelsim, covered in this tutorial.

Note

The features and instructions contained in this tutorial apply to ModelSim XE III/Starter 6.1e.

Saving the Wave window format

When debugging a Verilog project with ModelSim, you will be working mostly with the Wave window. When ModelSim starts, the first thing you will probably do is adjust the zoom of the Wave window (the resolution) and change the radix of the signals. You may also add and position cursors, and add and examine signals that are not shown in the Wave window by default. Unfortunately, after debugging and making changes to your design, you must restart ModelSim, reverting all of the changes you made to the Wave window. However, by saving a wave format file, these changes can easily be reloaded.

To save the current format of your Wave window, click in the Wave window so it becomes the active window, then choose File -> Save. The Save Format dialog box will appear. Browse to a directory that makes sense (i.e. your project directory) and save the .do file.

save-format.jpg

You can now exit ModelSim, make changes to your design, and restart the simulation again. To reload the Wave window format, first clear the default signals from the Wave window by selecting them all (use shift-click) and pressing the Delete key. Then, with the Wave window activated, choose File -> Load. Find the .do file you saved and click Open to reload the Wave window with your signals, radices, cursors and zoom level intact. Alternatively, you can run "do <do-file>" on the VSIM command line (in the Transcript window), where <do-file> is the .do file you saved.

Quickly setting signal radices

To quickly set the radix for every signal in your Wave window, type the command "radix <type>" on the VSIM command line and press Enter. Possible values for <type> include "hex", "bin", and "dec".

Modifying and saving ModelSim options

ModelSim options can be set in the Tools -> Options menu. Some useful options are found under Wave Preferences. For example, unchecking the waveform popups option will disable the annoying popup boxes that appear when you hold the mouse over a waveform, and checking the waveform selection highlighting option will add a horizontal highlight bar to the currently selected waves. You may find other useful options by exploring the choices in the Options menu. As of ModelSim version 6.1e, these options are automatically saved to the local machine when ModelSim is closed, so you may have to set them each time you use a different machine.

ModelSim error messages

If you receive any error or warning messages when you start a simulation in ModelSim, more information about the error can be found by using the "verror <errno>" command. The error number should be given in the error or warning message. Note that some errors and warnings do not have detailed explanations.

verror.jpg

A detailed explanation of a ModelSim simulation warning. Note that this particular warning message can be ignored in your simulations.

Author: Peter Hornyack