Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


Add "scale" widgets to control the simulation

Next you will add Tk "scale" widgets that will control the arrival rates and the length of the lights.

  1. The East/West widget for controlling the East/West queue inter-arrival time is provided. You'll edit the source code to add controls for the North/South direction. Use this command:

  2. 
    notepad controls.tcl 
    
    

You can remove the comments in the code to make this change.

Similarly, add the North/South widget for controlling the length of the lights. The East/West widget for light control is provided. (You can remove the comments in the code to make this change as well.)

These control widgets are implemented using the Tk "scale" widgets, enclosed in a frame.

When the value of the scale widget changes, it calls the command specified with the command option on each scale.

  1. After you have added your North/South widgets, run your program with this command:

  2. 
    source controls.tcl 
    draw_controls 
    
    

Now you have a complete intersection interface. Try the run buttons and the slider scales.

You can view the simulation with ModelSim's GUI. Check the Source window to view the VHDL files, and add signals to a Wave window (add wave *).

You can also change the run length in the Main window. Try using the Run buttons in the Main window and the intersection window.

Keep the intersection simulation running to complete the next example. If you want to recreate the final intersection environment quickly, invoke these commands from the ModelSim prompt (after "Initial setup" ):

cd solutions
vmap work work
do traffic.do


Model Technology Inc.
Model Technology Incorporated
Voice: (503) 641-1340
Fax: (503)526-5410
www.model.com
sales@model.com
Table of Contents Previous page Next page Index

ModelSim