Multicycle Paths Constraints Instance (Vivado高效设计案例分享)
- UID
- 1023229
- 来自
- 中国
|
Multicycle Paths Constraints Instance (Vivado高效设计案例分享)
本节通过实例介绍一下多时钟周期路径(multicycle paths)的约束方法。 如图1中结构,主时钟fast_clk,时钟频率250MHz;时钟使能信号div_by_two,由主时钟2分频得到,作为寄存器的clock enable信号。
图1
HDL代码如下所示:
module top(
fast_clk,
din_a,
din_b,
din_x,
din_y,
ab_out,
xy_out
);
////////////// PORT /////////////////////////////
input fast_clk;
input [7:0] din_a;
input [7:0] din_b;
input [7:0] din_x;
input [7:0] din_y;
output reg [15:0] ab_out;
output reg [15:0] xy_out;
////////////// ARCHITECTURE /////////////////////
// Clock Enable
reg div_by_two;
always@(posedge fast_clk)
div_by_two<=~div_by_two;
// Input Registers
reg [7:0] din_a_rg;
reg [7:0] din_b_rg;
reg [7:0] din_x_rg;
reg [7:0] din_y_rg;
always@(posedge fast_clk) begin
if(div_by_two) begin
din_a_rg <= din_a;
din_b_rg <= din_b;
din_x_rg <= din_x;
din_y_rg <= din_y;
end
end
// Multiplexer
wire [7:0] mult_a;
wire [7:0] mult_b;
assign mult_a = div_by_two ? din_a : din_x;
assign mult_b = div_by_two ? din_b : din_y;
// Multiplier
wire [15:0] mult_rlt;
assign mult_rlt = mult_a * mult_b;
// Ouptut Select
always@(posedge fast_clk) begin
if(div_by_two)
xy_out <= mult_rlt;
else
ab_out <= mult_rlt;
end
endmodule
时序图如图2所示,其中din_* --> din_*_reg,div_by_two_reg --> din_*_reg和div_by_two_reg --> **_out_reg路径都需要2个clock cycle,所有的多时钟周期路径如下表所示:
Source Register | Destination Register | Set-Up Relationship | Hold Relationship | div_by_two_reg | din_a_reg,din_b_reg | 2x (latch edge time) | 1x (latch edge time) | div_by_two_reg | ab_out_reg,xy_out_reg | 2x (latch edge time) | 1x (latch edge time) |
图2
综合后,首先约束主时钟,如图3所示,此时时序还未收敛,时序报告如图4所示,可以发现关键路径都是需要多时钟周期约束的路径。
图3
图4
然后约束多时钟周期路径,约束命令如下,如图5所示;此时时序也收敛,时序报告如图6所示。
set_multicycle_path -setup -from[get_cells div_by_two_reg] -to [get_cells {ab_out_reg din_a_IBUF_inst din_b_IBUF_inst din_x_IBUF_inst din_y_IBUF_inst xy_out_reg}] 2
set_multicycle_path -hold -from[get_cells div_by_two_reg] -to [get_cells {ab_out_reg din_a_IBUF_inst din_b_IBUF_inst din_x_IBUF_inst din_y_IBUF_inst xy_out_reg}] 1
图5
图6 |
|
|
|
|
|
- UID
- 1023229
- 来自
- 中国
|
|
|
|
|
|