在Verilog中使用门级描述的JK触发器给了我一个定时错误

在Verilog中使用门级描述的JK触发器给了我一个定时错误,verilog,fpga,ice40,Verilog,Fpga,Ice40,我仍然在最低的Verilog级别的gate级别上玩。 我发现这个帖子: 在这一点上,我可以理解这个想法,我可以解决一个主从JK触发器用作分频器的问题。我使用冰暴工具链,Yosys没有抱怨,但下一个PNR给了我这个错误: 错误:由于存在组合回路、时序端口规格不完整等原因,时序分析失败 这是我的代码: module syncRX(clk, signal, detect); output wire [7:0] detect; input clk, signal; re

我仍然在最低的Verilog级别的gate级别上玩。 我发现这个帖子: 在这一点上,我可以理解这个想法,我可以解决一个主从JK触发器用作分频器的问题。我使用冰暴工具链,Yosys没有抱怨,但下一个PNR给了我这个错误:

错误:由于存在组合回路、时序端口规格不完整等原因,时序分析失败

这是我的代码:

module syncRX(clk, signal, detect);
    output wire [7:0] detect;
    input clk, signal;
    
    reg [6:0] det = 7'b1001010;
    
    assign detect = {det, jk5_out};
    
    jk_flip_flop_edge_triggered jk0(.Q(jk5_out), .Qn(Qn), .C(clk), .J(1), .K(1), .RESETn(0));

endmodule // top

module jk_flip_flop_edge_triggered(Q, Qn, C, J, K, RESETn);
   output Q;
   output Qn;
   input  C;
   input  J;
   input  K;
   input  RESETn;

   wire   Kn;   // The complement of the K input.
   wire   D;   
   wire   D1;   // Data input to the D latch.   
   wire   Cn;   // Control input to the D latch.
   wire   Cnn;  // Control input to the SR latch.
   wire   DQ;   // Output from the D latch, inputs to the gated SR latch (S).
   wire   DQn;  // Output from the D latch, inputs to the gated SR latch (R).

   assign D1 = !RESETn ? 0 : D;  // Upon reset force D1 = 0

   not(Kn, K);   
   and(J1, J, Qn);
   and(K1, Kn, Q);   
   or(D, J1, K1);   
   not(Cn, C);
   not(Cnn, Cn);   
   d_latch dl(DQ, DQn, Cn, D1);
   sr_latch_gated sr(Q, Qn, Cnn, DQ, DQn);   
endmodule

module d_latch(Q, Qn, G, D);
   output Q;
   output Qn;
   input  G;   
   input  D;

   wire   Dn; 
   wire   D1;
   wire   Dn1;

   not(Dn, D);   
   and(D1, G, D);
   and(Dn1, G, Dn);   
   nor(Qn, D1, Q);
   nor(Q, Dn1, Qn);
endmodule

module sr_latch_gated(Q, Qn, G, S, R);
   output Q;
   output Qn;
   input  G;   
   input  S;
   input  R;

   wire   S1;
   wire   R1;
   
   and(S1, G, S);
   and(R1, G, R);   
   nor(Qn, S1, Q);
   nor(Q, R1, Qn);
endmodule
好吧,我可以想象答案,如果我问发生了什么,我想知道为什么以及如何使它工作!谢谢大家

循环:

pin syncRX.jk0.dl.D->pins syncRX.jk0.dl.Q/Qn-> pins syncRX.jk0.sr.S/R->pins syncRX.jk0.sr.Q/Qn->pin syncRX.jk0.dl.D

若您从标准库实例化闩锁单元,则与定时路径和定时检查相关的问题将由该单元处理


我当然认为每个著名的实现工具都会报告这个循环。但既然你说Yosys没有抱怨,我也很困惑我没有使用Yosys。

错误消息会告诉你哪些节点参与了循环吗?@Serge根本没有。我应该添加完整的NextPNR输出吗?看起来sr锁存器实现不正确。请检查。@Serge我检查了,右边是第一页,但我的有一个clk inputThanks,嗯,我使用的是开源工具,我认为没有标准库。无论如何,如果我实现为一个顺序始终@。。。块工作,我知道,但我想作为一个组合块来解决。我相信对于门级模拟,你应该使用时间延迟,如果不是,你会得到一些组合循环。我正在处理延迟!谢谢