![]() |
![]() |
![]() |
![]() |
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.
- 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:
\<install_dir>\modeltech\examples\counter.vhd- Create a new design library (Remember, enter these commands at a DOS or UNIX prompt):
vlib work- Map the library:
vmap work work- Then compile the source file:
vcom counter.vhd- 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:
<install_dir>\modeltech\examples\stim.do- Create a batch file using an editor; name it yourfile. With the editor, put the following on separate lines in the file:
add list -decimal * do stim.do write list counter.lstand save to the current directory.
- To run the batch-mode simulation, enter the following at the command prompt:
vsim -do yourfile -wlf saved.wlf counterThis is what you just did in Step 7:
- invoked the VSIM simulator on a design unit called "counter"
- instructed the simulator to save the simulation results in a log file named saved.wlf by using the -wlf switch
- used the contents of yourfile to specify that values are to be listed in decimal, to execute a stimulus file called stim.do, and to write the results to a file named counter.lst, the default for a design named counter
- Since you saved the simulation results in saved.wlf, you can view the simulation results by starting up VSIM with its -view switch:
vsim -view saved.wlf- Open these windows with the View menu in the Main window, or the equivalent command at the ModelSim prompt:
view signals list wave
- Now that you have the windows open, put the signals in them:
add wave * add list *- Use the available windows to experiment with the saved simulation results and quit when you are ready:
quit -fFor additional information on the batch and command line modes, please refer to the ModelSim User's Manual.
![]() Model Technology Incorporated Voice: (503) 641-1340 Fax: (503)526-5410 www.model.com sales@model.com |
![]() |
![]() |
![]() |
![]() |