库的意义
通过 link_library,target_library,symbol_library 和 synthetic_library 命令为 Design
Compiler 指定链接库、对象库、符号库和综合库。
链接库和对象库是工艺库,对象库是指将 RTL 级的 HDL 描述门级时所需要的标准单元
综合库,它是由芯片制造商(Foundry)提供的,包含了物理信息的单元模型。链接库可以
是同 target_library 一样的单元库,或者是已综合到门级的底层模块设计,其作用如下:在
由下向上的综合过程中,上一层的设计调用底层已综合的模块时,将从 link_library 中寻找
并链接起来。
符号库定义了设计电路图所调用的符号。如果设计者想应用 Design Analyzer 图形用户
界面,就需要这个库。
另外,设计者必须通过 synthetic_library 命令来指定任何一种特殊的有许可的设计工具
库(不需要指定标准设计工具库)。
Link 报告链接信息,若有些库或者代码没找到会报错
check_design 检查 design 中的悬空管脚、短接等情况。主要关注其中的没有输入驱
动(no_drivers)、loop 和 tied to 的情况。 set_wire_load_model 选择连线负载模型,由
工艺库中的连线模型得到。命令区别于 set_wire_load_mode,mode 一共有三种,分别是
top、enclosed、segmented 三种。 set compile_segmap_propagate_constants false 把输
入端接固定电平的触发器当做固定电平而不看作触发器处理。 set uload 设置标准负载,具
体为哪一个,由后面的决定。一般选择与非门的输出引脚。 set_load [expr 10*$uload]
[all_outputs] 给所有的输出端设置负载,负载值为标准负载的 10 倍。 set_driving_cell 设
置 输 入 驱 动 , 一 般 选 择 反 相 器 。 set_fix_multiple_port_nets -feedthroughs -outputs
-constants -buffer –constants 给所有纯组合逻辑的路径(输入到输出都是组合逻辑)的
输出端加 buffer,以增强驱动能力。 define_name_rules 定义命名规则,方便后面流程工
具的识别。(在 link_path 中)source ./SDC/$module.sdc 吃进 sdc 约束文件。check_clocks
检查没有施加时钟约束的端口。 report_timing -delay max 报告 setup 情况。根据路径组
报出此路径下的最长延时,看是否满足 set 要求。 report_timing -delay min 报告 hold 情
况 , DC 时 一 般 不 做 此 检 查 , 在 APR 时 检 查 并 通 过 插 入 buffer 解 决 hold 问 题 。
report_constraint -all_violators 报告所有的时序违例。 report_transitive_fanout 报告时钟
树,即每一个寄存器的时钟。DC 时不对时钟树和全局 rst 信号综合。 write -format verilog
-hierarchy -output ./report/$module.net 生 成 综 合 后 的 网 表 文 件 。 write -format ddc
-hierarchy -output ./report/$module.ddc 生成综合后的二进制网表。
#script for Design Compiler# Language : TCL# Usage :# 1) make sure the lib in the
current directory# 2) if you...
:
3) change Step 3 : Variables to what you want
set synopsys_dc_setup_file 1,
if not, set synopsys_dc_setup_file 0
1) make sure the lib in the current directory
2) if you have the file .synopsys_dc.setup,
#script for Design Compiler
# Language : TCL
# Usage
#
#
#
#
#
#
#
#
#
#=====================================================
===
Especially : top module name, clock name,
reset name, all files name, and period
4) typing dc_shell-t -f run_72.tcl | tee -i run.log
search_path
/home/chanshi/dc/library/smic
set synopsys_dc_setup_file 0
#-----------------------------------------------------
# Step 1 :
# Setting Up path and library:
# If you have edited the file .synopsys_dc.setup, then you can skip over this step
#-----------------------------------------------------
if { $synopsys_dc_setup_file == 0} {
set
[list
/home/chanshi/dc/script]
set target_library {typical.db}
#set target_library {CSM35OS142_typ.db};
# if you want use typical library,change to typical.db
#set link_library [list {*} ram_interp_typical_syn.db ram_458_typical_syn.db typical.db]
set link_library [list {*} $target_library]
}
#set symbol_library {csm18ic.sdb csm18io.sdb}
#set synthetic_library {dw_foundation.sldb};
# Design Ware
set command_log_file
/home/chanshi/dc/rfid/source
"command.log"
#-----------------------------------------------------
# Step 2 :
# Compile Swithes
true ;
case_insensitive
multiplexed_flip_flop
#-----------------------------------------------------
#set verilogout_no_tri
# if inout used, tri net will be used
#通过将三态(tri)逻辑声明成线网(wire)来确保网表中不会出现三态逻辑,因为一些布
线工具很难读取包含 tri、tran 源语、assign 语句的网表,对于“inout”类型的 port,DC 产生
tri wire 语句和 tran 源语,对于 tri,还会产生 assign 语句
set test_default_scan_style
#设置扫描链的类型,还可以通过 set_scan_configuration -style 来设置
set link_force_case
#设置 link 命令是否区分大小写,默认是 check_reference,就是根据产生 reference 的模块
格式来判断是否大小写敏感,如果是 vhdl 格式就是不敏感,如果是 verilog 就敏感
define_name_rules VLSI_NET -allowed "a-zA-Z0-9_" -first_restricted "0-9_" -type net
-max_length 256
define_name_rules VLSI_CELL -allowed "a-zA-Z0-9_" -first_restricted "0-9_" -type cell
-max_length 256
define_name_rules VLSI_PORT -allowed "a-zA-Z0-9_" -first_restricted "0-9_" -type port
-max_length 256
define_name_rules
-max_length 256 -map {{{"*cell*", "mycell"}, {"*-return", "myreturn"}}};
set hdlin_check_no_latch "true"
#设置如果推断出锁存器,是否报 warning,默认是 false,即不报。
set hdlin_merge_nested_conditional_statements "true"
#顾名思义,是否把嵌套的 if 融合,默认值是 false,就是对于嵌套的条件语句(if 或 case
语句)中的每一个 if 和 case 都推断出一个选择器,这种做法有利于把某些迟到的条件判断
信号(late arriving signals)安排到离输出最近的选择器上(进而有利于减小延迟),如果
设成 true,就会把这些选择器融合成一个大的选择器,这样所有的选择信号到输出的距离都
是相同的
-allowed
"a-zA-Z0-9_"
TAN_RULE
-first_restricted
"0-9_\[]"
#-----------------------------------------------------
# Step 3 :
# Define Variables
#-----------------------------------------------------
set active_design "whole_modules";
# Top module name
source files.tcl;
# All RTL source_files (verilog)
set clock_name "clk";
# Name of clock
set reset_name "reset";
# Name of reset
set clk_period 70.0
#设置时钟周期,注意带小数点,这样计算出的值都带小数点,不然小于 1 的数都显示为 0
# Desired Clock Period = 1000/Frequence
set clk_uncertainty_setup [expr $clk_period/200];
#设置时钟不确定性,这里只设置了相对于建立时间的不确定性,就是时钟上升沿有可能提
前 clk_uncertainty_setup(时钟偏差和时钟抖动之和)到来,dc 要提前clk_uncertainty_setup
检查建立时间是否满足
# Uncertainty of clock
set clk_latency [expr $clk_period/10];
#设置时钟延迟,是时钟信号从其实际时钟原点到设计中时钟定义点的传输时间
# Network Latency of clock
# 考 虑 reg1+combo1--------combo2_input+reg2+combo2_output-----------combo3+reg3
的模型来解释 input_delay 和 output_delay,中间的 combo2_input+reg2+combo2_output
是要综合的模块
set input_delay [expr $clk_period/4];
#设置输入延迟,设置一个外部输入(组合逻辑 combo1)用了多少时间(即从时钟上升沿
到输入数据到来经历的延迟),dc 计算还有多少时间留给内部组合逻辑 combo2_input,例
如时钟周期为 10ns,input_delay 是 4ns,则还有(6-tsu)留给内部组合逻辑 combo2_input
# Input Delay of all input ports except clock
set output_delay [expr $clk_period/4];
#设置输出延迟,设置一个外部输出(组合逻辑 combo3)用了多少时间(即外部组合逻辑
的延迟),dc 计算有多少时间留给内部组合逻辑 combo2_output,例如时钟周期为 10ns,
output_delay 为 4ns,则还有(6-Tclk2Q)留给内部组合逻辑 combo2_output
# Output Delay of all output ports
set area_desired 0;
#设置面积的期望值,用于 set_max_area
set wire_load_model "smic18_wl20";
#为了精确地计算设置线载模型(DC 支持三种模式:
以此来决定如何选择用于跨层次边界的网线的线载模型),用于计算时序路径的延迟,用于
set_wire_load_model
# Model of the intra net
set output_load "typical/NAND2BX1/AN" ;
#为了精确地计算输出电路的时间,需要设置端口负载(输出或输入的外部电容负载),就
是为所有输出端口指定一个负载,综合时 dc 就会认为这里有一个这样的负载(并不是说综
合时在这里强制添加一个电容),dc 综合时就会选择满足这个负载的器件,例如假设已经
知道某输出端口要驱动的是一个反相器,那么把输出负载设置成这个反相器的输入负载即
可,当然可以设置成很大,这样 dc 就会用驱动能力很大的器件,来满足所有单元被驱动。
这个指令的作用是在布图前综合过程中设置模块输出端口的容性负载和往连线上反标注布
图后提取的电容信息,这里选取某一器件的某一引脚的负载作为 output load,也就是 dc 认
"$synthesis_reports/$active_design\_area.rpt"
"$synthesis_reports/$active_design\_references.rpt"
"$synthesis_reports/$active_design\_cell.rpt"
"$synthesis_reports/$active_design\_timing.rpt"
为所有输出端口要达到能驱动这个引脚
# model of the output_load
set synthesis_reports {/home/chanshi/dc/report};
#指定综合报告的输出目录
#name of report directory
sh mkdir $synthesis_reports;
set timing_report
set timing_max20_report "$synthesis_reports/$active_design\_timing_max20.rpt"
set area_report
set references_report
set cell_report
set constraint_report
set power_report
set check_syntax_report "$synthesis_reports/$active_design\_check_design.rpt"
set synthesis_netlist {/home/chanshi/dc/result};
#指定网表和 sdf/sdc/db 文件输出目录,本 dc 不支持生成 db 文件
#name of outfile directory
sh mkdir $synthesis_netlist;
#创建目录
set out_netlist
set out_db
set out_sdf
set out_sdc
"$synthesis_netlist/$active_design.v";
"$synthesis_netlist/$active_design.db";
"$synthesis_netlist/$active_design.sdf";
"$synthesis_netlist/$active_design.sdc";
"$synthesis_reports/$active_design\_constraint.rpt"
"$synthesis_reports/$active_design\_power.rpt"
#-----------------------------------------------------
# Step 4 :
# Read design to DC Memory
#-----------------------------------------------------
foreach active_files $files {read_verilog $active_files}
#foreach 语句,$files 是一个文件列表,把列表里的每一个文件轮流赋值给 active_files,然
后对 active_files 执行 read_verilog 函数,就相当于轮流对每一个文件执行 read_verilog 函
数
#exit
current_design $active_design
#设置当前设计
link
#把当前设计中实例化引用的单元链接到当前设计(即读取 link_library 指定的库到当前设
计)
uniquify
#为每一个例化单元起一个单独的名字(是对于某个模块多次引用的情况)
echo "Check Design Error!";
exit;
}
#check_design > $check_syntax_report
#if {[check_design] == 0} {
#
#
#
#-----------------------------------------------------
# Step 5 :
# Constraint
#-----------------------------------------------------
#-----Net load------
set_wire_load_model -name $wire_load_model
#设置线载模型
set_wire_load_mode top
#设置线载模式(top:所有层次中所有连线将继承和顶层模块同样的线载模型,因为顶层
电路规模最大,所以连线延迟最大,线载模型最悲观;enclosed:选择连线所在的子模块的
线载模型,子模块电路规模较顶层要小,连线延迟较短;segmented:不常用,用于跨层次
边界的连线)
#-----clock------
create_clock -name $clock_name -period [expr $clk_period] [get_ports $clock_name]
#设置时钟
set_clock_uncertainty -setup $clk_uncertainty_setup [get_clocks $clock_name]
#设置时钟不确定性
set_clock_latency $clk_latency [get_clocks $clock_name]
#设置时钟延迟
set_dont_touch_network [get_clocks $clock_name]
#在优化过程中对时钟网络不进行改变和替换,原因:由于时钟端口的负载很大,DC 会使用
Buffer 来增加其驱动能力。但一般设计者都使用布局布线工具来完成此项工作,所以有必要
指示 DC 不要对时钟网络进行修改,可以选中上图中“Don’t touch network”进行设置。
set_dont_touch_network [get_ports $reset_name]
#在优化过程中对复位信号不进行改变和替换
set_ideal_network [get_ports $reset_name]
#对 reset 设置成理想线网,因为 reset 的 fanout 太大,一般布图前都设置成理想线网,具
体原因有待研究#-----drive------
#set_driving_cell -lib_cell xr02d2 -pin A1 -library CSM35OS142_typ [all_inputs]
set_driving_cell -lib_cell NAND2BX1 -pin Y [all_inputs]
#为所有输入端口(除去时钟和复位)设置驱动模型,从而指定了驱动强度和转换时间
set_drive 0 [get_ports $clock_name]
#将时钟驱动能力设为无穷大,即将其阻抗设为 0
set_drive 0 [get_ports $reset_name]
#同上
#-----input/output delay------
set allin_except_CLK [remove_from_collection [all_inputs] [get_ports clk]]
set_input_delay [expr $input_delay] -clock $clock_name $allin_except_CLK
#设置输入延时
set_output_delay [expr $output_delay] -clock $clock_name [all_outputs]
#设置输出延时
#-----Output load------
set_load [load_of $output_load] [all_outputs]
#设置所有输出端口的负载
#----- Area ------
#set_max_area $area_desired
#----- insert buffer replace assign ------
set_fix_multiple_port_nets -all -buffer_constants
#如果一个线网连接着多个端口,则在网表中会出现 assign 语句,这是一种错误,为避免这
种错误,要消除多端口连线,可以通过插入 buffer 来消除(具体见《专用集成电路设计实
用教程》p146)
#-----------------------------------------------------
# Step 6 :
# Compile
# Also can use compile_ultra
#-----------------------------------------------------
compile -map_effort medium -boundary_optimization
#compile -map_effort medium
#-boundary_optimization -area_effort high
#compile -incremental_mapping
#-----------------------------------------------------
# Step 7 :
# Reports (Timing, Area ...)
#-----------------------------------------------------
remove_unconnected_ports [get_cells -hier {*}]
change_names -hierarchy -rules TAN_RULE
report_timing -delay max -max_paths 1 > $timing_report
report_timing -delay max -path end -max_path 80 > $timing_max20_report
report_area > $area_report
report_reference > $references_report
report_cell [get_cells -hier *] > $cell_report
report_constraint -all_violators -verbose > $constraint_report
report_power -analysis_effort high -verbose > $power_report
check_design > $check_syntax_report
#-----------------------------------------------------
# Step 8 :
# Write Files (netlist out)
#-----------------------------------------------------
change_names -rule verilog –hier
write -format verilog -hierarchy -output $out_netlist
write -format db -hierarchy -output $out_db
write_sdf $out_sdf
write_sdc $out_sdc
exit
#----------------------end-------------------