Technical data

Tcl/Tk and ModelSim
ModelSim EE/SE Tutorial 6-55
and indicates the next line to be executed. (If the simulator is not evaluating an
executable process when the break occurs, the Source window will not open.)
Only the East/West lights are working. You can make both lights work by editing
the lights.tcl file.
6 Edit lights.tcl with the notepad to add a when statement for the North/South light.
notepad lights.tcl
You need to add this because the current statement is for the East/West light only.
You’ll find the solution commented. (Remember to change the read-only status of
the file so you can edit it.)
You’ll find the code commented-out toward the end of the file (try Edit >Find
again).
7 After you have made the changes, reload and run the simulation again.
source lights.tcl
connect_lights
Both lights are now working.
Note: Remember, if you need to return to the original Tcl files (maybe you’ve edited the file and it doesn’t
work right) you’ll find the files in the tcl_tutorial/originals directory.
Add widgets to display simulation information
Running the lights may be interesting, but not very useful - let’s add some displays
that will tell us what’s happening to the cars at the intersection.
Now you will add queue widgets to display the sum of the length of each pair of
queues as we simulate.
8 The East/West widget for displaying the total East/West queue length is already
provided. Let's edit the source to add a display for the North/South direction. Use the
notepad:
notepad queues.tcl
The solution is commented out in queues.tcl.
The Queue Display widget consists of an enclosing frame with two label widgets.
The first label is a simple text string. The second label is the value of the queue
length. The text in the second label will be updated whenever the queue lengths
change.