DC LAB7 & DC综合约束文件编写

该文详细描述了在DCLAB4基础上修改的时序约束,包括时钟定义、输入时序、输出时序、组合逻辑时序以及环境属性。新增的约束选项涉及负边沿输入和输出时序。文章还概述了DCflow的执行步骤,如读入设计、约束、编译和报告等,用于验证和优化设计时序。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.constraints(在DC LAB4的基础上进行修改)

在这里插入图片描述

1.1 CLOCK DEFINITION

在这里插入图片描述
在这里插入图片描述

# A 333Mhz clock is a 3.0ns period:
#
create_clock -period 3.0 -name my_clk -waveform {0 1.2} [get_ports clk]

# External clock source latency is 700ps or 0.7ns
#
set_clock_latency -source  -max 0.7 [get_clocks my_clk] 

# The maximum internal clock network insertion delay or latency is 300ps or 0.3 ns:
#
set_clock_latency -max 0.3 [get_clocks my_clk]

# The +/-30ps internal clock delay variation to register clock pins results in a 60ps worst case skew or uncertainty, 
#if you launch late (+30ps) and capture early (-30ps)r; 
#Add 40ps due to jitter and 50ps for setup margin;
# This equals 150ps or 0.15 ns of total uncertainty.
#
set_clock_uncertainty -setup 0.15 [get_clocks my_clk]


# The maximum clock transition is 120ps or 0.12ns
#
set_clock_transition 0.12 [get_clocks my_clk]

在这里插入图片描述


1.2 INPUT TIMING

在这里插入图片描述

# The maximum "input delay" (external) on ports data1 and data2 is: 
# clock period - clock uncertainty - delay of S - register setup time = 
#     3.0      -      0.15         -     2.2   -      0.2            = 0.45ns
# 
set_input_delay -max  0.45 -clock my_clk [get_ports data*]  


# The latest arrival time at port sel is 1.4ns (absolute time). The total clock insertion delay or latency to the external 
# registers is 700ps + 300ps or 1.0ns. Therefore, the relative input delay on the port is 1.4 -1.0 = 0.4ns
#
set_input_delay -max  0.4 -clock my_clk [get_ports sel]

在这里插入图片描述


1.3 OUTPUT TIMING

在这里插入图片描述

# The output delay at port out1 is 420 + 80ps = 500ps or 0.50ns
#
set_output_delay -max  0.50 -clock my_clk [get_ports out1]


# The internal delay to out2 is 810ps. The external capturing clock edge happens 3ns after the launch edge, 
# minus the uncertainty of 0.15ns, or 2.85ns after launch. To constrain the internal delay to 0.81ns the 
# output delay must therefore be constrained to 2.85ns - 0.81ns = 2.04ns.
#
set_output_delay -max 2.04  -clock my_clk [get_ports out2]


# The setup time requirement on port out3 is 400ps or 0.4ns with respect to the capturing register's clock. 
# This is, by definition, the "set_output_delay" value
#
set_output_delay -max  0.4 -clock my_clk [get_ports out3] 

在这里插入图片描述


1.4 COMBINATIONAL LOGIC TIMING

在这里插入图片描述

# 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 my_clk [get_ports Cin*]
set_output_delay -max 0.1 -clock my_clk [get_ports Cout]

在这里插入图片描述


1.5 ENVIRONMENTAL ATTRIBUTES

  • clk attribute在设置clock时就指定过了
    在这里插入图片描述
# All input ports, except clk and Cin, are driven by bufbd1 buffers
#
set_driving_cell -lib_cell bufbd1 -library cb13fs120_tsmc_max [remove_from_collection [all_inputs] [get_ports "clk Cin*"]]

# Port Cin is a chip level input and has an input transition of 120ps or 0.12 ns
#
set_input_transition 0.12 [get_ports Cin*]

# All outputs, except Cout, drive 2x bufbd7 loads
#
set_load [expr 2 * {[load_of cb13fs120_tsmc_max/bufbd7/I]}] [get_ports out*]

# Cout drives 25fF, or .025 pF
#
set_load 0.025 [get_ports Cout*]

# operating condition use to scale cell and net delays.
#
set_operating_conditions -max cb13fs120_tsmc_max

2. Addition Constraints Options(在DC LAB4基础上新增的)

在这里插入图片描述
在这里插入图片描述


2.1 ADDITIONAL NEG-EDGE INPUT TIMING(F4)

在这里插入图片描述
在这里插入图片描述

# An additional input delay (-add_delay) of 420ps or 0.42 is applied to the sel port, with respect to a negative edge-triggered 
# register F4 (-clock_fall). The total clock insertion delay to F4 is supposed to be 600ps, while the default clock insertion 
# delay of 700ps (source) + 300ps (network) = 1000ps is being applied. We can model this by "including" the non-default 
# source + network latency total with the input delay value
# 
set_input_delay -max  1.02 -clock my_clk -add_delay -clock_fall  -network_latency_included -source_latency_included [get_ports sel]
#input delay 理论约束到0.42ns,但是现在到F4的clk有延迟0.6ns(和default不一样),所以约束到1.02ns

2.2 ADDITIONAL NEG-EDGE OUTPUT TIMING(F5)

在这里插入图片描述

在这里插入图片描述

# An additional output delay (-add_delay) of 260ps or 0.26 is applied to the out1 port, with respect to a negative edge-triggered 
# register F5 (-clock_fall). To model the 500ps "internal" or network latency, **we must "include" that in the input delay value**. 
# We are DELAYING the expected arrival time of the output signal. Since a positive output delay number represents an amount of 
# time BEFORE the capturing clock edge, but we want to DELAY the output's capture time, we must SUBTRACT the latency amount from 
# the output delay value: Updated output delay = 0.26 - 0.50 = -0.24 !!
#
set_output_delay -max -0.24 -clock my_clk -add_delay -clock_fall -network_latency_included [get_ports out1] 

#require time相当于是0.26ns,然后arrival time 相当于 0.5ns,延迟capture time

2.3 EXTERNAL LOAD ON INPUT PORTS

在这里插入图片描述

在这里插入图片描述

set all_in_ex_clk [remove_from_collection [all_inputs] [get_ports clk]]

# Each input port, except clk, is connected to 2 block, which each drive 3 bufbd1 buffers.
# The capacitive load is therefore 6 bufbd1 buffers, and the fanout is 2. The "fanout"
# is used to calculate more accurate parasitic RC's from the WLM:
#
set_load [expr 6 * {[load_of cb13fs120_tsmc_max/bufbd1/I]}] $all_in_ex_clk

2.4 检查上述约束文件的语法

在这里插入图片描述

3. 开始执行DC flow

3.1 启动DC

dc_shell-t -64bit -topo

3.2 读入设计、指定顶层、link

read_verilog MY_DESIGN.v
link

在这里插入图片描述

3.3 执行约束文件

在这里插入图片描述


3.4 check_timing(检查有没有没被约束到的)

  • warning不用管,setup只需要约束max delay,这里就没有约束min delay
    在这里插入图片描述

3.5 report_design

在这里插入图片描述
在这里插入图片描述


3.6 report_clock

在这里插入图片描述

3.7 report_clock -skew

在这里插入图片描述

3.8 report_port -verbose

3.8.1 input transition

在这里插入图片描述


3.8.2 input delay

在这里插入图片描述


3.8.3 output delay

在这里插入图片描述


3.9 write_script,将约束文件写出为.wssr

write_script -out scripts/MY_DESIGN.wscr

在这里插入图片描述


3.10 compile(以下三种都行)

compile_ultra -scan -timing -retime
redirect -tee -file compile.log  {compile_ultra -scan -timing -retime}
redirect -file compile.log  {compile_ultra -scan -timing -retime}

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述


3.11 report_constraint -all_violators

在这里插入图片描述


3.12 report_timing -to [get_ports out1] -input -trans -sig 6 -nets

  • Generate a timing report for the path to the out1 output. Include options to show net transition times and net delays to 6 decimal places, as well as net fanout’.

  • 注意clk是下降沿触发
    *在这里插入图片描述

在这里插入图片描述
在这里插入图片描述


3.13 report_timing -from [get_ports sel] -to [get_ports Cout] -input -trans -sig 6

在这里插入图片描述
在这里插入图片描述


3.14 report_timing -from [get_ports Cin*] -to [get_ports Cout]

在这里插入图片描述

3.15 保存设计

write -format ddc -hier -out mapped/MY_DESIGN.ddc

在这里插入图片描述

参考资源链接:[EDA技术解析:ASIC与FPGA开发,VHDL特点与综合过程](https://wenku.youkuaiyun.com/doc/7bw8ytnhf0?utm_source=wenku_answer2doc_content) 在FPGA开发过程中,综合约束文件是确保设计满足特定时序、引脚分配和其他硬件资源要求的关键。编写综合约束文件需要精确地理解项目的具体需求和目标FPGA的特性。首先,你需要确定时序要求,这通常包括设置时钟约束、输入输出延迟、建立保持时间等。这些信息将帮助综合工具优化设计,以满足时序要求。 其次,引脚约束文件(PDC或XDC文件,取决于使用的EDA工具)需要详细指明每个输入输出信号分配到FPGA的物理引脚。正确的引脚分配对于电路板的布局布线至关重要。 再者,资源约束也是综合过程中不可忽视的部分,它包括对查找表(LUTs)、寄存器、存储单元等硬件资源的限制。资源约束有助于设计的优化,可以防止过度消耗FPGA资源,导致设计无法成功布局布线。 为了准确地编写综合约束文件,建议仔细阅读FPGA厂商提供的设计指南和约束文件模板。同时,EDA工具通常会提供图形化界面辅助设置约束,可以使用这些工具来验证约束文件的正确性,并通过模拟进行预检验。 综合约束文件编写完成之后,应当进行时序分析和资源使用情况检查,确保所有约束均被正确应用且没有冲突。在实际操作中,编写和验证综合约束文件是一个迭代的过程,可能需要反复调试才能达到最佳的综合效果。 掌握综合约束文件编写是FPGA设计师的基本技能之一。为了深入学习如何有效地应用这些约束,推荐参考《EDA技术解析:ASIC与FPGA开发,VHDL特点与综合过程》一书,该书详细介绍了VHDL的综合过程以及如何使用综合约束文件优化设计,适合对EDA技术和FPGA开发有兴趣的读者。通过学习这本书中的知识,你可以更准确地编写综合约束文件,以满足各种复杂的设计需求。 参考资源链接:[EDA技术解析:ASIC与FPGA开发,VHDL特点与综合过程](https://wenku.youkuaiyun.com/doc/7bw8ytnhf0?utm_source=wenku_answer2doc_content)
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值