Technical data
Tcl/Tk and ModelSim
6-46 ModelSim EE/SE Tutorial
ModelSim generates Tcl commands and passes them to the Tcl parser for
execution. Commands may be generated by reading characters from an input
source, or by associating command strings with ModelSim’s user interface
features, such as menu entries, buttons, or keystrokes.
When the Tcl library receives commands it parses them into component fields and
executes built-in commands directly. For commands implemented by ModelSim,
Tcl calls back to the application to execute the commands. In many cases
commands will invoke recursive invocations of the Tcl interpreter by passing in
additional strings to execute (procedures, looping commands, and conditional
commands all work in this way).
ModelSim gains a programming advantage by using Tcl for its command
language. ModelSim can focus on simulation-specific commands, while Tcl
provides many utility commands, graphic interface features, and a general
programming interface for building up complex command procedures.
By using Tcl, ModelSim need not re-implement these features, a benefit that
allows it’s graphic interface to remain consistent on all platforms. (The only
vestige of the host platform’s graphic interface is the window frame manager.)