FPGA学习笔记7-Quartus II其余的部分TCL指令

Agenda
-Other Tcl Scripting Commands
-Accessing Command Line Options
-Using Tcl in Quartus II Software
-Getting More Help

::quartus::misc Package
-Utility and Miscellaneous Commands
Loaded by Default in Every Executable
-Some Commonly Used Commands
escape_brackets
post_message

escape_brackets Command
-Many Quartus II Tcl Commands Allow Regular Expressions in Option Arguments
-Improperly Escaping Bus Names Is a Common Error
address\[10\]
Regular Expression Matches address0 or address1
-Square Brackets Must Be Escaped Twice
address\\\[10\\\]
-Use escape_brackets Command For Convenience
-Example:Get All Location Assignments for Bus address[]
Example:
set address_names "address\[*\]"
set address_locations [get_all_instance_assignments \
    -to [escape_brackets $address_names] -name LOCATION]

post_message Command
-Formats Text Like Quartus II Message Types
-Specify Message Type and Text
info,extra_info,warning,critical_warning,error

Tcl Collections
-Some Tcl Commands Return Large Sets of Data
-Collection Is Container for Large Data Sets
Specific to Quartus II Tcl API
-Access Collection Elements with foreach_in_collection Command
Same Syntax as foreach Tcl Command
-Packages with Commonds that Return Collections Include foreach_in_collection
-No Need to Load Separate Package

Tcl Collection Example
-Print Details of All Instance Assignments
set instance_assignments [get_all_instance_assignments -name *]
foreach_in_collection instance $instance_assignments {
  set sect_id[lindex $instance 0]
  set src[lindex $instance 1]
  set dest[lindex $instance 2]
  set name[lindex $instance 3]
  set value[lindex $instance 4]
  puts "Section ID ($sect_id)"
  puts "Source ($src)"
  puts "Destination ($dest)"
  puts "Assignment Name ($name)"
  puts "Assignment value ($value)"
}

Access Command-Line Options
-Quartus II Version 4.1 Supports argv,argc,and argv0
Earlier Versions Pass Arguments in quartus(args) Variable
quartus(args) Still Supported
Version 4.1 VariableEarlier Version Equivalent
argvquartus(args)
argcllength $quartus(args)
argv0info nameofexecutable

Command-Line Options Example
-cmdline Package Provides Flexible Access to Command-Line Options
More Robust than Hard-Coded Indexing into List of Command_Line Options
Include with Quartus II

-Example with cmdline Package

quartus_sh -t myscript.tcl -project my_project -revision second
-Open Project with Optional Revision Name
package require cmdline
set options {\
         {"project.arg""""Project Name"}\
         {"revision.arg""""Revision Name"}\
}
array set optshash [::cmdline::getoptions ::argv $options "Options:"]
if{[string equal "" $optshash(revision)]}{
  #No revision is specified
  project_open $optshash(project)
}else{
  project_open $optshash(project) -revision $optshash(revision)
}
#The rest of your script follows here

Using Tcl in Quartus II
-Command-Line Executables
Batch Mode to Execute Script Files
Interactive Shell
Quick Tcl Evaluation of Command Arguments
-Tcl Console in GUI
Interactive Shell
View Menu(View->Unity windows->Tcl console)

Using Tcl at the Command Line
-Run Script File
quartus_sh -t <script file> [<script arguments>]
quartus_sh -t myscript.tcl Stratix
-Interactive Tcl Shell
quartus_sh -s
-Direct Tcl Evaluation
quartus_sh --tcl_eval <tcl command>
quartus_sh --tcl_eval help -pkg flow
-Same Syntax for Other Executable

Running Tcl Scripts

-Command-Line Executables Supporting Tcl

NameCommon Uses
quartus_shAssignments,General Reporting,Compiling,Simple Shell
quartus_tanTiming Reporting,Advanced Timing Analysis
quartus_cdbBack Annotation,LogicLock Regions,Chip Editor Functions
quartus_simSimulate with Tcl Testbenches

Why Different Executables?
-Different Executables Support Different Functionality
Different Tcl Packages Available
-Example
quartus_cdb Supports LogicLock Functions,
Not Timing Analysis Functions
Basic Project Functions Supported by All
-Executable and Package Matrix in Tcl Script Chapter of Quartus II Handbook
Also Type help at Tcl Shell Prompt for List

Quartus II Tcl Scripts
-Tcl Scripts Included with Quartus II
Design Space Explorer(DSE)
QHelp Unility
QFlow Script
-Scripts Listed in Tcl Scripts (Tools menu)
-Modify to Suit Needs

Pop Quiz
-List Three Ways to Use Tcl Scripts and Commands with Quartus II software

Pop Quiz Answer
-Tcl Console in Quartus II GUI
-Interactive Tcl Shell in Command-Line Executable
Batch Mode of Command-Line Executables
Direct Execution Mode of Command-Line Executable
-Tcl Toolbar Buttions(Not Covered in Presentation)

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值