synopsy的Tcl脚本语言学习笔记
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
TCL脚本语言学习
(1)当输入的命令较长时,可以使用反斜线 \ 将一行命令分割为几行,例如:set target_library \
/home/fzz/synopsys/library/slow.db
上面的命令等价于set target_library /home/fzz/synopsys/library/slow.db
(2)缩略语命令:Synopsys的命令可以缩略到非含糊的形式,但是在脚本文件中应该少使用缩略命令,因为脚本文件在某些Synopsys的工具或者TCL中的命令易于发生变化,这种变化因为缩略而变得含糊。
(3)可以使用Synopsys中的“history”命令列举或者执行出先前使用过所有命令,例如:
dc_shell> history info 5
该命令将列举出最近执行过的5跳指令
dc_shell> history redo 4
该命令将执行在当前 dc_shell中执行过的命令中的第4条指令,这里面redo 后面的数据如不是有效的,则将重复执行最后输入的命令。
例如
dc_shell> history redo -4, -4 无效,将重复执行最后输入的有效指令
也可以采用快捷键的方式,输入“!!”命令,重新执行命令。
例如:
dc_shell> !!
set target_library /home/fzz/synopsys/library/slow.db
/home/fzz/synopsys/library/slow.db
能够重复执行某条指令可以使用
Dc_shell> !5
(4)以命令行方式获得help
使用-help 命令获得帮助
Dc_shell> echo –help
同样可以使用for命令获得help的所有命令,输入方式如下:
dc_shell> help for*
也可以获得特殊的命令组的所有命令的列表,通过输入命令集合的名字,例如:dc_shell> help procedures
使用man命令
也可以使用man命令获取Synopsys中获得帮助的相应命令,例如:
dc_shell > man query_objects
(5)Command Status
命令状态时命令返回值,所有的命令都返回一个一个字符串或者 null,默认时命令状态值返回控制窗口,例如:
dc_shell >set total_cells 0 ,这里定义了一个新的变量
dc_shell >incr total_cells
(6)Quoting 引用
使用quoting disable一些特殊字符的含义(例如:[],$ and ;)
dc_shell> set a 5; set b 10
10
dc_shell> echo {[expr $b - $a]} evaluates to [expr $b - $a]
[expr $b - $a] evaluates to 5
双引号标示特殊的较弱的quoting,使用举例如下:
dc_shell> Set A 10; set B 4
4
dc_shell> ech o “A is $A; B is $B.\nNet is [expr $A - $B].”
chapter 2 Tcl基础
Variables变量
dc_shell> set buf_name 1si_10K/B1I
1si_10K/B1I
dc_shell> set a 1
1
dc_shell> set b 2.5
Tcl中所有的变量都是字符串,Tcl不识别变量是整数或者实数的变量
dc_shell> set b 10
10
dc_shell> incr b
11
dc_shell> incr b -6
5
Incr的默认增加值是1,如果增加的不是整数值,那么则会报错,例如:
dc_shell> set b 2.4
2.4
dc_shell> incr b
Error …
为了查找一个变量是否存在,可以使用tcl的info exists命令,例如说,为了查看变量total_cells是否存在,键入:
dc_shell> info exists total_cells
如果变量存在,则info exists返回1,否则,返回0。
为了查看变量是否与特定的类型相匹配,使用Tcl的脚本info vars命令,例如
dc_shell> info vars total_c*
total_cells
数值变量的精度
数值变量的精度依赖于给变量所赋的值,如果使用小数点,则数值变量成为浮点数,否则成为整数。
整数变量可以看作是是十进制,八进制或者十六进制。
为了不产生不可预测的结果,在使用时,应该注意精度问题。
例如,在下面的例子中,除法操作产生不同的结果:
dc_shell> set a 10;set b = 4.0; set c 4
2.5
dc_shell> expr $a/$b;
2.5
dc_shell> expr $a/$c
2
第一个expr命令实现了浮点数除法,第二个expr命令实现了整数除法
变量置换variable substitution
使用变量置换实现变量值的接入,
dc_shell> set buf_name 1si_10K/B1I
1si_10K/B1I
dc_shell> echo $buf_name
1si_10K/B1I
Scripts脚本
脚本文件是由命令集合组成的,典型,这些命令存储在脚本文件中实现一组特殊的进程。
然而可以通过使用一个分号在shell中直接输入脚本而实现连续的命令。
添加注解:
Tcl中的注解是通过井字号#添加的,例如:
dc_shell> echo $buf_name # this is an inline comment
当命令中的延续字符”\”出现在注释行的最末时,后续的一行也被视为注释,例如在下面的例子中,任何set命令都不被执行
# set CLK_NAME Sysclk; set CLK_PERIOD 10; \
set INPUT_DELAY 2
导入并运行脚本文件
可以使用Synopsys中的source命令,例如脚本文件中包含一个名为mysession.tcl的文件,通过以下方式运行脚本文件
dc_shell> source mysession.tcl
当声明一个文件而没有直接的信息时,source命令检验路径
sh_source_uses_search_path以决定是否使用search_path中的值搜索文件,更多的内容,可以使用sh_source_uses_search_path和serch_path的帮助页面。
更改脚本输出端口的指向
当脚本文件执行时,可以使用synopsys的source命令,通过-echo和-verbose 显示命令和命令结果,例如:
dc_shell> source –echo –verbose myrun.tcl
同样可以通过使用管道操作符”>”将执行的结果保存在一个输出文件中,例如:
dc_shell> source –echo –verbose myrun.tcl > myrun.out
脚本文件举例:
set search_path {. /home/fzz/synopsys/dc200809/libraries/syn
/home/fzz/synopsys/dc200809/dw/syn_ver /home/fzz/synopsys/dc200809/dw /home/fzz/synopsys/library}
set link_library {* fast.db}
set target_library fast.db
set symbol_library smic18.sdb
set CLK_NAME Sysclk
set CLK_PERIOD 10
set INPUT_DELAY 2
set OUTPUT_DELAY 3
read_file -format verilog /home/fzz/Verilog_study/clock45.v
current_design
link
set_input_delay $INPUT_DELAY –clock $CLK_NAME[list [all_inputs]]
set_output_delay $OUTPUT_DELAY -clock $CLK_NAME [list [all_outputs]]
check_design
数据类型:
在数据类型中能够用到的数据类型有三种: String, Lists, Arrays
Synopsys工具支持colledtion 数据类型
Strings
String 是以字符的序列,Tcl将命令参数看做是字符串,并以字符串返回命令结果,下面是字符串的例子:
Sysclk “FF3 FF4 FF5”
大部分字符操作都是通过Tcl的字符命令操作,字符串的语法如下:
String option ? arg … ?
Lists
List是元素的有序集合,每个元素都可能是字符串或者是另一个List.可以使用list将一组cell instance组合起来。
可以创建简单的列表,通过双引号括起列举的元素,或者是通过使用Tcl列表命令,必须使用空格划定元素界限,而不用逗号。
例如,创建D输入引脚的cell instance例子的list
set D_pins "I1/FF3/D I1/FF4/D I1/FF5/D"
set D_pins {I1/FF3/D I1/FF4/D I1/FF5/D}
set D_pins [list I1/FF3/D I1/FF4/D I1/FF5/D]
也可以使用list创建特殊的混合链表,例如下面的例子中所创建的链表包含三种元素,其中每一个都是list:
set compound_list [list {x y} {1 2.5 3.75 4} {red green blue}]
对于其中某个元素的引用使用下面的语法:
dc_shell> echo [lindex $D_pins 1]
I1/FF4/D
dc_shell> echo [lindex $compound_list 1]
1 2.5 3.75 4
Arrays
Tcl使用联合阵列,这种阵列使用任意的字符串,能够包含数字以及相应的指数,联合阵列包含的元素,每个元素都有其名字以及相应的值。
为了引用一个一个阵列元素,需要使用下面的形式:
array_name(element_name)
例如,你可以创建报告文件中的阵列如下:
dc_shell> set vio_rpt_ext(ir_drop) .volt
.volt
dc_shell> set vio_rpt_ext(curr_dens) .em
.em
dc_shell> set vio_rpt_ext(curr) .current
.curren
第一个set 命令将创建 vio_rpt_ext阵列,同时设置ir_drop元素为.volt,下图给出了阵列的相应结构
Element names element values
Ir_drop .volt
Curr_dens .em
Curr .current
下面的例子将打印出curr_dens的元素
dc_shell> echo $vio_rpt_ext(curr_dens)
.em
也可以使用size和names命令打印出vio_rpt_ext阵列的大小和名字:
dc_shell> array size vio_rpt_ext
3
dc_shell> array names vio_rpt_ext
curr curr_dens ir_drop
control flow 控制流
Tcl中使用的数据流控制命令有if ,while,for,foreach,break ,continue 以及switch以确定命令的执行顺序
if和Switch命令提供一种方式选择可执行的脚本块,while for ,foreach 提供了一种方式重复执行脚本块,break和continue命令形结合用在环回时改变正常的执行顺序。
使用if命令:
If命令要求两个参数,此外还可以扩展至使用elseif 和else参数,所要求的参数:
判定表达式,
基于表达式结果附有条件执行的脚本
If命令执行时的基本形式:
if(expression){
script
}
如果表达式的结果不为0,则脚本将被执行。
if 命令可以包含一个或多个 elseif分支和一个最终的else分支,一elseif 分支要求有两个额外的参数,表达式和脚本
例如下面的语句计算0 到 10 的平方:
for {set p 0} {$p <= 10} {incr p} {echo "$p squared is: [expr $p * $p]"}
使用foreach命令
Foreach命令在列表的元素之间迭代,它有三个参数:变量名,列表,可执行的脚本。
foreach命令有如下的形式:
foreach var $somelist{script}
下面的例子foreach命令将简单list中的元素打印出来
dc_shell> set mylist {I1/FF3/D I1/FF4/D I1/FF5/D}
I1/FF3/D I1/FF4/D I1/FF5/D
dc_shell> foreach i $mylist {echo $i}
I1/FF3/D
I1/FF4/D
I1/FF5/D
使用break和continue命令
Break和continue命令改变while,for,和foreach命令的数据流
Break命令使内部循环中断,
Continue命令使得内部循环的当前迭代中断。
Basic File Commands
本部分介绍了需要使用文件时的Tcl命令概述,可以使用这些命令对文件的的方向检索信息进行操作,从文件中读取和写入操作。
cd和pwd命令
cd 和pwd命令等效于在操作系统中使用的,使用cd命令改变当前的工作路径,使用pwd命令打印当前工作路径的路径名。
file和glob
使用file和glob命令检索文件信息,以产生文件名称列表。
使用file命令检索文件信息,file命令有如下的形式:
File option arg arg ...
File命令选项:
file dirname fname Returns the directory name part of a file name.
file exists fname Returns 1 if the file name exists, 0 otherwise.
file extension fname Returns the extension part of a file name.
file isdirectory fname Returns 1 if the file name is a directory, 0 otherwise.
file isfile fname Returns 1 if the file name is a file, 0 otherwise.
file readable fname Returns 1 if the file is readable, 0 otherwise.
file rootname fname Returns the name part of a file name.
file size fname Returns the size, in bytes, of a file.
file tail fname Returns the file name from a file path string.
file writable fname Returns 1 if the file is writable, 0 otherwise.
可以使用glob命令产生文件名列表,例如:
Set flist [glob *.em *.volt]
例子产生当前路径中后缀为.em 和 .volt文件的列表
Open close 和 flush
可以使用open, close 和flush命令设置文件的读取
Open命令有如下的形式:
Open fname ? access_mode ?
Open 命令返回一个字符串(文件的ID),通过open命令获得的,进而标识文件以进一步交互利用
使用close命令关闭一个文件,有如下的形式。
close $fid
$fid 参数是文件的ID,是通过open命令获得的,下面的例子说明了open和close命令的用法
Set f [open VDD.em w+]
close $f
使用flush命令强制缓冲的输出写入到文件中去,数据写入文件中并不会直接出现在文件中,相反,数据会会在memory中处于队列状态稍后写入文件中,flush 命令忽略这中特性
Flush命令形式如下:
flush $fid
可以使用gets命令从文件中读取单一的一行,puts命令将单一的一行写入文件中。
Get名令有如下的形式:
gets $fid var
$fid参数是通过open文件时获得的ID,var参数是接收数据行的变量。
当有一行数据被读取时,文件指向下一行,gets命令返回读取的字符数量,如果没有字符被读取,gets返回一个-1,并且将变量var置空字符串。
Puts命令有如下的形式:
puts ? $fid? var
以下将说明使用gets 和 puts命令的使用说明
# Write out a line of text, then read it back and print it
set fname "mytext.txt"
# Open file, then write to it
set fid [open $fname w+]
puts $fid "This is my line of text."
close $fid
#
# Open file, then read from it
set fid [open $fname r]
set data_in [gets $fid]
close $fid
#
# Print out data read
echo $data_in
非连续文件读取
在默认情况下,gets和puts命令式连续读取文件,可以使用seek, tell和eof 命令管理不连续的文件读取。
可以使用seek命令移动文件的读取位置,读取位置是文件中下次读写的指针。
默认情况下,读取指针是上次读写终止的地方。
Seek命令的最简单形式如下:
seek $fid offset
$fid参数是文件的ID(是在open命令中得到的);offset参数是偏移读取位置的字节数。
Chapter 3
Working with Procedure 进程的操作
一个进程是一个命名的指令的块(block),实现特殊的功能任务。
通过进程,使用现有的TCL和Synopsys命令创造新的命令,本章将介绍怎样产生进程,描述了怎样使用synopsys进程扩展
Creating Procedures 产生进程
可以使用Tcl命令产生一个进程
Ubuntu又一次被我搞死,DC装好怎么都用不起到 dc_shell, 没办法只好用
pt_shell学习脚本语言了。
2010-7-8
Variable Scope变量范围
变量的范围说明在脚本文件中变量的作用范围,在Tcl中,变量的范围或者是局部的或者是全局的,使用脚本或者进程时,必须注意变量的范围以确保变量被恰当使用。
当进程被调用时,进程中每个参数都是局部变量,局部变量只在进程内部使用,进程终止时,局部变量将被删除,产生于进程内部的变量也被称为局部变量。
进程外部的变量称为全局变量,在进程内部通过使用global命令可以使用全局变量
参数默认
进程中一个或多个参数还可以采用默认值,为了设定参数的默认值,可以将进程中的参数列表表示:即包含了参数的名称和其默认值,例如,这里值得注意的是{}中分行写时不需要使用”\”
# procedure max
# returns the greater of two values
proc max {{a 0} {b 0}} {
if {$a > $b} {
return $a
}
return $b
}
在调用时使用 max 9 5 ,返回结果9
Variable Numbers of Arguments 可变化的参数数量
也可以创建进程,使用参数args,实现其中的参数数量是可变化的,该参数必须放在参数列表中最后位置,前面的参数由前一节中描述的处理,额外的参数被放在args中作为列表使用,下面给出了例子:
# print the square of at least one number
proc squares {num args} {
set nlist $num
append nlist " "
append nlist $args
foreach n $nlist {
echo "Square of $n is [expr $n*$n]"
}
}
Extending Procedures
本部分介绍了synopsys中的define_proc_attributes和
parse_proc_arguments命令,这些命令增加了进程的功能,利用这些命令,可以这些进程可以创建例如synopsys中的help 和语义属性等
当创建一个进程时,进程固有的属性有:
没有帮助文档,进程的主题可以看做是Tcl的信息部分命令;进程可以被修改;进程名字可以被缩写(根据sh_command_abbrev_mode变量)
通过使用define_proc_attributes命令,可以
定义命令的help文档;声明参数生效的规则;预防进程被修改等
使用parse_proc_arguments命令联合define_proc_attributes命令定义进程中的-help选项以支持进程中参数的有效性。
Using the define_proc_attributes Command
使用synopsys中的define_proc_attributes命令定义以及改变进程的属性。
语法如下:
define_proc_attributes proc_name ?-info info_text?
?-define_args arg_defs? ?-command_group group_name?
?-hide_body? ?-permanent? ?-dont_abbrev?
proc_name
define_proc_attributes Command Example
dc_shell> proc plus {a b} {return [expr $a + $b]}
dc_shell> define_proc_attributes plus -info "Add two numbers"
-define_args { \
{a "first addend" a string required} \
{b "second addend" b string required} \
{"-verbose" "issue a message" "" boolean optional}}
dc_shell> help -verbose plus
Using the parse_proc_arguments Command
parse_proc_arguments命令将参数传递给由define_proc_attributes命令定义的进程的内部
在进程内部使用parse_proc_arguments命令支持参数的有效性,以使得-help 选项有效。
Chapter4
Working with Collections
Collection是一组设计对象的集合,例如libraries.ports,以及cells,通过使用synopsys提供的命令创建,观察和操作集合,本章将描述怎样使用synopsys 命令,使用Tcl语言处理集合。
Creating Collections
使用synopsys的get_* 和all_*命令创建collections(集合),下面例子给出了一个创建端口集合的设计(dc_shell跑不起,就在design_vision下跑的):
可以将命令集合创建到一个变量中:
Design_vision > set myports [get_ports]
Displaying Objects in a Collection
在命令提示符中使用的命令可以将集合中的所有相应元素列举出来,为了更加灵活,可以使用query_objects命令将集合中的所有元素列举出来。
query_objects命令产生所有的输出端口,和报告命令的输出端口相似。
队列结果以Tcl列表形式给出,因此可以直接使用结果,例如要显示所有以字符串c 开始的端口,输入下面的命令
design_vision> query_objects [get_ports c*]
{clk,clk_out}
Query_objects命令能够直接搜索设计库,例如:
design_vision> query_objects –class port c*
{clk,clk_out}
Selecting Objects From a Collection
可以使用集合命令filter选项或者filter_collection命令从集合中选择特殊的对象,每个-filter 选项和filter_collection命令使用filter表达式约束结果集合
Using Filter Expressions
filter表达式是一组逻辑表达式描述在集合中要添加的约束,filter表达式通过相应的操作符比较有值的属性名,例如下面的filter表达式选择继承对象名(其面积属性值小于12单位)。
"is_hierarchical==true && area<12"
Adding Objects to a Collection
使用add_to_collection 命令增加集合的对象,add_to_collection命令增加新的集合包含原始集合中,增加额外的对象,原始集合没有被修改。
Comparing Collections
使用compare_collections命令比较两个集合的内容,如果两个集合中的内容一样,则Comparing Collections命令返回0,否则返回非0。
例如:
design_vision> compare_collection [get_cells *] [get_cells *]
Copying collections
Copy_collection命令用来复制集合,结果产生一新的集合,基本的集合不发生变化,copy_collection命令对于复制存在的集合是一种有效的方法,例子如下:
Extracting objects From a collection
Index_collection命令产生一个集合,其对象元素是另一个集合中的第n个元素对象。
集合中的元素对象从0 到n-1.从命令中得到的集合,例如get_cells 可能不是按序排列的,但每一个都是可预测的,同样的命令执行n次,(例如
get_cells *)得到的集合是一样的。
例如,从结合中抽取第一元素对象:
Chapter 5
A Tcl Script Example
本章将讲解一些Tcl脚本文件,以说明怎样使用Tcl脚本文件和synopsys命令,以及在前些章节中讲解的topics. 从细节上对Tcl脚本文件进行讲解。
脚本文件中包含dc_rpt_cell进程和define_proc_attributes命令,用来扩展dc_rpt_cell的属性。
DC_rpt_cell综述
DC_rpt_cell脚本有两个部分,第一部分是dc_rpt_cell进程,第二部分是define_proc_attributes命令,define_proc_attributes命令扩展了
dc_rpt_cell进程的属性。
DC_rpt_cell进程列举了设计中所有的cell,并且如果cell有如下的特性将产生报告文档。
黑盒,保护属性,继承,组合以及测试cell。
在例子5-1中给出了脚本文件的全部程序代码Dc_rpt_cell,这里给出了使用该Tcl家在设计数据库德方法:我在这里使用的是任意整数分频电路,而脚本文件使用的例5-1中的脚本文件,最后执行的结果和例子中的还是有很大的区别,这里只是想了解一下,因而在Desing compiler中跑了一下,由于没有添加时序路径的约束,因而生成的报告中,没有关于路径约束的部分。
这个脚本文件还是值得自己仔细研究一下。
Source DC_rpt_cell #脚本文件
Read_file –format verilog ddc /home/fzz/verilog_study/clk_any.ddc
DC_rpt_cell –total_only
例子5-1 DC_rpt_cell脚本文件
#Title: DC_rpt_cell.tcl
#
#Description: This Design Compiler Tcl procedure generates a cell # report of a design.
# It reports all cells and the following attributes: # b - black box (unknown)
# d - has dont_touch attribute
# dw - DesignWare part
# h - hierarchy
# n - noncombinational
# t - test cell
#
#Options: -all_cells one line per cell plus summary # -hier_only every hierarchy cell and summary # -total_only generate summary only
#
#Software: Y-2006.06
#Version: June 2006
#Usage: dc_shell> source DC_rpt_cell.tcl
# dc_shell> DC_rpt_cell -t
#
proc DC_rpt_cell args {
suppress_message UID-101
set option [lindex $args 0]
if {[string match -a* $option]} {
echo " "
echo "Attributes:"
echo " b - black-box (unknown)"
echo " d - dont_touch"
echo " dw - DesignWare"
echo " h - hier"
echo " n - noncombo"
echo " t - test cell"
echo " "
echo [format "%-32s %-14s %5s %11s" "Cell" "Reference" "Area" "Attributes"]
echo
"-----------------------------------------------------------------"
} elseif {[string match -t* $option]} {
set option "-total_only"
echo ""
set cd [current_design]
echo "Performing cell count on [get_object $cd]"
echo " "
} elseif {[string match -h* $option]} {
set option "h"; # hierarchical only
echo ""
set cd [current_design]
echo "Performing hierarchical cell report on [get_object $cd] "
echo " "
echo [format "%-36s %-14s %11s" "Cell" "Reference" "Attributes"]
echo
"-----------------------------------------------------------------"
} else {
echo " "
echo " Message: Option Required (Version - December 2002)"
echo " Usage: DC_rpt_cell \[-all_cells\]
\[-hier_only\]\[-total_only\]"
echo " "
return
}
# initialize summary vars
set total_cells 0
set dt_cells 0
set hier_cells 0
set hier_dt_cells 0
set dw_cells 0
set seq_cells 0
set seq_dt_cells 0
set test_cells 0
set total_area 0
# initialize other vars
set hdt ""
set tc_atr ""
set xcell_area 0
# create a collection of all cell objects
set all_cells [get_cells -h *]
foreach_in_collection cell $all_cells {
incr total_cells
set cell_name [get_attribute $cell full_name] set dt [get_attribute $cell dont_touch]
if {$dt=="true"} {
set dt_atr "d"
incr dt_cells
} else {
set dt_atr ""
}
set ref_name [get_attribute $cell ref_name]
set cell_area [get_attribute $cell area]
if {$cell_area > 0} {
set xcell_area $cell_area
} else {
set cell_area 0
}
set t_cell [get_attribute $cell is_a_test_cell] if {$t_cell=="true"} {
set tc_atr "t"
incr test_cells
} else {
set tc_atr ""
}
set hier [get_attribute $cell is_hierarchical]
set combo [get_attribute $cell is_combinational] set seq [get_attribute $cell is_sequential]
set dwb [get_attribute $cell DesignWare]
set dw_atr ""
if {$hier} {
set attribute "h"
incr hier_cells
set hdt [concat $option $hier]
if {$dt_atr=="d"} {
incr hier_dt_cells
}
if {$dwb=="true"} {
set dw_atr "dw"
incr dw_cells
}
} elseif {$seq} {
set attribute "n"
incr seq_cells
if {$dt_atr=="d"} {
incr seq_dt_cells
}
set total_area [expr $total_area + $xcell_area] } elseif {$combo} {
set attribute ""
set total_area [expr $total_area + $xcell_area]
} else {
set attribute "b"
}
if {[string match -a* $option]} {
echo [format "%-32s %-14s %5.2f %2s %1s %1s %2s" $cell_name $ref_name \
$cell_area $attribute $dt_atr $tc_atr $dw_atr]
} elseif {$hdt=="h true"} {
echo [format "%-36s %-14s %2s %2s" $cell_name $ref_name $attribute \
$dt_atr $dw_atr]
set hdt ""
}
} ; # close foreach_in_collection
echo
"-----------------------------------------------------------------"
echo [format "%10s Total Cells" $total_cells]
echo [format "%10s Cells with dont_touch" $dt_cells]
echo ""
echo [format "%10s Hierarchical Cells (incl DesignWare)" $hier_cells]
echo [format "%10s Hierarchical Cells with dont_touch"
$hier_dt_cells]
echo ""
echo [format "%10s DesignWare Cells" $dw_cells]
echo ""
echo [format "%10s Sequential Cells (incl Test Cells)" $seq_cells]
echo [format "%10s Sequential Cells with dont_touch" $seq_dt_cells]
echo ""
echo [format "%10s Test Cells" $test_cells]
echo ""
echo [format "%10.2f Total Cell Area" $total_area]
echo
"-----------------------------------------------------------------"
echo ""
}
define_proc_attributes DC_rpt_cell \
-info "Report all cells in the design (v12/2002)" \
-define_args {
{-a "report every cell and the summary"}
{-h "report only hierarchy cells and the summary"}
{-t "report the summary only"} }
DC _rpt_cell脚本通过以下的几个方面讲解:
定义进程,制止警告信息,检查参数,初始化变量,创建、并在集合之间迭代、收集报告数据,格式化输出
Defining the Procedure
DC_rpt_cell进程仅要求有一个参数,因而定义简单,下面给出DC_rpt_cell 的定义
proc DC_rpt_cell args{
procedure body ….
}
使用Tcl中的proc命令实现定义进程,DC_rpt_cell命名进程,args是在进程被调用时接受参数的变量,args的值在进程内部的使用,例如如下的描述方式:
Set option [linux $args 0] # 这里就是对参数的引用
Synopsys的define_proc_attributes命令提供关于进程的额外信息,例如定义一些帮助或者提示信息,对于DC_rpt_cell,define_proc_attributes命令用来声明关于dc_rpt_cell的额外的帮助信息。
例5.4中给出了
define_proc_attributes和DC_rpt_cell一起使用的例子
例子5-4 :
define_proc_attributes DC_rpt_cell \
-info "Procedure to report all cells in ..." \
-define_args {
{-a "report every cell and the summary"}
{-h "report only hierarchy cells and the summary"}
{-t "report the summary only"} }
额外的信息中有一行用来描述 dc_rpt_cell,描述其所希望启动的选项,在终端运行时,下面的例子给出了define_proc_attributes定义DC_rpt_cell的。
给出了简单的的关于帮助的信息。