Table of Contents Previous page Next page Index

ModelSim Documentation Bookcase

Model Technology Inc.


Example 4 - Draw a state machine that represents the simulation

In this final example you will draw a state machine representing the simulation, and connect it to the state signal inside the traffic light controller. Each transition that the controller makes is displayed as it happens.

The intersection environment from the previous example needs to be running for this example. To get it running quickly, invoke these commands from the ModelSim prompt (after "Initial setup" ).

cd solutions
do traffic.do 
  1. Run the state machine with these commands:

  2. 
    source state-machine.tcl 
    draw_state_machine 
    
    

Let's make some changes to the light colors and transition arrows.

  1. Open the source file with this command:

  2. 
    notepad state-machine.tcl 
    
    

Note the "ModelSim EXAMPLE part 1" comments in the file. You can change "both_red" state coordinates from x = 125 and y = 50 to any coordinates. (You may need to uncheck the read only selection in the Edit menu before making changes.)

  1. Note the "ModelSim EXAMPLE part 2" comments in the file. You can change the transition arrow coordinates to correspond with the new "both_red" state coordinates.

  2. Note the "ModelSim EXAMPLE part 3" comments in the file. Change the active color from "black" to "purple".

  3. Reuse the original commands when you're ready to run the state machine (remember, to copy a previous command to the current command line, select the previous ModelSim prompt):

  4. 
    source state-machine.tcl 
    draw_state_machine 
    
    

Notice the changes. Try some additional changes if you wish.

This is the end of the Tcl/Tk examples. Continue to modify and test the examples if you wish; you can recover the original files at any time in the
tcl_tutorial\originals directory.


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