![]() |
![]() |
![]() |
![]() |
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.doLet's make some changes to the light colors and transition arrows.
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.)
- 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.
- Note the "ModelSim EXAMPLE part 3" comments in the file. Change the active color from "black" to "purple".
- 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):
source state-machine.tcl draw_state_machineNotice 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 Incorporated Voice: (503) 641-1340 Fax: (503)526-5410 www.model.com sales@model.com |
![]() |
![]() |
![]() |
![]() |