AR #18226 - ModelSim (MXE, SE, PE) - Advanced tips for using ModelSim with Project Navigator

Search Answers Database


 

ModelSim (MXE, SE, PE) - Advanced tips for using ModelSim with Project Navigator

AR# 18226
Part Modelsim MXE
Last Modified 2005-03-14 00:00:00.0
Status Active
Keywords Xilinx, Edition, rerun, restart, wave, log, signals

Description

Keywords: Xilinx, Edition, rerun, restart, wave, log, signals

Urgency: Standard

General Description:
After getting comfortable with running ModelSim through Project Navigator, I have the following questions:

- How do I rerun the simulation without closing ModelSim?
- How do I add internal signals to the Wave window?
- How do I watch all signals during the simulation so that when I add a new signal to the Wave window I do not have to restart and rerun the simulation?
- How do I save my waveform settings and load them during the next simulation?

For general instructions on how to run a simulation using Project Navigator, please refer to (Xilinx Answer 18216).

Solution

To understand some of these advanced simulation tips, it is first important to understand how Project Navigator runs the simulation. When you double-click one of the simulate processes, Project Navigator creates a "DO" file that contains all of the necessary commands to compile the files, load the simulation, and run the simulation. Project Navigator then opens ModelSim and runs the DO file. The DO files created by Project Navigator have different extensions based on the type of simulation you are running:
<testbench_name>.fdo - behavioral simulation
<testbench_name>.ndo - Post-Translate simulation
<testbench_name>.mdo - Post-Map simulation
<testbench_name>.tdo - Post-PAR simulation
<testbench_name>.udo - User modifiable "do" file for adding addition commands

How do I rerun the simulation without closing MXE?
After running a simulation from Project Navigator, it is often necessary to change some of the files and rerun the simulation. You can do this without closing MXE by just rerunning the DO file. Usually, the easiest way to do this is to press the up arrow at the ModelSim prompt until you see the command that Project Navigator used to run the DO file. It will look like the following:
VSIM>do <testbench_name>.fdo
Press enter and the DO file will be rerun.

If you performed many commands in ModelSim and do not want to scroll up through all of the them, you can also rerun the DO file by clicking on Tools -> Execute Macro and then select the DO file that you want to run. You will need to change the file viewing type to All Files, because ModelSim looks for only ".do" and ".tcl" files by default.

How do I add internal signals to the Waveform window?
After running a simulation through Project Navigator, the ModelSim Structure, Signals, and Wave windows should be open. You can use the Structure window to navigate through the hierarchy of the design. When you select a piece of hierarchy, the signals associated with that block will appear in the Signals window. You can then select any signal or signals in the Signals window and then click Add -> Wave > Selected Signals. This will add the selected signals to the Wave window.

How do I store all signal transitions during the simulation so that when I add a new signal to the Wave window I do not have to restart and rerun the simulation?
By default, the only signal values that are maintained in memory are the signals that were already added to the Wave window before the simulation was run. If additional signals are added after the simulation was run, no values will be displayed for these signals in the Wave window. To change this behavior, you can use the following command to instruct ModelSim to retain all signal values in memory during the simulation:
log -r /*
You can add this command to the User DO file, "<testbench_name>.udo". Open the ".udo" file in the project directory and add the above command anywhere in the file. The ".udo" file is called inside all of the other DO files, so this command will automatically be used when running a simulation through Project Navigator.

How do I save my waveform settings and load them during the next simulation?
It is often necessary to make many modifications to the Waveform window. A user might add some additional signals, change the viewing radix, add dividers between signals, etc. After making all of the these changes, it is helpful to save these settings and load them next time the simulation is run.

To save the settings, click File -> Save Format in the Wave window. Save the format as "<wave_name>.do". You can then get back to these settings in the Wave window by clicking File -> Load Format and selecting the DO file.

There are also a couple of options that allow this DO file to be loaded automatically when running a simulation from Project Navigator. The easiest way to do this is to call the DO file inside the User DO file, "<testbench_name>.udo". Open the ".udo" file in the project directory and add the following command:
do <wave_name>.do
The ".udo" file will be called by all of the other DO files created by ISE, so these Wave settings will be loaded each time a simulation is run in this project. The only problem with this method is that automatic DO file created by ISE will still load the default waveforms. Therefore, you will get all of the signals that you saved plus the default signals. This can clutter up the waveform window.

To prevent Project Navigator from loading the default signals to the waveform window, you will need to create a custom DO file. Follow the steps below:
1. Copy the automatic DO file created by ISE and give it a new name. For instance, if you are running a behavioral simulation and your testbench is named "top_tb," make a copy of "top_tb.fdo" and rename it to "top_tb_custom.do".
2. Open the copy in a text editor.
3. Comment out the call to the ".udo" file:
## <testbench_name>.udo
4. Comment out the "add wave *" command:
## add wave *
5. After the "## add wave *" add a new line that calls the saved waveform settings:
do <wave_name>.do
6. Optionally, add the "log -r /*" command after the line from step 5 (see above for more information on log -r /*).
7. In Project Navigator, right-click the Simulate Process and select Properties.
8. Uncheck Use Automatic Do File.
9. Check "Use Custom Do File" and select the custom DO file that you created.

After performing this, Project Navigator will always use the custom DO when this process is run. The automatic DO file will still be used for the other simulation processes. These steps must be redone for other simulation processes if necessary. Also, if any files are added or deleted from the project, the custom DO file needs to be modified appropriately. This can be done manually, or you can reselect the "Use Automatic DO file" option and let Project Navigator make a new template for you.

Here is an example of what a custom DO file might look like:

vlib work
vcom -93 -explicit top.vhd
vcom -93 -explicit top_tb.vhw
vsim -t 1ps -lib work top_tb
## do top_tb.udo
view wave
## add wave *
do wave.do
log -r /*
view structure
view signals
run -all
 
 
/csi/footer.htm