Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


Lesson 5 - Running a batch-mode simulation


The goals for this lesson are:

Batch-mode allows you to execute several commands that are written in a text file. You create a text file with the list of commands you wish to run, and then specify that file when you start ModelSim. This is particularly useful when you need to run a simulation or a set of commands repeatedly.


Important: Batch-mode simulations must be run from a DOS or UNIX prompt. In Windows, you get a DOS prompt by selecting Start > Programs > Command Prompt. Unless directed otherwise, enter all commands in this lesson at a DOS or UNIX prompt.

  1. To set up for this lesson you'll need to create a new directory and make it the current directory. Copy this file into your new directory:

  2. 
    \<install_dir>\modeltech\examples\counter.vhd  
    
    
  3. Create a new design library (Remember, enter these commands at a DOS or UNIX prompt):

  4. 
    vlib work 
    
    
  5. Map the library:

  6. 
    vmap work work 
    
    
  7. Then compile the source file:

  8. 
    vcom counter.vhd 
    
    
  9. You will use a macro file that provides stimulus for the counter. For your convenience, a macro file has been provided with ModelSim. You need to copy this macro file from the installation directory to the current directory:

  10. 
    <install_dir>\modeltech\examples\stim.do  
    
    
  11. Create a batch file using an editor; name it yourfile. With the editor, put the following on separate lines in the file:

  12. 
    add list -decimal *
    do stim.do
    write list counter.lst 
    
    

and save to the current directory.

  1. To run the batch-mode simulation, enter the following at the command prompt:

  2. 
    vsim -do yourfile -wlf saved.wlf counter 
    
    

This is what you just did in Step 7:

  1. Since you saved the simulation results in saved.wlf, you can view the simulation results by starting up VSIM with its -view switch:

  2. 
    vsim -view saved.wlf 
    
    
  3. Open these windows with the View menu in the Main window, or the equivalent command at the ModelSim prompt:

  4. 
    view signals list wave

    Note: If you open the Process or Variables windows they will be empty. You are looking at a saved simulation, not examining one interactively; the logfile saved in saved.wlf was used to reconstruct the current windows.

  5. Now that you have the windows open, put the signals in them:

  6. 
     add wave *
     add list * 
    
    
  7. Use the available windows to experiment with the saved simulation results and quit when you are ready:

  8. 
     quit -f 
    
    

For additional information on the batch and command line modes, please refer to the ModelSim User's Manual.


Model Technology Inc.
Model Technology Incorporated
Voice: (503) 641-1340
Fax: (503)526-5410
www.model.com
sales@model.com
Table of Contents Previous page Next page Index

ModelSim