Technical data

Tcl/Tk and ModelSim
120
-
ModelSim EE Lessons ModelSim EE Tutorial
Solutions to the examples
Throughout the traffic intersection examples you will be modifying Tcl files to
complete the final intersection. You will find a completed set of intersection
examples ready-to-run in the
tcl_tutorial/solutions
directory. Invoke these
commands from the Model
Sim
prompt to run the intersection:
cd solutions
do traffic.do
Viewin
g
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 Model
Sim
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 Model
Sim
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 Model
Sim
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