User`s manual

ModelSim Xilinx Users Manual Tcl and ModelSim 10-239
10 - Tcl and ModelSim
Chapter contents
Tcl features within ModelSim . . . . . . . . . . . . . . . 240
Tcl References . . . . . . . . . . . . . . . . . . . 240
Tcl commands . . . . . . . . . . . . . . . . . . . 241
Tcl command syntax . . . . . . . . . . . . . . . . 242
if command syntax . . . . . . . . . . . . . . . . . 245
set command syntax . . . . . . . . . . . . . . . . 246
Command substitution . . . . . . . . . . . . . . . . 247
Command separator. . . . . . . . . . . . . . . . . 247
Multiple-line commands . . . . . . . . . . . . . . . 247
Evaluation order . . . . . . . . . . . . . . . . . 247
Tcl relational expression evaluation . . . . . . . . . . . . 248
Variable substitution . . . . . . . . . . . . . . . . 248
System commands . . . . . . . . . . . . . . . . . 249
List processing . . . . . . . . . . . . . . . . . . . 249
VSIM Tcl commands . . . . . . . . . . . . . . . . . 250
ModelSim Tcl time commands . . . . . . . . . . . . . . . 250
This chapter provides an overview of Tcl (tool command language) as used with
ModelSim. Additional Tcl and Tk (Tcls toolkit) can be found through several Tcl
online references
(10-240).
Tcl is a scripting language for controlling and extending ModelSim. Within
ModelSim you can develop implementations from Tcl scripts without the use of C
code. Because Tcl is interpreted, development is rapid; you can generate and
execute Tcl scripts on the fly without stopping to recompile or restart VSIM. In
addition, if VSIM does not provide the command you need, you can use Tcl to
create your own commands.