Technical data

Tcl examples
ModelSim EE/PLUS Reference Manual Using Tcl
-
519
Tcl examples
The following Tcl/Model
Sim
example shows how you can access system
information and transfer it into VHDL variables or signals and Verilog nets or
registers. When a particular HDL source breakpoint occurs, a Tcl function is
called that gets the date and time and deposits it into a VHDL signal of type
STRING. If a particular environment variable (DO_ECHO) is set, the function
also echoes the new date and time to the transcript file by examining the VHDL
variable.
(in VHDL source):
signal datime : string(1 to 28) := " ";# 28 spaces
(on VSIM command line or in macro):
proc set_date {} {
global env
set do_the_echo [set env(DO_ECHO)]
set s [exec date]
force -deposit datime $s
if {do_the_echo} {
echo "New time is [examine -value datime]"
}
}
bp src/waveadd.vhd 133 {set_date; continue}
--sets the breakpoint to call set_date
lecho
(p324) takes one or more Tcl lists as arguments and pretty-prints
them to the VSIM Main window
lshift
(p327) takes a Tcl list as argument and shifts it in-place one place
to the left, eliminating the 0th element
lsublist
(p328) returns a sublist of the specified Tcl list that matches the
specified Tcl glob pattern
printenv
(p345) echoes to the VSIM Main window the current names and
values of all environment variables
Command Description