Technical data
Tcl/Tk and ModelSim
6-50 ModelSim EE/SE Tutorial
examples ready-to-run in the tcl_tutorial\solutions directory. Invoke these
commands from the ModelSim prompt to run the intersection:
cd solutions
do traffic.do
Viewing files
If you would like to view the source for any of the Tcl files in our examples, use
the notepad command at either the ModelSim or VSIM prompt.
notepad <filename>
Most files are opened in read-only mode by default; you can edit the file by
deselecting read only from the notepad Edit menu.
The Tcl source command
The Tcl source command reads the Tcl file into the Tcl interpreter, which parses
the procedures for use within the current environment. Once sourced, a Tcl
procedure can be called from the ModelSim prompt as shown in the syntax below.
VSIM executes the instructions within the procedure.
Syntax
source <tcl filename>
<tcl procedure name>
Arguments
<tcl filename>
The Tcl file read into the VSIM Tcl interpreter with the source command.
<tcl procedure name>
The Tcl procedure defined within <tcl filename>, called from the ModelSim prompt, and
executed by VSIM.
The traffic.do file is a good example of the source command syntax (the file is a
macro that runs the traffic light simulation). Check it out with the notepad:
notepad traffic.do
Example shortcuts
To save some typing, copy the commands from the PDF version of these
instructions and paste them at the ModelSim prompt. Paste with the right (2 button