Technical data

ModelSim EE/SE Tutorial 6-45
Lesson 6 - Tcl/Tk and ModelSim
This lesson is divided into several Tcl examples intended to give you a sense of
Tcl/Tk’s function within ModelSim. The examples include a custom simulation
interface created with Tcl/Tk. You must be using ModelSim /PLUS or ModelSim
/VHDL to complete these exercises.
The goals for this lesson are:
Example 1 - Create a "hello world" button widget. (p52)
Example 2 - Add a procedure that gets called by a button push. (p52)
Example 3 - Simulate an intersection with traffic lights. (p53)
Example 4 - Draw a state machine that represents the simulation. (p57)
More information on Tcl/Tk
Tcl print references
Sources of information about Tcl include Tcl and the Tk Toolkit by John K.
Ousterhout, published by Addison-Wesley Publishing Company, Inc., and
Practical Programming in Tcl and Tk by Brent Welch published by Prentice Hall.
Tcl online references
The following are a few of the many Tcl references available:
• When using ModelSim make this VSIM Main menu selection: Help > Tcl Man
Pages.
• Tcl man pages are also available at: www.elf.org/tcltk-man-html/contents.htm
• Tcl/Tk general information is available from the Tcl/Tk Consortium:
www.tclconsortium.org
• The Scriptics Corporation, John Ousterhout’s company (the original Tcl
developer): www.scriptics.com
.
How Tcl/Tk works with ModelSim
ModelSim incorporates Tcl as an embedded library package. The Tcl library
consists of a parser for the Tcl language, routines to implement the Tcl built-in
commands, and procedures that allow Tcl to be extended with additional
commands specific to ModelSim.