24.03.2013 Views

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

ModelSim SE User's Manual - Electrical and Computer Engineering

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

UM-472 20 - Tcl <strong>and</strong> macros (DO files)<br />

Introduction<br />

Tcl features within <strong>ModelSim</strong><br />

Tcl References<br />

<strong>ModelSim</strong> <strong>SE</strong> User’s <strong>Manual</strong><br />

This chapter provides an overview of Tcl (tool comm<strong>and</strong> language) as used with<br />

<strong>ModelSim</strong>. Macros in <strong>ModelSim</strong> are simply Tcl scripts that contain <strong>ModelSim</strong> <strong>and</strong>,<br />

optionally, Tcl comm<strong>and</strong>s.<br />

Tcl is a scripting language for controlling <strong>and</strong> extending <strong>ModelSim</strong>. Within <strong>ModelSim</strong> you<br />

can develop implementations from Tcl scripts without the use of C code. Because Tcl is<br />

interpreted, development is rapid; you can generate <strong>and</strong> execute Tcl scripts on the fly<br />

without stopping to recompile or restart <strong>ModelSim</strong>. In addition, if <strong>ModelSim</strong> does not<br />

provide the comm<strong>and</strong> you need, you can use Tcl to create your own comm<strong>and</strong>s.<br />

Using Tcl with <strong>ModelSim</strong> gives you these features:<br />

comm<strong>and</strong> history (like that in C shells)<br />

full expression evaluation <strong>and</strong> s upport for all C-language operators<br />

a full range of math <strong>and</strong> trig functions<br />

support of lists <strong>and</strong> arrays<br />

regular expression pattern matching<br />

procedures<br />

the ability to define your own comm<strong>and</strong>s<br />

comm<strong>and</strong> substitution (that is, comm<strong>and</strong>s may be nested)<br />

robust scripting language for macros<br />

Two books about Tcl are Tcl <strong>and</strong> the Tk Toolkit by John K. Ousterhout, published by<br />

Addison-Wesley Publishing Company, Inc., <strong>and</strong> Practical Programming in Tcl <strong>and</strong> Tk by<br />

Brent Welch published by Prentice Hall. You can also consult the following online<br />

references:<br />

Select Help > Tcl Man Pages.<br />

The Model Technology web site lists a variety of Tcl resources:<br />

www.model.com/resources/tcltk.asp

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!