这些实例介绍了采用Synopsys设计约束(SDC)来约束源同步输出时序的两种方法。如果要约束源同步输出时序,必须采取方法规定相对于FPGA时钟驱动输出的输出延时。
生成时钟
您可以在 FPGA 时钟输出端口建立一个生成时钟。生成时钟自动计算与源时钟的延时。必须进行以下三种约束来约束图 1 中简单电路的输出。
- 基本时钟驱动 clk_in 端口
- clk_out 端口的生成时钟
- data_out 端口的输出延时约束,相对于 clk_out 端口的生成时钟。
图1.带有生成时钟的源同步约束
以下 SDC 命令对输出进行约束。
# Define the input clock
create_clock -period 10 -name clk_100 [get_ports clk_in]
# Apply a generated clock to the output of the PLL
create_generated_clock -name pll_output \
-source [get_pins inst|altpll_component|pll|INCLK[0]] \
[get_pins inst|altpll_component|pll|CLK[0]]
# Apply a generated clock to the clk_out port
create_generated_clock -name clk_out \
-source [get_pins inst|altpll_component|pll|CLK[0]] \
[get_ports clk_out]
set_output_delay -clock clk_out 1.200 [get_ports data_out]
-reference_pin选项
-reference_pin选项是Altera专用SDC扩展,简化了对源同步输出的约束。通过set_input_delay/set_output_delay命令使用-reference_pin选项时,需要规定相对于网表中引脚和端口的输入或者输出延时。
-reference_pin选项自动包括特定端口或者引脚的时钟延时。对于源同步输出,输出延时是相对于输出时钟端口。在图2的电路中,clk_in端口和clk_out端口的延时包含在 -reference_pin选项中。
图2.带有-reference_pin 选项的源同步约束
下面的SDC命令对输出进行约束。这个例子中不需要生成时钟,这是因为-reference_pin选项含有延时 。
# Define the input clock
create_clock -period 10 -name clk_100 [get_ports clk_in]
# Apply a generated clock to the output of the PLL
create_generated_clock -name pll_output \
-source [get_pins inst|altpll_component|pll|INCLK[0]] \
[get_pins inst|altpll_component|pll|CLK[0]]
# Set the output delay with the -reference_pin option
set_output_delay -clock pll_output -reference_pin [get_ports clk_out] \
1.200 [get_ports data_out]
