Vivado Bistreaming消息:违反规则(LUTLP-1)组合循环



bistream时我遇到了问题。该项目是创建一个以1:2占空比的时钟。在合成和实施过程中没有问题。我尝试了几种解决方法。但是他们的工作不好。

module clock_div(clk, clk_out);
input clk;
output reg clk_out;
integer count1, count2;
reg clk_div;
always@(posedge clk)
begin
    count1 <= count1 + 1;
    if(count1 == 16666667)
    begin
        count1 <= 0;
        clk_div <= ~clk_div;
    end
end
always@(clk_div)
begin
    count2 <= count2 + 1;
    if(count2 == 1)
    begin
        clk_out <= ~clk_out;
    end
    else if(count2 == 3)
    begin
        count2 <= 0;
        clk_out <= ~clk_out;
    end
end
endmodule

Vivado给出的信息如下:

    [DRC 23-20] Rule violation (LUTLP-1) Combinatorial Loop - 231 LUT 
    cells form a combinatorial loop. 
    This can create a race condition. 
    Timing analysis may not be accurate. 
    The preferred resolution is to modify the design to remove 
    combinatorial logic loops. 
    To allow bitstream creation for designs with combinatorial logic loops 
    (not recommended), use this command: set_property SEVERITY {Warning} 
    [get_drc_checks LUTLP-1]. 
    NOTE: When using the Vivado Runs infrastructure (e.g. launch_runs Tcl 
    command), add this command to a .tcl file and add that file as a pre- 
    hook for write_bitstream step for the implementation run. 
    clk_out_reg_i_3, clk_out_reg_i_4, clk_out_reg_i_5, clk_out_reg_i_7, 
    clk_out_reg_i_8, clk_out_reg_i_10, clk_out_reg_i_11, clk_out_reg_i_12, 
    clk_out_reg_i_13, clk_out_reg_i_14, clk_out_reg_i_15, 
    clk_out_reg_i_16, clk_out_reg_i_17, clk_out_reg_i_20, clk_out_reg_i_21 
    (the first 15 of 231 listed).

如果有人可以帮助我,我会很感激。

这是错误的:

always@(clk_div) // <<== WRONG!!!! 
begin
    count2 <= count2 + 1;
    if(count2 == 1)
    begin
        clk_out <= ~clk_out;
    end
    else if(count2 == 3)
    begin
        count2 <= 0;
        clk_out <= ~clk_out;
    end
end

您正在使用不完整的灵敏度列表。这给出了模拟和合成之间的不匹配。对于要合成的所有代码,请使用完整的灵敏度列表,甚至更容易使用:always@( * )

如果您在上面的部分中使用它,您会发现您的模拟不再有效。它将进入无限循环。这是该工具所抱怨的组合环。

要解决此问题,您应该将所有代码放入顶部:

always@(posedge clk)
begin
    count1 <= count1 + 1;
    if(count1 == 16666667)
    begin
        count1 <= 0;
        // Here you should make your 2:1 clock(s!) 
        // I leave that as an exercise to you
    end
end

问题:
当您除以16666667时,您将不会得到2:1时钟,而是33333334:1时钟。除非您想要Clk_div和Clk_out之间的2:1时钟,否则CLK_DIV不会出来。在这种情况下

最新更新