没有合适的资源?快使用搜索试试~ 我知道了~
首页ug894-vivado-tcl-scripting.pdf
ug894-vivado-tcl-scripting.pdf
需积分: 42 229 浏览量
更新于2023-03-16
评论
收藏 2.88MB PDF 举报
ug894-vivado-tcl-scripting.pdfug894-vivado-tcl-scripting.pdfug894-vivado-tcl-scripting.pdfug894-vivado-tcl-scripting.pdf
资源详情
资源评论
资源推荐

Vivado Design Suite
User Guide
Using Tcl Scripting
UG894 (v2016.3) October 5, 2016
UG894 (v2016.4) November 30, 2016

Using Tcl Scripting 2
UG894 (v2016.3) October 5, 2016
www.xilinx.com
Revision History
The following table shows the revision history for this document.
Date Version Revision
10/05/2016 2016.3 Added a section about Sharing Hook Scripts Between Steps. The section describes
how to use the Tcl variable ACTIVE_STEP within a hook script to generate report files
with unique file names for each implementation step.
Added this Note in the Getting Objects by Relationship section:
Note:
If an empty list of objects is passed through -of_objects, then the get_* command
returns an empty Tcl list.
In the Persistency of Objects section, added that if you execute commands that rely
on a Vivado object that no longer exists in memory, this could lead to unexpected
results or a system crash.
06/08/2016 2016.2 No technical updates. Re-release only.
04/06/2016 2016.1 Updated screen displays throughout manual to reflect latest (2016.1) versions of
Vivado and the Tcl Store GUI.
Added the following sections to describe additional Tcl scripting features:
• Calling External Programs
• Vivado GUI/Tcl Modes Versus Batch Mode
Added the following sections to describe new features of the Xilinx Tcl Store:
• Accessing the Source Code
• Searching the Tcl Store
• Xilinx Tcl Store Support
Send Feedback
Send Feedback
UG894 (v2016.4) November 30, 2016
11/30/2016: Released with Vivado® Design Suite 2016.4 without changes from the previous version.

Using Tcl Scripting www.xilinx.com 3
UG894 (v2016.3) October 5, 2016
Table of Contents
Revision History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
A Brief Overview of Tcl . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Platform Specific Tcl Behaviors. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Compilation and Reporting Example Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Loading and Running Tcl Scripts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Writing a Tcl Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Accessing Design Objects. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Handling Lists of Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
Redirecting Output . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Controlling Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Accessing Environment Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
Calling External Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Vivado GUI/Tcl Modes Versus Batch Mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Creating Custom Design Rules Checks (DRCs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
Xilinx Tcl Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Tcl Scripting Tips. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Appendix A: Additional Resources and Legal Notices
Xilinx Resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Solution Centers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Documentation Navigator and Design Hubs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Training Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Please Read: Important Legal Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Send Feedback
Send Feedback
UG894 (v2016.4) November 30, 2016

Using Tcl Scripting 4
UG894 (v2016.3) October 5, 2016
www.xilinx.com
Tcl Scripting in Vivado
Introduction
The Tool Command Language, or Tcl, is an interpreted programming language with
variables, procedures, and control structures, to interface to a variety of design tools and to
the design data.
Note:
For more information, see the Vivado Design Suite Tcl Command Reference Guide (UG835)
[Ref 1], or type <command> -help.
Note: For information on launching and using the Vivado® Design suite, see the Vivado Design
Suite User Guide: Getting Started (UG910) [Ref 2]
The language is easily extended with new function calls, so that it has been expanded to
support new tools and technology since its inception and adoption in the early 1990s. It has
been adopted as the standard application programming interface, or API, among most EDA
vendors to control and extend their applications.
Xilinx® has adopted Tcl as the native programming language for the Vivado Design Suite,
as it is easily adopted and mastered by designers familiar with this industry standard
language. The Tcl interpreter inside the Vivado Design Suite provides the full power and
flexibility of the Tcl language to control the application, access design objects and their
properties, and create custom reports. Using Tcl, you can adapt your design flow to meet
specific design challenges.
The Tcl language provides built-in commands to read and write files to the local file system.
This enables you to dynamically create directories, start FPGA design projects, add files to
the projects, run synthesis and implementation. You can customize the reports generated
from design projects, on device utilization and quality of results, to share across the
organization.
You can also use the Tcl language to implement new design approaches, or work around
existing problems, inserting and deleting design objects, or modifying properties as
needed. You can write scripts to replay established portions of your design flow to
standardize the process.
Many of the Tcl commands discussed in the following text and script examples are specific
to the Vivado Design Suite. You can find detailed information regarding Vivado specific Tcl
Send Feedback
Send Feedback
UG894 (v2016.4) November 30, 2016

Using Tcl Scripting 5
UG894 (v2016.3) October 5, 2016
www.xilinx.com
A Brief Overview of Tcl
commands in the Vivado Design Suite Tcl Command Reference Guide (UG835) [Ref 1], or in
the Help system of the Vivado tools.
The Vivado IDE uses Xilinx Design Constraints (XDC) to specify the design constraints. XDC
is based on a subset of all the Tcl commands available in Vivado and is interpreted exactly
like Tcl. The XDC commands are primarily timing constraints, physical constraints, object
queries and a few Tcl built-in commands: set, list, and expr. For a complete description
of the XDC commands, see Appendix B of the Vivado Design Suite User Guide: Using
Constraints (UG903) [Ref 3]. Unlike Tcl scripts, XDC files are managed by the Vivado IDE so
that any constraint edited through the graphical interface or the Timing Constraints Editor
can be saved back to its original XDC file. For this reason, only XDC commands can be used
in a XDC file. If you need to use other Tcl commands to write your constraints, you must use
a Tcl script.
The Vivado tools write a journal file called vivado.jou into the directory from which
Vivado was launched. The journal is a record of the Tcl commands run during the session
that can be used as a starting point to create new Tcl scripts.
A log file, vivado.log is also created by the tool and includes the output of the commands
that are executed. Both the journal and log file are useful to verify which commands were
run and what result they produced.
Additional Tcl commands are provided by the Tcl interpreter that is built into the Vivado
Design Suite. For Tcl built-in commands, Tcl reference material is provided by the Tcl
Developer Xchange website, which maintains the open source code base and
documentation for Tcl, and is located at http://www.tcl.tk
See http://www.tcl.tk/man/tcl8.5/tutorial/tcltutorial.html [Ref 8] for an introductory tutorial
to the Tcl programming language. Also see the Tclers Wiki located at http://wiki.tcl.tk
for
some example scripts.
In this document you will see some examples of Tcl commands and Tcl scripts, and the
results that are returned by the Vivado Design Suite when these commands are run. The
commands and their return values appear with the following formats:
• Tcl commands and example scripts:
puts $outputDir
• Output to Tcl Console or results of Tcl commands:
./Tutorial_Created_Data/cpu_output
A Brief Overview of Tcl
A Tcl script is a series of Tcl commands, separated by new-lines or semicolons. A Tcl
command is a string of words, separated by blanks or tabs. The Tcl interpreter breaks the
Send Feedback
Send Feedback
UG894 (v2016.4) November 30, 2016
剩余103页未读,继续阅读















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0