The biggest advantage of Modelsim's Tcl is that it allows the entire simulation to run automatically, saving you from the trouble of performing various user interface control operations each time. With TCL, You can automatically create databases, map databases to physical directories, and compileSource code, Start the simulator, run the simulation and a series of other operations.
The following describes the operation steps based on the instance:
1. Compile the source file. Including camera. V and its test.pdf file camera_tb.v
2. Compile the. Do file (camera_tb.do) with the following content:
# Create the work Library
Vlib work
Vmap work
# Compile the OpenGL files
Vlog-Work work camera. v
Vlog-Work work camera_tb.v
# Run simulation
Vsim-lib work camera_tb
View Wave
Add wave SIM:/camera_tb /*
Run 55 ms
3. Compile A. bat batch file for running the entire Modelsim simulation in Windows cmd. The source code is as follows:
Vsim-Do camera_tb.do
Save the file as camera_tb.bat.
4. Run camera_tb.bat in Windows cmd.
Note: The preceding files (camera_tb.do, camera_tb.bat) should be stored in the corresponding project directory.
In the project directory, click camera_tb.bat to run the program.
The DOS window is displayed as follows:
The simulation results are as follows:
The following information is displayed in the Command window:
During debugging, If you modify the source file and need to re-run the simulation, you only need to enter the do camera_tb.do command in the Command window and press enter to automatically complete the simulation process again, very convenient.
In addition, if the DOS window is closed, Modelsim is also closed, and the two are correlated.