Design Complie实验,使用2007年Synopsy的Lab Guide
文章目录
- Design Complie实验,使用2007年Synopsy的Lab Guide
- 1 DC实验
- 1.1 Setup and Synthesis Flow
- Task 1 Update the setup file
- Task 2 Invoke Design Vision
- Task 3 Read the Design into DC Memory
- Task 4 Explore Symbol and Schematic Views
- Task 5 Explore the Mouse Functions
- Task 6 Constrain TOP with a Script file
- Task 7 Compile or Map to Vendor-Specific Gates
- Task 8 Generate Reports and Analyze Timing
- Task 9 Save the Optimized Design
- Task 10 Remove Designs and Exit Design Vision
- 1.2 Timing and Area Constraints
- 1.3 Environmental Attributes
- 1.4 More Constraint Considerations
1 DC实验
1.1 Setup and Synthesis Flow
Task 1 Update the setup file
为了观察.synopsys_dc.setup文件,需要查看隐藏文件。
Task 2 Invoke Design Vision
通过design_vision开启DC。可以看到的是,link library为 * sc_max.db ,target_library为sc_max.db ,symbol library为sc.sdb ,也可以通过在DCprompt中输入printvar去查看不同的library
点开File->Setup其中的search path如下,确保syn,syn_ver,sim_ver路径正确
Task 3 Read the Design into DC Memory
DC可以开VHDL,Verilog,System Verilog RTL文件。这里读取/rtl/TOP.vhd文件。
之后File->Link Design->OK进行连接,同时对这个unmapped设计进行ddc保存,保存到unmapped文件夹
Task 4 Explore Symbol and Schematic Views
点击create symbol view,生成top的symbol,
同时可以点进去(或者点击图标create design schematic)查看不同子模块的rtl,这里有FSM,DECODE,COUNT三部分组成。但是因为还没有完成design,所以暂时看不到gate级的电路
Task 5 Explore the Mouse Functions
鼠标schematic中右键,fit窗口大小
Task 6 Constrain TOP with a Script file
生成TOP.con约束文件,在命令行里输入source TOP.con
Task 7 Compile or Map to Vendor-Specific Gates
为了编译design,需要在DC中输入compile,log输出如下
其中area表示面积,Worst neg slack表示相对于其约束,设计中的关键路径或最坏路径有多少是违反的(实际的delay减去预期的delay)。total neg slack表示violating path slacks的总数。
compile结束后可以看到门级电路
Task 8 Generate Reports and Analyze Timing
在top的symbol下,输入rc(report constraint),这条语句被提前在.setup里面定义过了,他实现了下面的语句。
report_constraint -all_violators
同时也有rt(report timing),默认看的是关键路径上的。还有ra(area)
关键路径是指设计中从输入到输出经过的延时最长的逻辑路径。优化关键路径是一种提高设计工作速度的有效方法。一般地,从输入到输出的延时取决于信号所经过的延时最大路径,而与其他延时小的路径无关。在优化设计过程中关键路径法可以反复使用,直到不可能减少关键路径延时为止。EDA工具中综合器及设计分析器通常都提供关键路径的信息以便设计者改进设计,提高速度。
每一个path都有专属的slack,slack值可以是正,0或者负。某一个path拥有最坏的slack的话则称之为 critical path
critical path拥有最大的负slack值。若是所有的path都没有时序违规,则slack都是正数,此时最小的那个slack则是critical path。
可以查看endpoint slack historgram,点击create endpoint slack historgram
可以看到,critical path在I_COUNT处。图中红色为violating paths,绿色则为满足的约束
同时点slack里的名字,以及button,create pathschematic of selected logic,可以看到这个point
之后点中间的add paths to path schematic 可以看到在原理图里的path
Task 9 Save the Optimized Design
保存的是symbol,同时save as的时候要save all designs
同时也可以在history里保存command history
Task 10 Remove Designs and Exit Design Vision
fr:关闭所有designs窗口,也可以File->Remove All Designs
remove_design -designs
h:查看所有的commands
通过exit关闭DC.
通过下面可以重新加载log文件,需要提前把command.log复制册成lab2.log
design_vision -f lab2.log
1.2 Timing and Area Constraints
完成下面design的时序约束和面积约束。
Task 1 Determine the Target Library’s Time Unit
通过下面指令启动dc,并且read taget文件
dc_shell-t
read_db <target_library_FILE>
list_libs
生成report文件
Task 2 Create a Timing and Area Constraints File
写时序约束和面积约束
time unit:1ns
要求如下
约束lab4.con如下
###################################
# Constraints file for lab4
###################################
reset_design; #good first step
#f=333.3MHz
create_clock -period 3 [get_ports clk]
#clkgen->clock port 700ps
set_clock_latency -source -max 0.7 [get_ports clk]
#clk port->all internal and external register clock pins is 300ps +/- 30ps,which means max0.33n and min0.27n.If not use -source,delay is applied to clk network latency
set_clock_latency -max 0.33 [get_ports clk]
set_clock_latency -min 0.27 [get_ports clk]
#jitter +/-0.04n and margin 0.05n.Becauese it doesnot say setup or hold ,use default(include setup and hold)
set_clock_uncertainty 0.09 [get_ports clk]
#worst rise/fall transition time of any clk pins 0.12n,use default(include fall and rise)
set_clock_transition 0.12 [get_ports clk]
#assume a maximum setup time of 0.2n for any register in MY_DESIGN
#data1 and data2 2.2n delay through logic S. SO we have 3-(2.2+0.2)=0.6ns,where 3ns is Tclk ,2.2n is ports->S, 0.2n is Tsetup
set_input_delay -max 0.6 -clock clk [get_ports "data1 data2"]
#F3->sel ports 1.4ns. So we have 3-1.4=1.6ns(to ports,not ff,dont have setup time)
set_input_delay -max 1.6 -clock clk [get_ports sel]
##set output
#clk->out1=3-0.42-0.08=2.5,where 3n is Tclk,0.42n is combo logic at port out1,0.08n is F6 Tsetup
set_output_delay -clock clk -max 2.5 [get_ports out1]
#clk->out2=3-0.81=2.19,where 0.81n is internal delay
set_output_delay -clock clk -max 2.19 [get_ports out2]
#out3 has 0.4n Tsetup,3-0.4=2.6
set_output_delay -clock clk -max 2.6 [get_ports out3]
##Combinational Logic,need virtual clk.But we only have cin1&cin2 -> cout delay is 2.45n<3n.So no need opt
#creat_clock -name Vclk -period 2
#area
set_max_area 540
Check一下,无报错
Task 3 Apply Constraints and Validate
应用约束文件以及check
#apply
source scripts/lab4.con
#check no missing or conflicting
check_timing
#check design
report_clock
reprot_clock -skew
report_port -verbose
#write con
write_script -out scripts/lab4.wscr
lab4的schematic如下
通过source lab4.con来约束
查看clock等信息
clk时钟周期3ns,report_clock
对于clk的一系列约束report_clock -skew
对于ports的报告,load都为0,线模型未定义。report_port -verbose(查看完整设置)
input delay,均和设置一致
output delay,均和设置一致
写出约束文件,以进行进一步检查 是否正确。
diff a b
之后,对原约束文件进行修改,当完全符合之后的代码如下
###################################
# Constraints file for lab4
###################################
reset_design; #good first step
#f=333.3MHz
#
create_clock -period 3 [get_ports clk]
#clkgen->clock port 700ps
#
set_clock_latency -source -max 0.7 [get_clocks clk]
#clk port->all internal and external register clock pins is 300ps +/- 30ps,where +-30 is 60ps uncertainty.If not use -source,delay is applied to clk network latency
#
set_clock_latency -max 0.3 [get_clocks clk]
#jitter +0.04n(max) and margin 0.05n and +-30=60ps skew.Becauese it doesnot say setup or hold ,use default(include setup and hold)
#skew+jitter(max)+margin
#
set_clock_uncertainty -setup 0.15 [get_clocks clk]
#worst rise/fall transition time of any clk pins 0.12n,use default(include fall and rise)
#
set_clock_transition 0.12 [get_ports clk]
#assume a maximum setup time of 0.2n for any register in MY_DESIGN
#data1 and data2 2.2n delay through logic S. SO we have 3-(2.2+0.2+0.15)=0.45ns,where 3ns is Tclk ,2.2n is ports->S, 0.2n is Tsetup,0.15n is clock uncertainty
#
set_input_delay -max 0.45 -clock clk [get_ports "data1 data2"]
#F3->sel ports 1.4ns.
#The total clock insertion delay or latency to the external registers is 700p+300p=1n.So we have 1.4-1=0.4ns
#
set_input_delay -max 0.4 -clock clk [get_ports sel]
##set output
#out1=0.42+0.08=0.5,where 0.42n is combo logic at port out1,0.08n is F6 Tsetup
#
set_output_delay -clock clk -max 0.5 [get_ports out1]
#out2=3-0.15-0.81=2.04,where 0.81n is internal delay,0.15n is clk uncertainty
#
set_output_delay -clock clk -max 2.04 [get_ports out2]
#out3 has 0.4n Tsetup
#
set_output_delay -clock clk -max 0.4 [get_ports out3]
##The maximum delay through the combinational logic is 2.45ns. This can be constrained by pretending that there are launching registers on the input ports Cin1 and Cin2 and capturing registers on the output port Cout, and applying corresponding input and output delays. The sum of the external input and output delay values must be equal to the clock period minus the clock uncertainty minus the maximum combo delay = 3ns - 0.15ns - 2.45ns = 0.4ns. This means that the input and output delay values can be 0.4 and 0.0, or 0.2 and 0.2, or 0.1 and 0.3, etc., respectively.
#
set_input_delay -max 0.3 -clock clk [get_ports Cin*]
set_output_delay -max 0.1 -clock clk [get_ports Cout]
#area
set_max_area 540
通过组合逻辑的最大延迟为2.45ns。这可以通过假设在输入端口Cin1和Cin2上有启动寄存器,在输出端口Cout上有捕获寄存器,并应用相应的输入和输出延迟来限制。外部输入输出延时值之和必须等于时钟周期减去时钟不确定性减去最大组合延时= 3ns - 0.15ns - 2.45ns = 0.4ns。这意味着输入和输出延迟值可以分别为0.4和0.0,或0.2和0.2,或0.1和0.3,等等。
再次重复检查操作。红框中上边为标准答案(<),下方为本地答案(>),此时已经修改完成
这里注意get_clocks和get_ports的区别
- get_clocks:
- get_ports:
最后保存symbol ,save as ddc文件
1.3 Environmental Attributes
Constraint
环境属性的约束如下
首先根据lab4.con继续往下写约束条件
设置线模型的时候,先把auto_wire_load_selection 设置成false,这时,如果没有声明model_name,那么wire load model就不会被用到
Operating Conditons:
如何去看所有线负载模型的name
整体con文件
#ENVIRONMENTAL ATTRIBUTES
#input ex clk & cin*
#
set_driving_cell -lib_cell bufbd1 -library cb13fs120_tsmc_max \
[remove_from_collection [all_inputs] [get_ports "clk Cin*"]]
#120ps max input transition
#
set_input_transition 0.12 [get_ports Cin*]
#output
#ex cout
#
set_load [expr 2 * [load_of cb13fs120_tsmc_max/bufbd7/I]] [get_ports out*]
# Cout drives 25fF,
#
set_load 0.025 [get_ports Cout*]
# wireload model
# From the wireload model selection table, a design size between 200 and
# 8000 area units uses the model called "8000"; The default wireload
# mode in this library in "enclosed"
#
set auto_wire_load_selection false
set_wire_load_model -name 8000
# operating condition use to scale cell and net delays.
#
set_operating_condition -max cb13fs120_tsmc_max
Apply & Check
之后apply并且check
#apply:
source scripts/lab6.con
#check:
report_port -v
report_design
report_port -v
transition&input driving cell:
load:
report_design
使用的wire loading model为
operating conditions为
进行对比显示的都是(<)即和答案一致。(这里仍然使用的是get_ports clk)
最后保存symbol ,save as ddc文件
1.4 More Constraint Considerations
Constraint
Design schematic如下
constraint要求如下:
clock spec:
rename clk->my_clk,同时修改文中-clock my_clk,这里只有-clock需要修改,但是对于get_ports而言或者get_clocks而言他仍然是clk
要修改他的占空比,首先看create_clock的语法以及参数,如下。需要着重关注的是-waveform edge_list参数
waveform的话,已经规定Tclk为3ns那么3*0.4=1.2ns,所以waveform{0 1.2},从0n开始上升,1.2n下降
Input ports delay:
关注set_input_delay,因为在次之前已经有对input_delay的constraint故额外的需要add_delay。同时sel信号在之前我们知道存在clk的latency。以及注意是相对于下降沿的delay
Output port delay:
输出的clk latency就只有network的了,因为从内部往外传的,同时也是相对clk的negtive.
external fanout:
set_port_fanout_number 用来设置port的fanout数目
set wire model重新对输出的design进行定义,而enclosed用的是set_wire_load_mode,有三种不同的mode
整体代码如下
# more constraint
# input port delay
# sel,with latency 700ps (source) + 300ps (network)
#
set_input_delay -max 1.02 -clock my_clk -add_delay -clock_fall -network_latency_included -
source_latency_included [get_ports sel]
#output port delay
#only network latency ,clock fall,0.26-0.5=-0.24n
#
set_output_delay -max -0.24 -clock my_clk -clock_fall -add_delay -network_latency_included [get_ports out1]
#External fanout input
#each in port (ex clk)fans out to 2 other sub-blocks
#
set all_in_ex_clk [remove_from_collection [all_inputs] [get_ports clk]]
#model external capacitive loading,2*3=6
#
set_load [expr 6 * [load_of cb13fs120_tsmc_max/bufbd1/I]] $all_in_ex_clk
#model external fanout
#
set_port_fanout_number 2 $all_in_ex_clk
#External fanout output
#driving 3 sub-blocks
#
set_port_fanout_number 3 [all_outputs]
#wire load :sub-design
#wireload model->ForQA to sub-designs ARITH&COMBO
#use enclosed
#
set_wire_load_model -name ForQA [get_designs "ARITH COMBO"]
set_wire_load_mode enclosed
#wire load :ports
#wlm(wire load model):"16000"
#
set_wire_load_model -name 16000 [all_inputs]
set_wire_load_model -name 16000 [all_outputs]
Apply & Check
source scripts/lab9.con进行apply
check_timing,可以看到一些变动的信息
report_clock,3ns周期,0n上升,1.2n下降,名称为my_clk
report_port -v查看port情况
compare:
design_vision>write_script -out scripts/lab9.wscr
unix>diff scripts/lab9.wscr .solutions/lab9A.wscr
Compile
design_vision>compile_ultra -scan -retime -timing
注:这一步会比较久,完成会提示优化完成
再看他的schematic如下,相较于lab2时刻的电路,变动很大
同时检查是否还存在violation
save as到ddc文件