Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
dsd1-10 / dsd-07=Verilog / esug.pdf
Скачиваний:
94
Добавлен:
05.06.2015
Размер:
1.38 Mб
Скачать

Ambit BuildGates Synthesis User Guide

A

Using Tcl within ac_shell and pks_shell

This appendix is a quick-start to the Tcl language and discusses ac_shell and pks_shell conventions that are beyond the scope of the Tcl language.}

This appendix contains the following information:

The Tcl Language on page 212

Procedures on page 212

Tcl Variables and Control Structures on page 213

Tcl Commands on page 216

Error Handling on page 219

There are several good texts on Tcl, including:

Practical Programming in Tcl and Tk by Brent B. Welch, Prentice Hall Publishing Company

Tcl and the Tk Toolkit and TCL Reference by John K. Ousterhout, Addison-Wesley Publishing Company

Tcl and the Tk Toolkit is shipped with Ambit® BuildGates® synthesis. In addition, the web site www.scriptics.com provides full documentation and open source Tcl/Tk scripting language and offers professional development tools, services and extensions for Tcl.

Note: In BuildGates synthesis syntax, curly braces indicate that you must make a choice from a list of arguments separated by OR-bars (see the Preface for clarification). In the Tcl language, curly braces mean that the text within the braces are to be interpreted verbatim. To distinguish between the two functions of the braces, Tcl braces are presented in bold type in this appendix.

September 2000

211

Product Version 4.0

Ambit BuildGates Synthesis User Guide

Using Tcl within ac_shell and pks_shell

The Tcl Language

The Tcl language contains very few rules and most of the complexity that exists can be deferred until needed (such as substitution rules or regular expression matching). The ac_shell and pks_shell use Tcl as their command and extension languages.

Tcl is based on character strings. A Tcl command is a list of string arguments, and each command returns a string. At this time, Tcl treats numbers as strings until they are evaluated. This will change in future Tcl versions.

Procedures

A fundamental advantage of Tcl is support for user-defined procedures, which correlate with built-in Tcl commands, such as set and if, and ac_shell commands, such as read_verilog and do_optimize.

Note: The method used to add ac_shell commands to the interface is the same method used to interactively define a procedure, except that the ac_shell commands are statically compiled, and some are bound to C code instead of Tcl code.

For larger designs containing many lines of script, writing this procedurally makes the code easier to maintain. For example:

ac_shell> source my_proc.tcl ac_shell> my_read_library ac_shell> my_set_constraints

where my_proc.tcl contains the two procedures or commands: proc my_read_library {} {

#…commands…

}

proc my_set_constraints {} {

# …commands…

}

When sourcing my_proc.tcl, no action occurs. Two new Tcl commands are added to the existing body of built-in commands and ac_shell commands. When the commands are invoked, the Tcl engine interprets their code.

September 2000

212

Product Version 4.0

Соседние файлы в папке dsd-07=Verilog