简体   繁体   English

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

[英]JK-flip flop using gate level description in Verilog give me a timming error

I still playing in the lowest Verilog level (gate level).我仍然在最低的 Verilog 级别(门级别)玩。 I found this post: https://electronics.stackexchange.com/questions/390661/is-it-possible-to-create-a-working-jk-flip-flop-using-gate-level-description-in in that I could understand that shoud work the idea, and I could solve to have a Master-Slave JK Flip-Flop for use it as a frequency divider.我在其中找到了这篇文章: https : //electronics.stackexchange.com/questions/390661/is-it-possible-to-create-a-working-jk-flip-flop-using-gate-level-description-in我可以理解应该可以实现这个想法,并且我可以解决使用主从 JK 触发器将其用作分频器。 I use Icestorm toolchain, Yosys is not complaining, but Next-PNR is giving me this error:我使用 Icestorm 工具链,Yosys 没有抱怨,但 Next-PNR 给了我这个错误:

ERROR: timing analysis failed due to presence of combinatorial loops, incomplete specification of timing ports, etc. ERROR:由于存在组合循环、时序端口规范不完整等,时序分析失败。

This is my code:这是我的代码:

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

Well, I can imagine the answer if I ask what happends, I would like to know why and how make it works!好吧,如果我问发生了什么,我可以想象答案,我想知道为什么以及如何使它起作用! Thanks to all!谢谢大家!

Loops:循环:

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引脚syncRX.jk0.dl.D --> 引脚syncRX.jk0.dl.Q/Qn --> 引脚syncRX.jk0.sr.S/R --> 引脚syncRX.jk0.sr.Q/Qn -->引脚syncRX.jk0.dl.D

If you instantiate latch cell from standard library, issues related to timing path and timing check will be handled by that cell.如果您从标准库中实例化锁存单元,则与时序路径和时序检查相关的问题将由该单元处理。

I would certainly think the loop will be reported by every well-known implementation tool.我当然认为每个著名的实现工具都会报告循环。 But since you said Yosys is not complaining, I'm also confused (I haven't used Yosys.)但是既然你说Yosys没有抱怨,我也很困惑(我没有用过Yosys。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM